Skip to content

Instantly share code, notes, and snippets.

View christopherhesse's full-sized avatar

Christopher Hesse christopherhesse

View GitHub Profile
@christopherhesse
christopherhesse / extract_chrome_cache_html.py
Created March 8, 2012 07:11
extract original content from chrome about:cache html source
import sys
import re
import gzip
import mimetypes
from mimetools import Message
from StringIO import StringIO
def parse_headers(raw_headers):
response_line, headers_text = raw_headers.split('\n', 1)
headers = Message(StringIO(headers_text))
@christopherhesse
christopherhesse / run.py
Created November 27, 2012 06:49
Python function for running a shell command
def run(command_str, ignore_errors=False, **kwargs):
"""
Run the given command and return the output. Any keyword arguments provided
will be formatted into the command string. Quoting arguments should not be
necessary.
Example:
run('rm {file}', file='test file')
=> rm "test file"
diff --git a/./src/github.com/christopherhesse/rethinkgo/ql2/ql2.proto b/./ql2.proto
index 3c1f5e3..1a7c8bf 100644
--- a/./src/github.com/christopherhesse/rethinkgo/ql2/ql2.proto
+++ b/./ql2.proto
@@ -2,11 +2,18 @@
// THE HIGH-LEVEL VIEW //
////////////////////////////////////////////////////////////////////////////////
-// Process: First send the magic number for the version of the protobuf you're
-// targetting (in the [Version] enum). This should **NOT** be sent as a
### Keybase proof
I hereby claim:
* I am christopherhesse on github.
* I am christopherhesse (https://keybase.io/christopherhesse) on keybase.
* I have a public key whose fingerprint is 085F 2732 FCBF 7FB0 50F7 F7FE 29CE 9751 41F0 6060
To claim this, I am signing this object:
@christopherhesse
christopherhesse / strip.go
Created September 17, 2014 22:11
export stripTags from html/template as strip.StripTags
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package strip
import (
"bytes"
"encoding/json"
"fmt"
@christopherhesse
christopherhesse / robots.go
Last active August 29, 2015 14:15
ricochet robots
package main
// NOTES:
// robot 0 is the robot with the same color as the goal
// does not ban trivial solutions
// this is just brute force with a list of previous game states
import (
"fmt"
"math/rand"
@christopherhesse
christopherhesse / app.yaml
Last active August 29, 2015 14:16
app engine profiling in go
module: default
version: none
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
@christopherhesse
christopherhesse / raster.go
Last active August 29, 2015 14:17
simple rasterizer
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"log"
"math"
"net/http"
* went to https://github.com/sourcegraph/sourcegraph-atom
* went to https://srclib.org/gettingstarted/#install-srclib
* downloaded mac os x version
* unzipped and put into /usr/local/bin
* ran `src toolchain install-std` (I didn't notice this was necessary the last time I installed srclib, seems like maybe the standard toolchain should come pre-built and installed?)
Installing/upgrading standard toolchains...
Go (sourcegraph.com/sourcegraph/srclib-go) ====================================
skipped sourcegraph.com/sourcegraph/srclib-go: no GOPATH set (assuming Go is not installed and you don't want the Go toolchain)
* `src config`
Running: [/Users/christopherhesse/.srclib/sourcegraph.com/sourcegraph/srclib-go/.bin/srclib-go scan --repo --subdir .]
--> with input {}
Running: [/Users/christopherhesse/.srclib/sourcegraph.com/sourcegraph/srclib-python/.bin/srclib-python scan --repo --subdir .]
--> with input {}
failed due to error: could not get requirements due to error setup.py does not exist
SCANNERS (2)
- sourcegraph.com/sourcegraph/srclib-go scan
- sourcegraph.com/sourcegraph/srclib-python scan