This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func hashit(s string) []byte { | |
h := sha256.New() | |
h.Write([]byte(s)) | |
return h.Sum(nil) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = require("./objtest3.js"); | |
h = m.newHasher("This is a test") | |
h.hash().then((r) => { | |
console.log("hash of '" + h.s + "' is:", r.slice(0, 4)) | |
}).catch((e) => { | |
console.log("Error: ", e) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//go:generate gopherjs build --minify | |
import ( | |
"crypto/sha256" | |
"errors" | |
"github.com/gopherjs/gopherjs/js" | |
"github.com/miratronix/jopher" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# returns a path with some special front/back values and dups removed | |
import os | |
import sys | |
def getenv(name): | |
try: | |
return os.environ[name].split(':') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export JAVA_HOME="$(/usr/libexec/java_home)" | |
export ANDROID_HOME=/usr/local/opt/android-sdk | |
export GOPATH=$HOME/go | |
export PATH_FIRST=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:${JAVA_HOME} | |
export PATH_LAST=/usr/local/opt/go/libexec/bin:$GOPATH/bin | |
export PATH=$(fixpath.py) | |
export PATH_FIRST= | |
export PATH_LAST= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# checks status in all the git repositories below this one | |
# only prints status for those that aren't on master with no changes since the last tag | |
alltags() { | |
git tag | egrep "v[0-9]+\.[0-9]+\.[0-9]+(-.+)?" |tr '.-' ' *' |sort --numeric-sort --key 1.1 --key 2 --key 3 |tr ' *' '.-' | |
} | |
lasttag() { | |
alltags |tail -1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# broken down for "readability" | |
output = dict( | |
[ | |
(o, [e["pet"] for e in input if e["owner"] == o]) | |
for o in | |
set([i["owner"] for i in input]) | |
]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# oneline | |
output = dict([(o, [e["pet"] for e in input if e["owner"] == o]) for o in set((i["owner"] for i in input))]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
) | |
type Pet struct { | |
Owner string `json:"owner"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
data := bytes.NewBuffer([]byte(`[ |