Skip to content

Instantly share code, notes, and snippets.

View nesquena's full-sized avatar

Nathan Esquenazi nesquena

View GitHub Profile
@nesquena
nesquena / .bash_profile
Created July 1, 2010 21:16
Git Config .gitconfig file
# brew install git bash-completion
# Completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# Editor
export EDITOR='mate -w'
@nesquena
nesquena / .gemrc
Created July 26, 2010 20:58
Gem RC file
---
:update_sources: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc
@nesquena
nesquena / compile_redis_ubuntu.txt
Created July 26, 2010 22:05
Redis installation instructions
# http://antonio.ognio.com/2010/07/28/installing-redis-on-linux-and-mac-os-x/
wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
tar -xzvf redis-2.2.2.tar.gz
cd redis-2.2.2 && sudo make && sudo make install
Five binaries will be installed to /usr/local/bin, redis-server, redis-benchmark, redis-cli, redis-check-dump and redis-check-aof. You’ll have to manually copy the Redis configuration file to /etc like this:
sudo mkdir /etc/redis
sudo cp redis.conf /etc/redis/redis.conf
@nesquena
nesquena / custom.cnf
Created August 3, 2010 22:21
MySQL Configuration
[mysqld]
#
# * Networking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 192.168.xxxx.xxxx
#
@nesquena
nesquena / postfix_setup.md
Last active September 23, 2015 13:38
Postfix Mail Delivery
sudo apt-get update
sudo apt-get install postfix mailutils
sudo mkfifo /var/spool/postfix/public/pickup
sudo /etc/init.d/postfix restart
sudo touch /var/mail/deploy
sudo chown deploy:deploy /var/mail/deploy
sudo reboot
@nesquena
nesquena / example_file.yml
Created September 10, 2010 01:04 — forked from trshafer/example_file.yml
TermInit Script
# you can make as many tabs as you wish...
# tab names are actually arbitrary at this point too.
---
- tab1: cd ~/foo/bar
- tab2:
- mysql -u root
- use test;
- show tables;
- tab3: echo "hello world"
- tab4: cd ~/baz/ && svn up
@nesquena
nesquena / application.js
Created October 1, 2010 23:56
Simple pattern for handling jquery js in rails
// public/javascripts/application.js
// JQUERY example
// Accepts ev.foo, ev.bar, ev.html
$(document).bind('some:event', function(ev) {
// do something here
$('some-div').html(ev.html);
});
@nesquena
nesquena / tuning_ruby.txt
Created October 29, 2010 21:06
Performance Turning for REE
# http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning
# http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
# http://smartic.us/2010/10/27/tune-your-ruby-enterprise-edition-garbage-collection-settings-to-run-tests-faster/
# http://izumi.plan99.net/blog/wp-content/uploads/2009/01/ree-documentation.html#_garbage_collector_performance_tuning
$ sudo nano /usr/local/bin/tuned_ruby
# !/bin/bash 
export RUBY_HEAP_MIN_SLOTS=500000
export RUBY_HEAP_SLOTS_INCREMENT=250000
@nesquena
nesquena / counter_backfill_migration.rb
Created November 17, 2010 21:13 — forked from mpakes/counter_backfill_migration.rb
Populate a cached counter field via a single SQL query.
# Credit to Mike Perham for this gem of an idea
# http://www.mikeperham.com/2007/12/17/creating-a-counter_cache-column/
class RailsMigration < ActiveRecord::Migration
def self.up
add_column :media, :followers_count, :integer, :default => 0, :null => false
# Populate the media follower counter cache in one fell swoop.
sql = "update media, (select operable_id, count(*) as the_count from follow_operations "\
"group by operable_id) as follows set media.followers_count = follows.the_count "\
"where media.id = follows.operable_id;"
@nesquena
nesquena / ruby_1_9_2
Created February 9, 2011 05:11
Install Ruby 1.9.2
$ sudo apt-get install gcc g++ build-essential libssl-dev libreadline5-dev zlib1g-dev linux-headers-generic
$ sudo apt-get install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make
$ wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
$ tar -xvzf ruby-1.9.2-p0.tar.gz
$ cd ruby-1.9.2-p0/
$ ./configure --prefix=/usr/local/ruby
$ make && sudo make install
$ sudo nano /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"