This file contains 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
# Path | |
# | |
if echo $PATH | grep -v $HOME/bin > /dev/null; then | |
export PATH="$HOME/bin:$PATH" | |
fi | |
# Recursive search with ack | |
# | |
export ACK_ROOT=$HOME |
This file contains 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
syntax on | |
" Indentation | |
" | |
filetype indent on | |
function! Spaces() | |
set expandtab | |
set shiftwidth=4 | |
set softtabstop=4 " Backspace deletes 4 spaces | |
set tabstop=4 |
This file contains 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/python | |
# This file is originally from http://code.google.com/p/git-svn-utils/source/checkout. 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) | |
p.wait() |
This file contains 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 runhaskell | |
import GHC.IO.Handle | |
import Network | |
import Network.Socket | |
main = do | |
handle <- connectTo "hackage.haskell.org" (PortNumber 80) | |
hPutStr handle "GET /packages/hackage.html HTTP/1.1\n" | |
hPutStr handle "Host: hackage.haskell.org\n" |
This file contains 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
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 |
This file contains 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 ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
This file contains 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 ( | |
"fmt" | |
"os" | |
) | |
func PrintInts() { | |
for i := 0; ; i++ { | |
fmt.Printf("%d\r", i) |
This file contains 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
This script has been moved to http://github.com/ijt/goscript and renamed to "goscript". |
This file contains 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
The new interface for system calls in Go is much better than it was. Check the examples here: | |
http://golang.org/pkg/os/exec/ | |
This file contains 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
{-# LANGUAGE ForeignFunctionInterface #-} | |
-- Simple example of calling C from Haskell. | |
-- | |
-- $ ghci | |
-- > :load FfiExample.hs | |
-- > c_sin pi | |
-- 1.2246467991473532e-16 | |
-- | |
-- $ ghc --make FfiExample.hs |
OlderNewer