Skip to content

Instantly share code, notes, and snippets.

@HalCanary
HalCanary / slog_Lshortfile_example.go
Last active May 8, 2024 15:48
log/slog Lshortfile replacement example.
package main
import (
"os"
)
import (
"io"
"log/slog"
"path/filepath"
@Tamal
Tamal / git-ssh-error-fix.sh
Last active May 8, 2024 15:47
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@ajelenak
ajelenak / cloud-access-to-hdf5.ipynb
Last active May 8, 2024 15:47
Access HDF5 Files in S3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexfornuto
alexfornuto / matrix.sh
Last active May 8, 2024 15:44
Matrix Bash Script
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.
### Customization:
blue="\033[0;34m"
@irbull
irbull / OpenSSLExample.cpp
Created August 11, 2016 18:32
Code signing and verification with OpenSSL
#include <iostream>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <assert.h>
@fnky
fnky / ANSI.md
Last active May 8, 2024 15:42
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@carousel
carousel / snake-to-camel.php
Last active May 8, 2024 15:42
Convert snake to camel case and back with PHP
<?php
function camel_to_snake($input)
{
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
function snakeToCamel($input)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
}
@kisabelle
kisabelle / acf-pagination.php
Last active May 8, 2024 15:41
ACF Repeater Field Pagination
<?php
/*
* Paginate Advanced Custom Field repeater
*/
if( get_query_var('page') ) {
$page = get_query_var( 'page' );
} else {
$page = 1;
}
sudo apt update -y
sudo apt upgrade -y
sudo snap install code --classic
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install gcc g++ make
@ryanfitz
ryanfitz / golang-nuts.go
Created December 2, 2012 22:45
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl