Skip to content

Instantly share code, notes, and snippets.

# http://skitch.com/wesmaldonado/dw6iy/git-treezy
[alias]
treezy = log --graph --full-history --all --color \
--pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"
def goertzel(block_size,samples)
freq = 500 # from demorse.h AUDIO_FREQ
s = 0.0
s_prev1 = 0.0
s_prev2 = 0.0;
coeff = 2.0 * Math.cos(2.0 * Math::PI* freq);
samples.map do |sv|
s = sv + (coeff * s_prev1) - s_prev2;
@wesmaldonado
wesmaldonado / gist:782499
Created January 17, 2011 04:39
What happened to my Sunday evening, a programming story about geocaching (sorta.)
# My sister and brother inlaw got into geocaching
# after I showed them the android app for it... anyhow I was in Olympia for my m
# oms birthday and I showed them that puzzle cache (http://coord.info/GC1JD07)...
# and when my manual math ended up being off by one in my "B" calculation (21-19
# != 3) I uh, got carried away once I got back to seattle. :(
# I only got this carried away though 'cause I'm trying to build a presentation
# on parsers for a conference and I thought this was a reasonable mini language wh
# ere I could show the "quick" hour long solution I came up with versus the actual
# parser one I'll present. I also could've done this faster by just coding this
puts Time.now.strftime("%Y/%m/%d %H:%M:%S")
enable_maintenance_page
puts Time.now.strftime("%Y/%m/%d %H:%M:%S")
bundle_install
puts Time.now.strftime("%Y/%m/%d %H:%M:%S")
restart
puts Time.now.strftime("%Y/%m/%d %H:%M:%S")
sphinx_stop
puts Time.now.strftime("%Y/%m/%d %H:%M:%S")
link_sphinx_directory
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable , :registerable, :recoverable, :rememberable, :trackable, :validatable
devise :omniauthable#, :omniauth_providers => [:facebook]
devise :encryptable, :encryptor => :custom_encryptor
# Devise: Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
@wesmaldonado
wesmaldonado / gist:664486
Created November 5, 2010 17:25
OS X Ramdisk Creation
hdid -nomount ram://100000
sudo /sbin/newfs_hfs -v mysql_ram_disk /dev/disk1
diskutil mount /dev/disk1
67 before_filter :ping
68 before_filter :reset_current_request
69 before_filter :initialize_current_page
70 before_filter :rpc_tracking_prefix
71 before_filter :update_content_cache
72 before_filter :update_config
73 before_filter :initialize_site
74 before_filter :initialize_ad_system
75 before_filter :update_content_cache
76 before_filter :initialize_rpc
# Shows the difference in doing crazy stuff like extending an instance on a say... busy loop or lots of requests.
#
# [16:38][wmaldonado@wmaldonado0:]$ ruby test.local.extend.rb
# user system total real
# extend instance 23.150000 0.430000 23.580000 ( 23.777088)
# create a class 2.390000 0.810000 3.200000 ( 3.209350)
#
require 'benchmark'
asdf
asdf
asdf
asdf
asdf