Skip to content

Instantly share code, notes, and snippets.

Issac Trotts ijt

  • Oakland, CA
Block or report user

Report or block ijt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ijt / .bashrc_common
Created Oct 23, 2010
.bashrc_common, sourced from my .bashrc files
View .bashrc_common
# Path
if echo $PATH | grep -v $HOME/bin > /dev/null; then
export PATH="$HOME/bin:$PATH"
# Recursive search with ack
View vimrc.vim
syntax on
" Indentation
filetype indent on
function! Spaces()
set expandtab
set shiftwidth=4
set softtabstop=4 " Backspace deletes 4 spaces
set tabstop=4
ijt / git-svn-diff
Created Dec 23, 2010
Shows differences between your local git-svn repo and the central svn repo
View git-svn-diff
# This file is originally from It
# contains some small changes by ijt to get it working on OS X.
import sys,re,os, subprocess
def get_output(cmd):
'''a little wrapper around subprocess.Popen'''
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
ijt / freebase_example.hs
Created Apr 30, 2011
Example of making a Freebase query from Haskell
View freebase_example.hs
import Network.HTTP (simpleHTTP, getRequest, getResponseBody, urlEncode)
main = do
resultJson <- queryFreebase "{\"query\":[{\"id\":null,\"name\":null,\"type\":\"/astronomy/planet\"}]}"
putStrLn resultJson
-- Runs a query against Freebase and returns the result in JSON format.
queryFreebase :: String -> IO String
queryFreebase jsonQuery = do
let query = urlEncode $ jsonQuery
ijt / haskell_http.hs
Created Apr 29, 2011
Example of an HTTP request in Haskell
View haskell_http.hs
#!/usr/bin/env runhaskell
import GHC.IO.Handle
import Network
import Network.Socket
main = do
handle <- connectTo "" (PortNumber 80)
hPutStr handle "GET /packages/hackage.html HTTP/1.1\n"
hPutStr handle "Host:\n"
ijt / goroutine_printf.go
Created May 1, 2011
How to call Printf in a goroutine without hanging
View goroutine_printf.go
package main
import (
func PrintInts() {
for i := 0; ; i++ {
fmt.Printf("%d\r", i)
ijt / gorun.bash
Created May 3, 2011
Script to run golang files as scripts. Moved to
View gorun.bash
This script has been moved to and renamed to "goscript".
ijt / exec_run_example.go
Created May 4, 2011
How to make a system call in golang and check the return status
View exec_run_example.go
The new interface for system calls in Go is much better than it was. Check the examples here:
ijt / applicative_quickcheck.hs
Created May 20, 2011
Example of checking a law for applicative functors using QuickCheck
View applicative_quickcheck.hs
#!/usr/bin/env runhaskell
import Control.Applicative
import Test.QuickCheck
newtype ZipList2 a = ZipList2 { getZipList :: [a] }
instance Applicative ZipList2 where
pure x = ZipList2 $ repeat x
(ZipList2 gs) <*> (ZipList2 xs) = ZipList2 (zipWith ($) gs xs)
ijt / panic_example.go
Created May 24, 2011
Example of exception handling in Go
View panic_example.go
// Exception handling example, fleshed out from Rob Pike's post
// at
package main
import "fmt"
func f(dopanic bool) {
defer func() {
if x := recover(); x != nil {
You can’t perform that action at this time.