Skip to content

Instantly share code, notes, and snippets.

View arsham's full-sized avatar

Arsham Shirvani arsham

View GitHub Profile
@tilaklodha
tilaklodha / google_authenticator.go
Created April 14, 2018 09:29
Simple Google Authenticator script in go
// Checkout the readme for this here: https://github.com/tilaklodha/google-authenticator
package main
import (
"bytes"
"crypto/hmac"
"crypto/sha1"
"encoding/base32"
"encoding/binary"
@arsham
arsham / files_not_containing_string.sh
Last active April 2, 2018 22:57
Find files not containing a string with grep. #bash #zsh #shell
grep -L <TEXT> --exclude "<EXCLUDE PATTERN>" */**/*
@drernie
drernie / csvtomap.go
Created March 10, 2017 22:48
Golang Convert CSV Records to Dictionaries using Header Row as Keys
// CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys
func CSVToMap(reader io.Reader) []map[string]string {
r := csv.NewReader(reader)
rows := []map[string]string{}
var header []string
for {
record, err := r.Read()
if err == io.EOF {
break
}
#cloud-config
ssh_authorized_keys:
- ssh-rsa xyz
write_files:
- path: /var/lib/rancher/conf/cloud-config.yml
permissions: "0644"
owner: root
content: |
#cloud-config
ssh_authorized_keys:
//This function was used in my test rig to convert elasticsearch results to a KML structure which is
// later fed to an iFrame wrapping the GoogleEarth plugin
var data=[];
var buckets=inData.aggregations.map.buckets;
function addCommas(nStr)
{
nStr += '';
@sloveland
sloveland / eol-semicolon.sublime-macro
Last active April 5, 2018 13:26
EOL semicolon and return (Sublime Text Macro)
[
{ "command": "set_mark" },
{ "command": "move_to", "args": {"to": "eol"} },
{ "command": "insert_snippet", "args": {"contents": "${TM_LINE_TERMINATOR:;}"} },
{ "command": "swap_with_mark" }
]
@nuxlli
nuxlli / sublime_text_2_useful_shortcuts.md
Created September 9, 2011 18:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt