Skip to content

Instantly share code, notes, and snippets.

View kierdavis's full-sized avatar

Kier Davis kierdavis

View GitHub Profile
@kierdavis
kierdavis / gist:1034725
Created June 19, 2011 20:42
Simple Brainf*ck Single-Digit Adder
++++++++++[>++++++>+++<<-]>++...>++.[-]<[-]<,>++++++[<-------->-]++++++++++[>+>++++++>+++<<<-]>.>++...>++.[-]<[-]<[-]<,>++++++[<-------->-]<[<+>-]++++++++++[>+>++++++++>+++++++++++>++++++++++>+++>++++++<<<<<<-]>.>++++.>+.+++++.>---.<--------.>>++.<++++++++.++++++++++.>>--.<.>[-]<[-]<[-]<[-]<[-]<[-]<++++++[<++++++++>-]<.
@kierdavis
kierdavis / DCPU-16.v
Created April 19, 2012 17:42
DCPU-16 implementation in Verilog
/*
General state machine operation:
ST_FETCH - Load instruction word
ST_LOADAREF - Decode operand_a into a_type and a_value components
ST_LOADA - Load a using a_type and a_value
ST_LOADB - Decode operand_b and load b
ST_DECODE - Distribute to ST_opcode
ST_opcode - Modify b, using a
ST_STORE - Store b into a's location using a_type and a_value
*/
@kierdavis
kierdavis / me.squirtle
Created July 10, 2012 22:03
Squirtle syntax example
name <http://kierdavis.com/data/me> as me
name <http://kierdavis.com/data/projects> as projects
me { a foaf:Person
foaf:name "Kier Davis"
foaf:nick "kier", "kierdavis"
foaf:homepage <http://kierdavis.com/>
foaf:age 15
foaf:birthday "02-15"
foaf:mbox <mailto:kierdavis@gmail.com>
@kierdavis
kierdavis / me-with-templates.squirtle
Created July 10, 2012 22:17
Prototype of template
template OnlineAccount(?label, ?accountName, ?accountServiceHomepage, ?accountProfilePage) is {
a foaf:OnlineAccount
rdfs:label ?label
foaf:accountName ?accountName
foaf:accountServiceHomepage ?accountServiceHomepage
foaf:isPrimaryTopicOf ?accountProfilePage
}
me { a foaf:Person
foaf:account OnlineAccount("My del.icio.us account", "kierdavis",
@kierdavis
kierdavis / kier-and-jacobs-game.txt
Created July 20, 2012 23:04
Sketchpad for some Roguelike game
ASCII grid based (but not necessarily restricted to the command-line)
Steampunk/industrial theme
Base library: SDL (https://github.com/banthar/Go-SDL)
Available colours:
These are the 16 standard colours available to the command line (termbox, ANSI escapes etc).
"Proper" (but more complex) libraries like SDL can use more colours but we want to restrict it
to these to keep it simple and retro.
@kierdavis
kierdavis / roguelike.go
Created July 20, 2012 23:08
Paste of my original Roguelike code
package main
import (
"fmt"
"github.com/kierdavis/goutil"
"github.com/nsf/termbox-go"
"math/rand"
"os"
"time"
)
@kierdavis
kierdavis / nq2nt.sh
Created July 30, 2012 00:04
Sed command to remove context URIs from n-quads to make it n-triples
sed 's|<[^>]*> \.$|.|' input.nq > output.nt
@kierdavis
kierdavis / error.log
Created August 18, 2012 22:53
An hour of log
[Sat Aug 18 22:02:17 2012] [error] [client 178.167.254.196] File does not exist: /var/www/favicon.ico
[Sat Aug 18 22:32:24 2012] [error] [client 66.249.66.228] File does not exist: /var/www/robots.txt
[Sat Aug 18 22:32:24 2012] [error] [client 66.249.66.228] PHP Warning: Division by zero in /home/git/repo/lib/plugins/HousePriceRise-Fall.php on line 49
[Sat Aug 18 22:32:24 2012] [error] [client 66.249.66.228] PHP Warning: Division by zero in /home/git/repo/lib/plugins/HousePriceRise-Fall.php on line 49
[Sat Aug 18 22:39:33 2012] [error] [client 78.86.253.138] PHP Notice: Undefined index: countyelectoral in /home/git/repo/lib/util.php on line 24, referer: http://postcodewars.co.uk/
[Sat Aug 18 22:39:33 2012] [error] [client 78.86.253.138] PHP Notice: Undefined index: countyelectoral in /home/git/repo/lib/util.php on line 24, referer: http://postcodewars.co.uk/
[Sat Aug 18 22:39:34 2012] [error] [client 78.86.253.138] PHP Notice: Undefined index: countyelectoral in /home/git/repo/lib/util.php on line 24, re
@kierdavis
kierdavis / mykey.sh
Created September 11, 2012 20:46
How to get your own GPG key id (i.e. the first key in the secret keyring)
#!/bin/sh
gpg --list-secret-keys | sed -n "3s|^.*/\([A-F0-9]\{8\}\).*$|\1|p"
@kierdavis
kierdavis / error.go
Created October 2, 2012 21:06
Sample code for "use of closed network connection" error
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const TheURL = "http://repo.bukkit.org/service/local/repositories/legacy/content/org/bukkit/bukkit/1.9-pre5-R1-SNAPSHOT/bukkit-1.9-pre5-R1-20111122.004050-46.jar"