Skip to content

Instantly share code, notes, and snippets.

kr / wait-example
Last active Oct 31, 2017
cond wait with context
View wait-example
// this is the example from,
// modified to use the cancelable wait described below.
for !condition() && ctx.Err() == nil {
wait(ctx, c)
... make use of condition or ctx ...
kr / style.css
Last active Aug 29, 2015
remove syntax colors in github diffs
View style.css
@-moz-document domain("") {
.pl-c1, .pl-mdh, .pl-mm, .pl-mp, .pl-mr, .pl-s1 .pl-v, .pl-s3, .pl-sc, .pl-sv, .pl-e, .pl-en, .pl-k, .pl-s, .pl-st, .pl-mo, .pl-v, .pl-pds, .pl-s1, .pl-s1 .pl-pse .pl-s2, .pl-sr, .pl-sr .pl-cce, .pl-sr .pl-sra, .pl-sr .pl-sre, .pl-src {
color: inherit ! important;
kr / Readme
Last active Jan 31, 2018
Run godoc at all times
View Readme
This launchd plist file will run godoc all the time on port 6060.
To have launchd start godoc at login, put godoc.plist in ~/Library/LaunchAgents:
curl -L |
sed s:YOUR_GODOC_HERE:`which godoc`: |
Then to load godoc right away:
launchctl load ~/Library/LaunchAgents/godoc.plist
View gist:cec682c1a5f51b1f74ab
- use CPS as an intermediate representation
- use the callcc operator to implement a task scheduler
- use tasks in js to provide blocking I/O functions
- profit
Currently, the compiler barely exists. You can define functions
and provide arguments, and add integers and write if statements.
View gist:4d1cc7596cd305d0b91e
ume:bubble kr$ cat hello.b
func main() {
println("hello, world")
ume:bubble kr$ bubble -d hello.b
Files: {
Funcs: {
kr /
Created Sep 11, 2014
scripts to migrate godep-using projects automatically

How it works:

Assumes you have a list of repos in a file called repos. Run ./ to fork all the repos and generate patches. Probably a bunch of them will break. Take the output of that command and pull out the ones that worked (lines ending in "ok") and put those repos in another file called topr. Run ./ and it'll send pull requests for the ones in that file. Then look at the log in do.log and try to figure out why the broken ones failed, and maybe fix it and rerun just those ones.

kr / gist:4c2ac22977b11d5aebb9
Last active Aug 29, 2015
how to get results from github search
View gist:4c2ac22977b11d5aebb9
function hasMore() {
return $('.next_page.disabled').length == 0;
function nextResults() {
function currentRepos() {
const q = '.code-list-item .title a:first-child';
kr /
Created Mar 7, 2014
Keybase Identity

Keybase proof

I hereby claim:

  • I am kr on github.
  • I am kr ( on keybase.
  • I have a public key whose fingerprint is B9C8 28EB 3CFA A3E7 426F 5E21 B2BC 2CE3 F5C3 7A58

To claim this, I am signing this object:

View main.go
package main
import (
func main() {
kr / jsonenv
Created Aug 6, 2013
convert a json dictionary into environment variables
View jsonenv
#!/usr/bin/env python
# jsonenv reads a json object as input and produces
# escaped shell commands for setting environment vars
import json
import pipes
import sys
for k, v in json.load(sys.stdin).items():