Skip to content

Instantly share code, notes, and snippets.

View audy's full-sized avatar
🔬

Austin Richardson audy

🔬
View GitHub Profile
#!/usr/bin/env ruby
class Array
def random; self[rand(self.length)]; end
end
# extended by actual player classes
class Player
attr_reader :name
def initialize(name)
# This is a method I use when working with slow ruby scripts that
# operate on huge datasets.
#
# It caches the return value of a block of extremely slow code
# in a file so that subsequent runs are fast.
#
# It's indispensable to me when doing edit-debug-edit-debug-edit
# cycles on giant datasets.
# loads ruby object from a cache file or (if cache file doesn't exist) runs
@renatoalbano
renatoalbano / sinatra-twitter-oauth-client.rb
Created November 5, 2009 22:36
sinatra twitter client with oauth
# sinatra twitter client with oauth
require 'rubygems'
require 'sinatra'
# use http://github.com/moomerman/twitter_oauth gem
# gem sources -a http://gems.github.com
# gem install moomerman-twitter_oauth
require 'twitter_oauth'
@audy
audy / dataset.fa
Created October 29, 2010 00:24
putting this here in case my house catches on fire.
>sp|P16250|HIS4_STRCO Phosphoribosyl isomerase A OS=Streptomyces coelicolor GN=priA PE=1 SV=1
MSKLELLPAVDVRDGQAVRLVHGESGTETSYGSPLEAALAWQRSGAEWLHLVDLDAAFGT
GDNRALIAEVAQAMDIKVELSGGIRDDDTLAAALATGCTRVNLGTAALETPEWVAKVIAE
HGDKIAVGLDVRGTTLRGRGWTRDGGDLYETLDRLNKEGCARYVVTDIAKDGTLQGPNLE
LLKNVCAATDRPVVASGGVSSLDDLRAIAGLVPAGVEGAIVGKALYAKAFTLEEALEATS
>sp|Q9WYG7|PYRF_THEMA Orotidine 5'-phosphate decarboxylase OS=Thermotoga maritima GN=pyrF PE=1 SV=1
MTPVLSLDMEDPIRFIDENGSFEVVKVGHNLAIHGKKIFDELAKRNLKIILDLKFCDIPS
TVERSIKSWDHPAIIGFTVHSCAGYESVERALSATDKHVFVVVKLTSMEGSLEDYMDRIE
KLNKLGCDFVLPGPWAKALREKIKGKILVPGIRMEVKADDQKDVVTLEEMKGIANFAVLG
REIYLSENPREKIKRIKEMRL
@jweir
jweir / protovis_to_link.js
Created November 19, 2010 19:23
How to save SVG data to a file from a web browser
@padde
padde / svg_builder.rb
Created November 2, 2011 12:20
Make SVG with builder
# encoding: utf-8
require 'rubygems'
require 'builder'
svg_doctype = [
:DOCTYPE,
:svg,
:PUBLIC,
"-//W3C//DTD SVG 1.1//EN",
@rogerallen
rogerallen / us_state_abbrev.py
Last active April 19, 2024 14:04
A Python Dictionary to translate US States to Two letter codes
# United States of America Python Dictionary to translate States,
# Districts & Territories to Two-Letter codes and vice versa.
#
# Canonical URL: https://gist.github.com/rogerallen/1583593
#
# Dedicated to the public domain. To the extent possible under law,
# Roger Allen has waived all copyright and related or neighboring
# rights to this code. Data originally from Wikipedia at the url:
# https://en.wikipedia.org/wiki/ISO_3166-2:US
#
@hrldcpr
hrldcpr / tree.md
Last active May 1, 2024 00:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@jassinm
jassinm / gist:3200136
Created July 29, 2012 16:44
scipy , numpy , matplotlib on clean install mac osx 10.8 mountain lion
brew install python
easy_install pip
#install scipy use temp branch
pip install git+https://github.com/minrk/scipy-1.git@accelerate
#ft2build.h not found ==>
pip install git+git://github.com/matplotlib/matplotlib.git
@amueller
amueller / digits_video.py
Created October 5, 2012 19:13
Visualization of iris and digits datasets via random projections
# (c) 2012 Andreas Mueller amueller@ais.uni-bonn.de
# License: BSD 2-Clause
#
# See my blog for details: http://peekaboo-vision.blogspot.com
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation