Skip to content

Instantly share code, notes, and snippets.

/*
cter.c
Elmore wins prize for most hacky, unsafe, ugly semi-implementation of a C
interpreter. Took an hour to write, took almost as long to do a full run of
the stress test. Compared to its trim 202 megs of actual memory used after
21,840 printf()s ran (each from its own separate .so), it seems obscene that
the cost in virtual memory was in excess of 40 gigs (at which point Linux
became angry with me and refused to allow my little program to continue).
cdgit() {
pushd .
while [ ! -d .git ]; do
cd ..
if [ $(pwd) = '/' ]; then
echo 'Not in a git repo.' >&1
popd
return
fi
done
Experiments in revision control: Curry recipe.
My personal recipe for Japanese curry, which has mutated over the years and is
now open-source thanks to github, hot damn. Some of the ingredients are not
very Japanese, but curry came to Japan from England which got it from India to
begin with, so whatever.
1.5 - 2 lbs. of meat, prefer thin-sliced beef (komagire), pork works, too.
Thin-sliced stuff is always best, but in a pinch stewing beef works. Bacon
works surprisingly well. Chicken will work, technically, but if you must,
/*
Summary paragraph for this big comment block:
This is a test for only compiling the text segment of a program, manually
"linking" (by which I mean just generating the file with addresses from the
host program) so that no data section is needed. I think this is a more
correct approach, as we only need the compiler to compile code; data
allocation, symbol resolution, etc., can/should be done by Roboto proper.
Details:
This is, I believe, the final proof-of-concept needed for the Roboto
# Description: FVWM, a highly configurable window manager
# URL: http://fvwm.org/
# Maintainer: Pete Elmore, pete dot elmore at gmail dot com
# Depends on: x11
name=fvwm
version=2.5.26
release=1
source=(ftp://ftp.fvwm.org/pub/fvwm/version-2/fvwm-$version.tar.bz2)
#!/usr/bin/env ruby
require 'socket'
localhost = Socket.gethostbyname(Socket.gethostname).first
npackets = ARGV[0] ? ARGV[0].to_i : 1_000
def top_n(name, data)
data.map { |h,stats|
[h, stats[name]]
; The SKI library from Roboto. With minor tweaks, it should run in most
; flavors of Scheme, I suspect. Some definitions (the hard ones!) taken from
; the Unlambda page (http://www.madore.org/~david/programs/unlambda/).
(= pkgname 'SKI)
; Prelude:
(= λ lambda) ; A more classical feel.
; The two primitives:
(def S x (λ y (λ z ((x z) (y z)))))
(frdef gcd ()
; gcd's identity:
() 0
((int? a)) (abs a)
; Make sure that they're sorted ascending
(((curry both int? (curry ! <=)) *l)) (apply gcd (sort l))
; Trivial case:
(a 0) (abs a) ; As making it here means a is negative.
mean = scores.inject(&:+) / scores.size
ssq = scores.inject(0) { |a,i| a + (i - mean) ** 2 }
min = scores[0] - Math.sqrt(ssq/scores.size) * 2
scores.delete_if { |score| score < min }
# THIS SHOULD NOT BE
require 'readline'
# For whatever reason, loading libreadline.so *without* loading Ruby's
# readline first makes FFI die? Seriously, comment out the above require and
# watch it fail.
require 'rubygems'
require 'ffi'
module RL