Skip to content

Instantly share code, notes, and snippets.

View proglottis's full-sized avatar

James Fargher proglottis

  • Wellington, New Zealand
View GitHub Profile
package main
import (
"image"
"image/color"
"image/draw"
"image/png"
"os"
"github.com/golang/freetype/truetype"
require "formula"
class KitchenSync < Formula
homepage "https://github.com/willbryant/kitchen_sync"
url "https://github.com/willbryant/kitchen_sync/archive/0.37.tar.gz"
sha1 "4d9756ddf65de679c0dc6e1d5a69ad9984b9c28d"
depends_on "cmake" => :build
depends_on "boost"
depends_on "yaml-cpp"
package main
import (
"database/sql"
"encoding/json"
"net/http"
"os"
"strconv"
"time"
)
package main
import (
"crypto/md5"
"fmt"
"io"
"math/rand"
"runtime"
"time"
)
#!/usr/bin/env ruby
def fork_with_output(&block)
std_pipe = IO.pipe
err_pipe = IO.pipe
fork do
$stdout.reopen(std_pipe[1])
$stderr.reopen(err_pipe[1])
#!/usr/bin/env ruby
def word_number(n, words, separator='-', seed=nil)
r, n = n.divmod(words.length)
word = [words[n], seed].compact.join(separator)
if r < 1
word
else
word_number(r, words, separator, word)
end
@proglottis
proglottis / quake3.awk
Created March 17, 2013 06:26
Quake 3 Log parser in AWK
#!/bin/awk -f
# Formats Quake 3 logs into HTML.
function print_header()
{
print "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
print "<html><head>"
print "<title>Quake 3</title>"
print "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />"
@proglottis
proglottis / wepf_rules_2009.markdown
Last active March 9, 2017 14:19
World 8 Ball Pool Rules 2009

World 8 Ball Pool Rules 2009

http://www.wepf.org/

A. The Spirit of the Game

The Game is known as Eight-Ball Pool. It is expected that players will always play the game in the true spirit and in a sporting manner. The Referee will take whatever action is necessary to ensure that the spirit and rules of the game are observed.

C. Player in Control

@proglottis
proglottis / anagram.c
Created December 3, 2012 04:09
Anagram
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#define HASH_SIZE 100000
#define WORD_SIZE 100
struct hash_node {
char key[WORD_SIZE];
-module(life).
-export([life/2, new/2, randomize/1, step/1, print/1]).
-record(board, {width, height, cells, generation=0}).
life(Width, Height) ->
life(new(Width, Height)).
life(Board) ->
receive