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
ffmpeg -f image2 -r 24 -i ./frames/code_swarm-%05d.png -sameq out.mov -pass 2 |
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/bash | |
# "@Pad" | |
# An easy commandline time-stamped log/notepad | |
# Derived from https://web.archive.org/web/20120118122636/http://blog.rubybestpractices.com/posts/jamesbritt/James_will_be_right_back_after_these_interruptions.html | |
# | |
# Usage: | |
# @ something or other - log the timestamped message "something or other" | |
# @ . - open the @ scratchpad with a new timestamp and | |
# no message with your default editor |
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
>> ("0".."10").to_a | |
=> ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] | |
>> ("1".."10").to_a | |
=> ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] | |
>> ("2".."10").to_a | |
=> [] | |
>> ("2".."9").to_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
#!/usr/bin/env ruby | |
# twitdiff.rb | |
# Quickie script for unfollowing users who aren't following you, | |
# or following users who are following you...or both | |
# Requires Grackle (http://github.com/hayesdavis/grackle/tree/master): | |
# sudo gem sources -a http://gems.github.com | |
# sudo gem install hayesdavis-grackle |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> | |
<!-- Online here: http://ejohn.org/files/bugs/isObjectLiteral/ --> | |
<title>isObjectLiteral</title> | |
<style> | |
li { background: green; } li.FAIL { background: red; } | |
iframe { display: none; } | |
</style> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> | |
<!-- Online here: http://ejohn.org/files/bugs/isObjectLiteral/ --> | |
<title>isObjectLiteral</title> | |
<style> | |
li { background: green; } li.FAIL { background: red; } | |
iframe { display: none; } | |
</style> |
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
require 'open-uri' ; require 'rss/2.0' ; require 'cgi'; require 'openssl' | |
delicious_user='mattb' | |
instapaper_user='me@example.com' | |
instapaper_password='whatever' | |
$VERBOSE=nil | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE # lame, but effective; can't verify properly w/ open-uri in Ruby 1.8 | |
RSS::Parser.parse(open("http://feeds.delicious.com/v2/rss/network/#{delicious_user}?count=15").read).items.each { |item| open("https://www.instapaper.com/api/add?username=#{instapaper_user}&password=#{instapaper_password}&url=#{CGI.escape(item.link)}&auto-title=1").read } |
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
# mysql-style output for an array of ActiveRecord objects | |
# | |
# Usage: | |
# report(records) # displays report with all fields | |
# report(records, :field1, :field2, ...) # displays report with given fields | |
# | |
# Example: | |
# >> report(records, :id, :amount, :created_at) | |
# +------+-----------+--------------------------------+ | |
# | id | amount | created_at | |
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
class Crypto | |
# encrypts data with the given key. returns a binary data with the | |
# unhashed random iv in the first 16 bytes | |
def self.encrypt(data, key) | |
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc") | |
cipher.encrypt | |
cipher.key = key = Digest::SHA256.digest(key) | |
random_iv = cipher.random_iv | |
cipher.iv = Digest::SHA256.digest(random_iv + key)[0..15] | |
encrypted = cipher.update(data) |
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
# base for "smart" constant classes | |
class OptionSet | |
def self.[](id) | |
if id.is_a?(Fixnum) | |
return local_constants.find {|c| id == const_get(c)} | |
else | |
return const_get(id.upcase) | |
end | |
end | |