Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am robie1373 on github.
  • I am robie1373 (https://keybase.io/robie1373) on keybase.
  • I have a public key whose fingerprint is 6E3D 56FD 8A1C 93EC 3D4E E3B0 5A1D FA30 83F2 BDCB

To claim this, I am signing this object:

@robie1373
robie1373 / cwplayer.html
Last active January 15, 2016 02:41
single page cw player. give it words and get back noise.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<title>CW Player</title>
<script src="./scripts/jquery-2.2.0.min.js"> </script>
<style>
/*resets*/
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
</head>
<body>
</body>
</html>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
@robie1373
robie1373 / gist:4171152
Created November 29, 2012 19:05
using srand
srand(1)
=> 42920506317323317837762064960942154151 # This is the previous value of srand
3.times { puts "-> #{a.sample}"}
-> k
-> s
-> a
srand(2)
=> 1 # This is the previous value of srand
3.times { puts "-> #{a.sample}"}
-> l
@robie1373
robie1373 / listener_experiment.rb
Created October 11, 2012 20:57
listener experiment
require 'listen'
path1 = File.join(ENV['home'], ".ruth")
path2 = File.join(ENV['home'], "foo")
hrm = Proc.new do |modified, added, removed|
p removed.inspect
end
listener = Listen.to(path2)
@robie1373
robie1373 / exerciseDrive.rb
Created October 4, 2012 20:34
Drive exerciser
#!/usr/bin/env ruby
require 'json'
require 'digest'
require 'tempfile'
if File.directory?(File.expand_path(ARGV[0]))
@base_dir = File.expand_path(ARGV[0])
else
@base_dir = ENV['HOME']
end
@robie1373
robie1373 / get_defaults.rb
Created July 31, 2012 18:24
Get all com.apple.blah defaults
#!/usr/bin/env ruby
(`defaults domains`).split(', ').each do |thing|
# p thing uncomment to watch the domains
if thing.match /com\.apple.*/
default = "\n\n#{thing}\n"
default << `defaults read #{thing}`.to_s
p default
File.open('defaults.txt', 'a+') { |f| f.write(default) }
end
end
@robie1373
robie1373 / gist:1918282
Created February 26, 2012 18:59
How to test puts in a method
describe Putter do
describe "#start" do
it "should say i put" do
output = double('output')
putter = Putter.new
output.should_receive(:puts).with('i put')
putter.start
end
end
@robie1373
robie1373 / libx264-slow.ffpreset
Created February 22, 2012 00:31
libx264-slow.ffpreset
#Put the following in /usr/local/Cellar/ffmpeg/0.10/share/ffmpeg/libx264-slow.ffpreset
coder=1
flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=umh
subq=8
me_range=16
g=250
@robie1373
robie1373 / two_loops.rb
Created January 30, 2012 22:24
So confused about scope / return
@stringy = ""
@table_header_footer = ""
outable = [['1','2','3'],['4','5','6'],['7','8','9']]
outable.last.each do |element|
@table_header_footer << element.to_s.length
end
@table_header_footer << "==\n"
outable.each do |row|