This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import telnetlib | |
HOST = "nethack.alt.org" | |
tn = telnetlib.Telnet(HOST) | |
print tn.read_all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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]; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
billy@mewtwo:~/src/perl$ ./microlite20-char_gen.pl | |
--- | |
Class: Fighter | |
Race: Elf | |
Stats: | |
DEX: 13 | |
MIND: 11 | |
STR: 19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pacman -S scala ruby |
OlderNewer