Skip to content

Instantly share code, notes, and snippets.

View wmeister-old's full-sized avatar

William Meister wmeister-old

View GitHub Profile
(defun multiple-of (x y)
(if (= 0 (rem x y)) t))
(defun check-number (x)
(if (multiple-of x 3) (setf answer (+ answer x))
(if (multiple-of x 5) (setf answer (+ answer x)))))
(setf answer 0)
(loop for i from 1 to 999 do
; Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
; 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
; Find the sum of all the even-valued terms in the sequence which do not exceed four million.
(defun calc-next (a b) (+ a b))
(defun multiple-of (x y) (= 0 (rem x y)))
import telnetlib
HOST = "nethack.alt.org"
tn = telnetlib.Telnet(HOST)
print tn.read_all()
def table_for(models, header, &block)
tbody = models.map{|m| ['<tr>', block.call(m).map{|d| "<td>#{d}</td>"}, '</tr>'] }.flatten.join
'<table><thead><tr>' + header.map{|h| "<td>#{h.is_a?(Symbol) ? h.to_s.capitalize : h}</td>"}.join + "</tr><tbody>#{tbody}</tbody></table>"
end
importClass Packages.org.lwjgl.LWJGLException
importClass Packages.org.lwjgl.opengl.Display
importClass Packages.org.lwjgl.opengl.DisplayMode
importClass java.lang.System
setup = ->
try
Display.setDisplayMode new DisplayMode(800, 600)
Display.create()
catch error
#!/bin/sh
BASE_DIR=/home/billy/src/coffee/game
LIB_DIR=$BASE_DIR/lib
SRC_DIR=$BASE_DIR/src
RHINO_JAR=/usr/share/java/js.jar
CLASS_PATH=$RHINO_JAR:$LIB_DIR/lwjgl.jar
MAIN_JAVA_CLASS=org.mozilla.javascript.tools.shell.Main
MAIN_JS=$LIB_DIR/main.js
JAVA_ARGS="-cp $CLASS_PATH -Djava.library.path=$LIB_DIR $MAIN_JAVA_CLASS $MAIN_JS"
MAIN_COFFEE=$SRC_DIR/main.coffee
@wmeister-old
wmeister-old / gist:1201941
Created September 7, 2011 22:10
homebrew install script modified for ppc
#!/usr/bin/ruby
# This script installs to /usr/local only. To install elsewhere you can just
# untar https://github.com/sceaga/homebrew/tarball/powerpc anywhere you like.
module Tty extend self
def blue; bold 34; end
def white; bold 39; end
def red; underline 31; end
def reset; escape 0; end
def bold n; escape "1;#{n}" end
@wmeister-old
wmeister-old / microlite20-chargen.pl
Created October 12, 2011 01:53
Microlite20 Character Generator
#!/usr/bin/perl -wT
use strict;
use YAML;
sub R($) { my ($m)=@_; (int rand ($m+1))+1 }
sub R0($) { my ($m)=@_; (R $m)-1; }
sub D6() { R 6; }
sub L { my ($a,$b)=@_; ($a < $b) ? $a : $b; }
sub STAT() { my ($a,$b,$c,$d)=(D6,D6,D6,D6); $a+$b+$c+$d - L(L(L($a,$b),$c),$d); }
sub RAE { my @a=@_; $a[R0 $#a]; }
billy@mewtwo:~/src/perl$ ./microlite20-char_gen.pl
---
Class: Fighter
Race: Elf
Stats:
DEX: 13
MIND: 11
STR: 19
$ pacman -S scala ruby