Skip to content

Instantly share code, notes, and snippets.

View gdb_trigger.c
/*
* 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 Mar 15, 2010
Ubuntu/Rails/Apache/Passenger install instructions
View Ubuntu, Rails, Passenger setp from scratch.textile

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 Mar 19, 2010
sqlite database.yml
View gist:338014
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 15000
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 15000
@scottjacobsen
scottjacobsen / out.txt
Created Apr 30, 2010
old nestersocks dns records
View out.txt
; <<>> 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
View gist:385635
;; 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.
View migration_helper.rb
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]
View niceWrapping.cs
LastCall.IgnoreArguments().Constraints(
Rhino.Mocks.Constraints.Is.Matching<List<IListable>>(delegate(List<IListable> lst)
{
return
lst
.
Count ==
1 &&
((
CSkuExtended
View migration_helper.rb
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
View gist:1377158
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
View haproxy.cfg
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