Skip to content

Instantly share code, notes, and snippets.

@paigeruten
paigeruten / rit.rb
Last active December 19, 2015 18:18
play an audio file at a particular speed
#!/usr/bin/env ruby
# rit.rb - play an audio file at a particular speed
#
# usage: ruby rit.rb <speed> <path_to_audio_file>
#
# <speed> is a float which acts as a multiplier. 1.0 is normal speed, 2.0
# is double speed, 0.5 is half speed, and so on.
#
# put 0 for <speed> for a fun easter egg.
# whyspooler.rb
# mostly a translation of _why's OCaml script to Ruby
#
# polls whytheluckystiff.net for new printouts, converts to pdf, saves them into ./SPOOL, and prints them
#
# usage: `ruby whyspooler.rb http://whytheluckystiff.net`
#
# OS X install instructions:
# 1. `gem install open4`
# 2. download MacPCLtoPDF.zip from http://www.columbia.edu/~em36/pcltopdf.html
@paigeruten
paigeruten / why-daemon.rb
Created January 6, 2013 20:46
take a snapshot of whytheluckystiff.net whenever it updates
begin
require "terminal-notifier"
rescue LoadError
end
require "open-uri"
WHO = "whytheluckystiff.net"
WHAT = "http://"
WHERE = "/"
WHY = WHAT + WHO + WHERE
@paigeruten
paigeruten / java-repl.rb
Created January 30, 2011 03:42
A very simple and rough and slow REPL for Java
# A very simple and rough and slow REPL for Java, but it's better than making a
# new Java program every time you want to test something.
class JavaREPL
def initialize(filename = "JavaREPL")
@filename = filename
reset
end
def repl
loop { java_print java_eval java_read }
# Substitution with Hash (Ruby 1.9, not documented)
":(".gsub(/./, ':' => ';', '(' => ')') #=> ";)"
# The “assign first” operator
caterpillar_part ,= ["head", "body"]
caterpillar_part #=> "head"
One morning I looked out my bedroom window to see an enormous moving van parked
in front. A crew of twenty movers waited on the street for the one guy to open
the latch on the back. Once done, they immediately got to work. Desks, beds,
sofas, and chairs made their way up my sidewalk and into the front door, one by
one, one tireless mover at each end.
And on the string of deluxe handcrafted furniture flowed. It just never ended. I
lost count after 24 beds.
It was at this point that I grew suspicious. Where was mom? Why did she order
@paigeruten
paigeruten / phi.php
Created August 30, 2009 08:34
look up php function synopses from the command line
#!/usr/bin/php
<?php
// v v
// \\O//
$RED = 31;
$GREEN = 32;
$BLUE = 34;
$MAGENTA = 35;
$CYAN = 36;