Skip to content

Instantly share code, notes, and snippets.

@michiakig
michiakig / ants.clj
Created July 19, 2011 22:37
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
@kartikshah
kartikshah / tail-color.sh
Created February 17, 2012 22:44
Color output of linux tail command
$tail -100f /var/log/applications/application.log | awk '
/INFO/ {print "\033[32m" $0 "\033[39m"}
/Exception/ {print "\033[31m" $0 "\033[39m"}
'
@Integralist
Integralist / remote-git.md
Created February 21, 2012 09:51
Basic set-up of remote git repository on a standard server

Set-up remote git repository on a standard server

The first thing to do is to install Git on the remote server.

Once you do that the rest of the process is split into three sections:

  1. Server set-up
  2. Local set-up (push commits)
  3. Server (pull commits)

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jordanorelli
jordanorelli / client.go
Created May 7, 2012 17:16
rpc server example in go
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {
@jordanorelli
jordanorelli / twopass.go
Created June 4, 2012 19:00
multi-stage json decoding in Go
package main
import (
"encoding/json"
"fmt"
"strings"
)
var (
stream = `
@jordanorelli
jordanorelli / tree.go
Created June 5, 2012 21:18
a tree, in go
package main
import (
"fmt"
"io"
"os"
)
type Tree struct {
Children []*Tree
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@stuarthalloway
stuarthalloway / Datomic News Updates
Created June 18, 2012 14:53
Datomic update examples against a social news database
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))
@jordanorelli
jordanorelli / templates.go
Created August 9, 2012 21:42
primitive template cache in Go with os.Stat
package core
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"path/filepath"