Skip to content

Instantly share code, notes, and snippets.

@fnky
fnky / ANSI.md
Last active May 28, 2024 12:08
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@devinodaniel
devinodaniel / gist:8f9b8a4f31573f428f29ec0e884e6673
Created November 21, 2017 20:18
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
@tsujeeth
tsujeeth / get_from_map.go
Created December 5, 2014 16:51
Using Golang's reflect package (MakeFunc) to implement typed accessors for a map.
/* Using reflect.MakeFunc to fetch from map[string]interface{}.
* getString(key) will either return the 'string' value or empty string.
* getInt(key) will either return the 'int' value or a 0.
*/
package main
import (
"fmt"
"reflect"