Skip to content

Instantly share code, notes, and snippets.

View titanous's full-sized avatar

Jonathan Rudenberg titanous

View GitHub Profile
@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
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

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

@titanous
titanous / twilight.py
Created June 22, 2010 02:57
Twilight pygments style
# -*- coding: utf-8 -*-
"""
pygments.styles.twilight
~~~~~~~~~~~~~~~~~~~~~~~~
A clone of the Twilight style from TextMate.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
@titanous
titanous / gist:431490
Created June 9, 2010 13:46
Fun with blocks!
class FunWithBlocks
attr_accessor :block
def test_helper
puts 'I am a really useful helper'
end
def run_block
instance_exec('arg!', &@block)
def mask n;n[0,6]+'*'*(n.size-10)+n[-4,4]end
@titanous
titanous / 1-route_example.rb
Created May 15, 2010 02:05
Potential router DSL for Mailman
subject(/Ticket/).to(':[email protected]') do
User.find_by_identifier(params[:user]).add_ticket(message)
end
@titanous
titanous / twail.rb
Created March 8, 2010 21:14
Twitterstream tail -f and live search
#!/usr/bin/env ruby
# twail.rb
# Twitter stream tail
# Copyright 2010 Jonathan Rudenberg
# Licensed under the MIT License
#
# Prerequisites: gem install json twitter-stream
require 'optparse'
@titanous
titanous / twilight.vim
Created February 27, 2010 21:34
Twilight vim color scheme
" Vim color scheme
"
" Name: twilight.vim
" Maintainer: Jonathan Rudenberg <[email protected]>
" License: MIT
"
" A GUI only vim theme based on the Twilight TextMate theme.
" Original structure taken from railscasts.vim [1].
" Some parts of this theme were borrowed from the well-documented Lucius theme [2].
"
@titanous
titanous / twilio-connect.rb
Created January 29, 2010 20:19
Twilio calls from the terminal
#!/usr/bin/env ruby
require 'twiliolib'
# Twilio REST API version
API_VERSION = '2008-08-01'
# Twilio AccountSid and AuthToken
ACCOUNT_SID = 'AC79a4b3609b05ee750cf0844e330cd11b' # FAKE
ACCOUNT_TOKEN = '1d1b9c34c3a40f5c6ba501775ba1f86b' # FAKE