Skip to content

Instantly share code, notes, and snippets.

View scottjacobsen's full-sized avatar

Scott Jacobsen scottjacobsen

View GitHub Profile
/*
* is this cool enough that it warrants a blog post?
*
* trigger breakpoint in GDB, from code.
*/
#include <stdio.h>
int main(int argc, char *argv[]) {
@scottjacobsen
scottjacobsen / Ubuntu, Rails, Passenger setp from scratch.textile
Created March 15, 2010 18:35
Ubuntu/Rails/Apache/Passenger install instructions

Rails Web Server Stack Setup

Install Ruby, Apache, and some required utility packages

sudo aptitude install ruby apache2-mpm-prefork build-essential ruby-dev libopenssl-ruby \
apache2-prefork-dev libapr1-dev libaprutil1-dev git-core irb

Install the Ruby Gem package manager:

  • Get the latest Gem package manager (the file ending in .tgz) from the gem distribution.
@scottjacobsen
scottjacobsen / gist:338014
Created March 19, 2010 18:40
sqlite database.yml
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 15000
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 15000
@scottjacobsen
scottjacobsen / out.txt
Created April 30, 2010 17:30
old nestersocks dns records
; <<>> DiG 9.6.1-P2 <<>> nestersocks.com ANY
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54197
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;nestersocks.com. IN ANY
;; Received 121 bytes from 192.42.93.30#53(g.gtld-servers.net) in 82 ms
www.nestersocks.com. 3600 IN CNAME nestersocks.com.
nestersocks.com. 86400 IN SOA ns53.domaincontrol.com. dns.jomax.net. 2010043019 28800 7200 604800 86400
nestersocks.com. 3600 IN A 173.203.105.89
nestersocks.com. 3600 IN NS ns53.domaincontrol.com.
nestersocks.com. 3600 IN NS ns54.domaincontrol.com.
nestersocks.com. 3600 IN TXT "v=spf1 a mx ptr ~all"
nestersocks.com. 604800 IN MX 10 aspmx.l.google.com.
nestersocks.com. 604800 IN MX 20 alt1.aspmx.l.google.com.
module MigrationHelper
#options are:
# :pk_table_name
# :pk_column_name
# :cascade_delete
# :cascade_update
def add_fk(fk_table_name, fk_column_name, options)
fk_table_name = fk_table_name.to_s
fk_column_name = fk_column_name.to_s
pk_table_name = options[:pk_table_name] || fk_column_name[0, fk_column_name.index("_id") || fk_column_name.length]
@scottjacobsen
scottjacobsen / niceWrapping.cs
Created May 23, 2011 07:02
niceWrapping.cs
LastCall.IgnoreArguments().Constraints(
Rhino.Mocks.Constraints.Is.Matching<List<IListable>>(delegate(List<IListable> lst)
{
return
lst
.
Count ==
1 &&
((
CSkuExtended
@scottjacobsen
scottjacobsen / migration_helper.rb
Created July 30, 2011 11:46
fk migration helpers
module MigrationHelper
#options are:
# :pk_table_name
# :pk_column_name
# :cascade_delete
# :cascade_update
def add_fk(fk_table_name, fk_column_name, options = {})
fk_table_name = fk_table_name.to_s
fk_column_name = fk_column_name.to_s
pk_table_name = options[:pk_table_name] || fk_column_name[0, fk_column_name.index("_id") || fk_column_name.length].pluralize
@scottjacobsen
scottjacobsen / gist:1377158
Created November 18, 2011 17:40
include include
ruby-1.9.3-rc1 :001 > module Foo
ruby-1.9.3-rc1 :002?> def im_foo; "foo"; end;
ruby-1.9.3-rc1 :003 > end
=> nil
ruby-1.9.3-rc1 :004 > module Bar
ruby-1.9.3-rc1 :005?> include Foo
ruby-1.9.3-rc1 :006?> def im_bar; "bar"; end;
ruby-1.9.3-rc1 :007 > end
=> nil
ruby-1.9.3-rc1 :008 > class FooBar
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
debug