Skip to content

Instantly share code, notes, and snippets.

View codatory's full-sized avatar

Alex Conner codatory

View GitHub Profile
# $Id$
# Authority: dag
# Upstream: Richard Hipp <drh$hwaci,com>
### EL6 ships with sqlite-3.6.20-1.el6
### EL5 ships with sqlite-3.3.6-5
### Builds fine, but related python-sqlite needs python >= 2.3 and yum 2.4 needs sqlite2
# ExcludeDist: el2 rh7 rh9 el3 el4
%{?el3:%define _without_tcl 1}
@codatory
codatory / Info.plist
Created July 15, 2011 19:54
Tweaked JVM Settings for RubyMine with a large project
<key>VMOptions</key>
<string>-ea -Xverify:none -Xbootclasspath/a:../lib/boot.jar -XX:+UseConcMarkSweepGC -XX:+ParNewGC</string>
<key>VMOptions.i386</key>
<string>-Xms128m -Xmx1024m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m</string>
<key>VMOptions.x86_64</key>
<string>-Xms128m -Xmx2048m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCompressedOops</string>
@codatory
codatory / takenote.sh
Created July 16, 2011 23:57
Take Note
# A bash profile snippet to timestamp and store passed text in
# a notefile for later retrieval
take_note() {
DATE=`date`
echo ${DATE} - $* >> ~/notefile
}
# Handy Benchmark Script for comparing times of two methods
require 'benchmark'
require './lib/regexp'
# Uses https://github.com/mpalmer/email-address-validator
times = 20000000
email_1 = '[email protected]'
email_2 = 'foo.bar'
email_3 = 'nframe.com'
# SSH Connection pooling for faster additional connections to a machine
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# This makes subsequent connections go faster
ControlPersist 2h
# Make it so ssh-ing from one server to another passes keys around automagically
ForwardAgent yes
Process: ruby [54093]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [8695]
Date/Time: 2011-08-23 17:24:42.402 -0400
OS Version: Mac OS X 10.7.1 (11B26)
Report Version: 9
@codatory
codatory / database.yml
Created September 7, 2011 22:15
Default database.yml
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000
@codatory
codatory / import.rb
Created September 12, 2011 16:30
Chardet CSV Example
file = params[:csv].open
chardet = CharDet.detect(file.read[0..200])
if chardet['confidence'] > 0.7
charset = chardet['encoding']
else
raise 'Unable to detect file encoding'
end
csv = CSV.parse(Iconv.conv('ASCII//IGNORE//TRANSLIT',charset,file.open.read), :headers => true)
@codatory
codatory / rails_project_start_checklist.markdown
Created November 3, 2011 17:51
(Ideal) Rails Project Pre-Start Checklist

(Ideal) Rails Project Pre-Start Checklist

Source Control

  • Code is under source control (git) with a remote I can read/write to

Testing

  • Be aware of test coverage
  • Code is under continuous integration

Deployment

  • The code has a known deployment process
@codatory
codatory / whatismyip.bash
Created November 8, 2011 16:38
WhatIsMyIP Bash Function
whatismyip() {
IP=`curl --silent http://ip.appspot.com/`
echo "External IP: ${IP}"
}