Skip to content

Instantly share code, notes, and snippets.

@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
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
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
@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
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;
# 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"
Javascript Obfuscation, Minification and why it doesn't really matter.
I'm working on placing some geocaches[http://www.geocaching.com] and they must be 0.1 miles away from other geocaches. Being a programmer I thought, well, let's just write a bookmarklet to augment the geocaching website with a radius around the caches displayed on the map. So I googled for chunk of code that would do this because I'm lazy. The first tool was http://www.freemaptools.com/radius-around-point.htm and its UI was clunky but the output looked good enough to me. So I dig into the source... and *gasp* what is this?
10111010001000010111010000111101010101101101110100010101010100100001...
http://www.freemaptools.com/script/radius-around-point.js
At that point, I could've just looked for the next site but I have a few tricks up my sleeve since I've had to dig into ridiculous javascript for serveral of my jobs... The first trick is just use chrome developer tools, it'll probably get you 90% of the way there... and look, it does!
mysql> use test;
Database changed
mysql> create table test_innodb engine=innodb;
ERROR 1113 (42000): A table must have at least 1 column
mysql> create table test_innodb (id int not null primary key) engine=innodb;
Query OK, 0 rows affected, 2 warnings (0.09 sec)
mysql> show create table test_innodb;
+-------------+-------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
require 'test/unit'
module M
def f
CONSTANT + 1
end
end
class C
CONSTANT = 1
@wesmaldonado
wesmaldonado / gist:5602312
Created May 17, 2013 22:08
Dedicated to the pointless argument @bionicpill and @TroyJMorris had about the back button.
Back Button Boy: Do not try and hit the back button. That's impossible. Instead... only try to realize the truth.
Neo: What truth?
Back Button Boy: There is no back button.
Neo: There is no back button?
Back Button Boy: Then you'll see, that it is not the app that goes back, it is only yourself.