Skip to content

Instantly share code, notes, and snippets.

@michiakig
michiakig / ants.clj
Created Jul 19, 2011
Clojure ant sim from Rich Hickey
View ants.clj
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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 Feb 17, 2012
Color output of linux tail command
View tail-color.sh
$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 Feb 21, 2012
Basic set-up of remote git repository on a standard server
View remote-git.md

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)
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jordanorelli
jordanorelli / client.go
Created May 7, 2012
rpc server example in go
View client.go
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {
@jordanorelli
jordanorelli / twopass.go
Created Jun 4, 2012
multi-stage json decoding in Go
View twopass.go
package main
import (
"encoding/json"
"fmt"
"strings"
)
var (
stream = `
View tree.go
package main
import (
"fmt"
"io"
"os"
)
type Tree struct {
Children []*Tree
View tmux.md

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 Jun 18, 2012
Datomic update examples against a social news database
View Datomic News Updates
;; 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 Aug 9, 2012
primitive template cache in Go with os.Stat
View templates.go
package core
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"path/filepath"