Skip to content

Instantly share code, notes, and snippets.

View seabre's full-sized avatar

Sean Brewer seabre

  • CrowdFiber
  • Chattanooga, TN
View GitHub Profile
@seabre
seabre / devise_login_rails_console.rb
Created June 1, 2012 20:51
Devise Login Through Rails Console
ApplicationController.allow_forgery_protection = false
app.post('/whatever_my_user_model_is/sign_in', {"whatever_my_user_model_is"=>{"email"=>"[email protected]", "password"=>"users_password"}})
@seabre
seabre / sitemap_all_urls.py
Created April 27, 2012 16:51
Get All URLs From Sitemap
import xml.dom.minidom
dom = xml.dom.minidom.parse("sitemap.xml")
loc = dom.getElementsByTagName('loc')
for node in loc:
print node.firstChild.data
@seabre
seabre / blumblumshub.coffee
Created April 15, 2012 03:52
Blum Blum Shub Pseudo Random Number Generator
# An implementation of assert.
AssertException = (message) ->
@message = message
assert = (exp, message) ->
throw new AssertException(message) unless exp
AssertException::toString = ->
"AssertException: " + @message
@seabre
seabre / export_table_as_csv_from_mysql.md
Created April 4, 2012 18:55
Export Table as CSV From MySQL

#Export Table as CSV From MySQL

SELECT * INTO OUTFILE '/tmp/my_table_name.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM my_table_name;

@seabre
seabre / binary_ruby.txt
Created March 28, 2012 17:46
Weird Number Binary Thing in Ruby
> 5[0]
=> 1
> 5[1]
=> 0
> 5[2]
=> 1
> 5[3]
=> 0
@seabre
seabre / prices.tex
Created March 6, 2012 04:10
Price List For My Mom's Salon
\documentclass[12pt]{article}
\usepackage{sectsty}
\usepackage{fullpage}
\usepackage[light,math]{kurier}
\usepackage[T1]{fontenc}
\begin{document}
\thispagestyle{empty}
@seabre
seabre / mail_config.rb
Created March 2, 2012 19:54
Mail Configuration for Clients using OpenSRS Mail in Rails
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mail.our_clients_domain.com",
:port => 25,
:domain => 'our_clients_domain.com',
:user_name => 'whatever_system_user_we_chose@our_clients_domain.com',
:password => 'this_should_be_a_relatively_good_password',
:authentication => 'plain',
#:enable_starttls_auto => false
}
@seabre
seabre / gist:1664683
Created January 23, 2012 18:29
Dump and Restore MySQL Database

#Dump and Restore MySQL DB Quick Ref

##Dump The MySQL Table

mysqldump -u username -p -r my_output.sql my_database

##Compress Output with 7zip using the PPMd Algorithm

7z a -t7z my_output.7z my_output.sql -m0=PPMd

@seabre
seabre / ti_chronos_watch.pde
Created January 19, 2012 19:52
Connect TI Chronos Watch WIth Processing
/*
Get acceleration data from Chronos watch.
Taken from info posted at: http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/32714.aspx
Based off of the latest Python code on the Chronos wiki that I wrote.
Copyright (c) 2010 Sean Brewer
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@seabre
seabre / passenger_standalone_production.sh
Created December 15, 2011 21:42
Start Passenger Standalone in Production Mode
#For some reason, this took forever to figure out...
passenger start -a 127.0.0.1 -p 3000 -d -e production