Skip to content

Instantly share code, notes, and snippets.

View titanous's full-sized avatar

Jonathan Rudenberg titanous

View GitHub Profile

code_swarm

Make a .mailmap for your project from the output of git log --pretty="format:%aN <%aE>" | sort -u

Then: code_swarm

These commands could probably be combined into one: ffmpeg -f image2 -r 24 -i ./code_swarm_frames/%5d.png -sameq ./out.mov -pass 2

Process exited at Wed Dec 15 21:52:55 +0000 2010.
Signal: SIGABRT
Backtrace:
Thread 1 (Thread 0x7f60a75d6720 (LWP 24709)):
#0 0x00007f60a6573a75 in raise () from /lib/libc.so.6
No symbol table info available.
#1 0x00007f60a65775c0 in abort () from /lib/libc.so.6
No symbol table info available.
#2 0x00000000004a3d29 in rb_bug (fmt=0x4bfbe0 "Segmentation fault")
at error.c:213
@titanous
titanous / gist:761359
Created December 31, 2010 21:55
Yubikey authentication example
token = ::Yubikey::OTP.new(otp, @secret_key)
if ((token.insert_counter == @last_insert_counter && token.timestamp > @last_timestamp) || (token.insert_counter > @last_insert_counter)) && token.session_counter > @last_session_counter && token.random_number != @last_random_number
@last_insert_counter = token.insert_counter
@last_session_counter = token.session_counter
@last_timestamp = token.timestamp
@last_random_number = token.random_number
save
return true
end
@titanous
titanous / gist:762761
Created January 2, 2011 19:45
OC Transpo GPS API access in Ruby
require 'open-uri'
require 'nokogiri'
require 'active_support/time'
module OCTranspo
class GPSData
API_URL = 'http://octranspo.opendataottawa.ca'
API_KEY = 'YOUR API KEY HERE'
require 'active_merchant'
require 'test/unit'
class CreditCardThing < Struct.new(:number, :month, :year, :type)
include ActiveMerchant::Billing::CreditCardMethods
def valid_number?
self.class.valid_number?(number)
end
require 'heroku'
heroku = Heroku::Client.new('willem@vanbergen.org', 'supersecret')
heroku.add_config_vars 'vanbergen.org', 'LAST_BUMP' => Time.now.strftime('%F')
133a134,136
> url = re.compile("URL: (\S+)").search(msg)
> if url is not None:
> subprocess.Popen(['open', url.group(1)])
@titanous
titanous / twitter_spy.rb
Created March 4, 2011 20:17
Live tweets in Campfire
#!/usr/bin/env ruby
$KCODE = 'u' # for twitter-text
# gem install httparty json twitter-stream twitter-text
#
# set these environment variables:
# TWITTER_USER = twitter username
# TWITTER_PASS = twitter password
# TWITTER_KEYWORDS = the keywords to track, comma separated (see http://dev.twitter.com/pages/streaming_api_methods#track)
# CAMPFIRE_SUBDOMAIN = the subdomain of your campfire account (ex. flames if your domain is flames.campfirenow.com)
@titanous
titanous / long_url.rb
Created March 7, 2011 04:17
Long URL finder
# Long URL finder
# Copyright 2011 Jonathan Rudenberg
# Licensed under the MIT License
#
# Usage:
# LongURL.find('http://t.co/tssMTwK') #=> "http://fuckyeahnouns.com/Bacon"
require 'net/http'
require 'uri'
require 'json'
require 'net/http'
require 'uri'
module Bayeux
ENDPOINT = URI.parse('http://localhost:3000/faye')
def self.publish(channel, data)
message = {'channel' => channel, 'data' => data.to_hash}
Net::HTTP.post_form(ENDPOINT, :message => JSON.unparse(message))