Skip to content

Instantly share code, notes, and snippets.

"""
# Usage
This plugin normalizes column names in any given sheet, so that the names are:
- Composed only of lowercase letters, numbers, and underscores.
- Valid Python identifiers. This is mostly handled by the rule above, but also
prohibits names beginning with a digit; that is handled by prefixing those
names with an underscore.

Keybase proof

I hereby claim:

  • I am mattfawcett on github.
  • I am mattfawcett (https://keybase.io/mattfawcett) on keybase.
  • I have a public key whose fingerprint is C34F 6C8D 0CEF 335F 6E7F D967 7C40 DF27 E8CF 0394

To claim this, I am signing this object:

[ pid=6271 thr=70080591090100 file=utils.rb:176 time=2011-10-04 04:32:38.589 ]: *** Exception ThreadError in application (thread 0x7f79d179a368 tried to join itself) (process 6271, thread #<Thread:0x7f79d179a368>):
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-1.3.3/lib/rack/lock.rb:14:in `lock'
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-1.3.3/lib/rack/lock.rb:14:in `call'
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:132:in `forward'
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:243:in `fetch'
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:181:in `lookup'
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:65:in `call!'
from /u/apps/vlphp/shared/ruby/bundle/ruby/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:50:in `call'
from /u/a
<html>
<head>
<style>
.current {color: green;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#things li').click(function(){
sudo osascript -e "set Volume 10"
say -v Whisper "I can see you"
@mattfawcett
mattfawcett / tile_info.rb
Created March 2, 2011 14:10
For a given latitude, longitude and zoom level return the Google maps tile reference for that location - as documented at http://code.google.com/apis/maps/documentation/javascript/v2/overlays.html#Projections
def tile_info(lat, lon, zoom)
rad_lat = lat / 180 * Math::PI
rad_lon = lon / 180 * Math::PI
merc_x = rad_lon
merc_y = Math.log( Math.tan(rad_lat) + 1/ Math.cos(rad_lat) )
cart_x = merc_x + Math::PI
cart_y = Math::PI - merc_y
@mattfawcett
mattfawcett / count.rb
Created January 10, 2011 15:15
Count the hours
#!/usr/bin/env ruby -wKU
# Textmate command
# Given a number in square brackets, add up all these numbers and give us the total.
# Used to add up my time extimation documents
# example.txt
# Go this [1.5]
# Do that [2]
require "rubygems"
require "ai4r"
net = Ai4r::NeuralNetwork::Backpropagation.new([3, 2])
1000.times do
net.train([1,3,5], [1,0])
net.train([1,3,4], [1,0])
find . -name '*.rb' | xargs egrep -lRZ '\.make' | xargs -0 sed -i -e '/make!/!s/\.make/\.make_unsaved/g' | grep make_unsaved
find . -name '*.rb' | xargs egrep -lRZ '\.make' | xargs -0 sed -i -e 's/\.make!/\.make/g' | grep make