Skip to content

Instantly share code, notes, and snippets.

attempting to learn how to better learn

Fogus fogus

attempting to learn how to better learn
View GitHub Profile
View twicl
#!/usr/bin/env ruby
# -*- ruby -*-
# twitter command line client
# That's What I Call Lame
# 09nov2008 +chris+
require 'json'
require 'open-uri'
View gist:24606
/* merge sort in js */
function sort(a) {
var mid = a.length>>1;
if (mid==0) return a;
var less = sort(a.slice(0,mid));
var more = sort(a.slice(mid));
var merged = [];
do {
if (more[0] < less[0]) { var t=less; less=more; more=t; }
fogus / gist:42087
Created Dec 31, 2008
prolog in python
View gist:42087
This modules implements a rudimentary prolog engine. Its
purpose is to illustrate the use of continuations to program
a search engine with backtracking and cut.
def bind(var,term,alist):
"""bind var to term in environment alist. return the updated
environment. we make a copy so that we don't have to undo on
backtracking (in essence: we always trail)."""
View zombies.lisp
- One monster type: Zombies!
- Teleporters
- Artificial Unintelligence technology for realistic zombie horde
- Full in-game documentation
- Trees
- Gold (because really, what's a roguelike without gold?)
- Each game is guaranteed to end in death by zombie
'''Digital image steganography based on the Python Imaging Library (PIL)
Any message can be hidden, provided the image is large enough. The message is
packed into the least significant bits of the pixel colour bands. A 4 byte
header (packed in the same way) carries the message payload length.
import Image
import itertools as its
def n_at_a_time(items, n, fillvalue):
# to post `cat file |`
# or ` < file`
# to get ` 1234`
log ()
echo "$@" >&2
// Totally stolen from
public @interface Multi {
public String value();
View gist:51091
// Example for
public class CarTest {
interface CarElement {}
class Wheel implements CarElement {
private String name;
Wheel(String name) { = name;
View gist:51092
// Example for
public class AsteroidTest {
class Asteroid {}
class Spaceship {}
public void collideOO(Object X, Object Y) {
View flatten.clj
;; a bit faster flatten
(defn flatten [x]
(if (seq? x)
(lazy-seq (apply #(lazy-cat %&) (map flatten x)))
(list x)))
You can’t perform that action at this time.