Skip to content

Instantly share code, notes, and snippets.

View technomancy's full-sized avatar

Phil Hagelberg technomancy

View GitHub Profile
root@arm:~/prometheus# erl -pa deps/exmpp/ebin -pa ebin
Erlang R15B01 (erts-5.9.1) [source] [async-threads:0] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G)
1> application:start(crypto), application:start(exmpp), application:start(prometheus).
{error,{shutdown,{prometheus_app,start,[normal,[]]}}}
=INFO REPORT==== 21-Feb-2014::23:14:30 ===
application: prometheus
exited: {shutdown,{prometheus_app,start,[normal,[]]}}
phil@enigma ~/music $ racket
Welcome to Racket v5.2.1.
> read-line
#<procedure:read-line>
> pp
reference to undefined identifier: pp
=== context ===
/usr/share/racket/collects/racket/private/misc.rkt:87:7
@technomancy
technomancy / rocket.rkt
Created October 22, 2014 16:49
Rocket landing
(require 2htdp/universe )
(require htdp/image)
(define sun (circle 99 "solid" "yellow"))
(define p1 (circle 50 "solid" "green"))
(define p2 (circle 49 "solid" "red"))
(define p3 (circle 15 "solid" "blue"))
(define (too-big? xy)
@technomancy
technomancy / gist:99d0f9b75b574115aa39
Created November 28, 2014 05:56
d2x-rebirth segfault on boot
Type d2x-rebirth -help' for a list of command-line options.
PHYSFS: Listing contents of Search Path.
PHYSFS: [/home/phil/.d2x-rebirth/] is in the Search Path.
PHYSFS: [/home/phil/.d2x-rebirth/data] is in the Search Path.
PHYSFS: * We've got [ALIEN1.PIG].
PHYSFS: * We've got [ALIEN2.PIG].
PHYSFS: * We've got [DESCENT.CFG].
PHYSFS: * We've got [DESCENT2.EXE].
PHYSFS: * We've got [DESCENT2.HAM].
-- web.lua
local xavante = require "xavante"
port = ...
local function pp(t, level)
local level = level or ""
for k,v in pairs(t) do
print(level .. k .. ": " .. tostring(v))
if(type(v) == "table") then

Ruby Style

Non-negotiable

  • Indent with two spaces. This is very nearly universally accepted among Rubyists.

  • Never rescue Exception. (See http://technomancy.us/114 for details.) Don't rescue StandardError (without conditionally re-raising it) unless you have a really good reason. Doing this

(defn take-thing [thing]
(dosync
(if (room-contains? @*current-room* thing)
(do (commute *inventory* conj (keyword thing))
(alter (:items @*current-room*)
(partial remove #(= % (keyword thing))))
(str "You picked up the " thing "."))
(str "There isn't any " thing " here."))))
@technomancy
technomancy / chrono.clj
Created February 16, 2009 06:06
Tests for a library that doesn't exist yet. Chrono: date handling in Clojure
(ns clojure.contrib.test-contrib.chrono
(:use clojure.contrib.test-is
clojure.contrib.chrono))
(def christmas (date 2007 12 25, 3 00 02))
(def new-years (date 2008 1 1))
(def day-one (date 2008 11 21, 11 21 48))
(deftest test-date-creation
;; TODO: Not sure about the interface here. We may not be able to
;;; clojure-test-mode --- Minor mode for Clojure tests
;; Copyright (C) 2009 Phil Hagelberg
;; Author: Phil Hagelberg <technomancy@gmail.com>
;; URL: http://emacswiki.org/cgi-bin/wiki/ClojureTestMode
;; Version: 0.1
;; Keywords: languages, lisp
;; This file is not part of GNU Emacs.
;;; clojure-test-mode --- Minor mode for Clojure tests
;; Copyright (C) 2009 Phil Hagelberg
;; Author: Phil Hagelberg <technomancy@gmail.com>
;; URL: http://emacswiki.org/cgi-bin/wiki/ClojureTestMode
;; Version: 0.1
;; Keywords: languages, lisp
;; This file is not part of GNU Emacs.