This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include on ~/.bashrc | |
PS1="\[\033[38m\]\u"; | |
PS1="$PS1\[\033[32m\] \w"; | |
PS1="$PS1\[\033[31m\]"; | |
PS1="$PS1\`git branch 2>/dev/null | grep \"^\*\" | \\ | |
sed -r \"s/\*\ (.*)/ \(\1\)/\"\`"; | |
export PS1="$PS1\[\033[37m\]$\[\033[00m\]"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@ubuntu:~$ sudo apt-get install git-core curl | |
user@ubuntu:~$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
Cloning into rvm... | |
remote: Counting objects: 5375, done. | |
remote: Compressing objects: 100% (2544/2544), done. | |
remote: Total 5375 (delta 3492), reused 3850 (delta 2113) | |
Receiving objects: 100% (5375/5375), 1.84 MiB | 1.21 MiB/s, done. | |
Resolving deltas: 100% (3492/3492), done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 4; | |
error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
pid logs/nginx.pid; | |
events { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APP_DIR=/var/local/apps/app | |
RAILS_ENV=production | |
function step | |
{ | |
if [ "$step_count" = "" ]; then | |
step_count=0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for q in $(echo 'SMEMBERS "resque:queues"' | redis-cli | awk '{print $1}') | |
do | |
echo $q $(echo "LLEN \"resque:queue:$q\"" | redis-cli) | |
done | |
# in a single line; | |
# for q in $(echo "SMEMBERS \"resque:queues\"" | redis-cli | awk '{print $1}'); do echo $(echo "LLEN \"resque:queue:$q\"" | redis-cli); done | awk '{s+=$1} END {print s}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#usage: ruby require_profiler.rb ./config/application | |
ENV['NO_RELOAD'] ||= '1' | |
ENV['RAILS_ENV'] ||= 'development' | |
ENV['RACK_ENV'] ||= 'development' | |
require 'rubygems' | |
require 'benchmark' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://gistflow.com/posts/749-canceling-validations-in-activerecord | |
# declaration | |
def skipping_validation(methods, &block) | |
skipped_validations = methods.map do |method, kinds| | |
Array(kinds).map do |kind| | |
_validators[method].select { |v| v.kind == kind }.map do |validation| | |
_validate_callbacks.select { |c| c.filter == validation }.map do |callback| | |
_validate_callbacks.delete(callback) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the configuration for libtsocks (transparent socks) | |
# Lines beginning with # and blank lines are ignored | |
# | |
# The basic idea is to specify: | |
# - Local subnets - Networks that can be accessed directly without | |
# assistance from a socks server | |
# - Paths - Paths are basically lists of networks and a socks server | |
# which can be used to reach these networks | |
# - Default server - A socks server which should be used to access | |
# networks for which no path is available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
require 'sequel' | |
Sequel.extension(:migration) | |
MIGRATIONS_PATH = 'db/migrations' | |
def db_conn_env | |
ENV["BOOKSHELF_DATABASE_URL"] | |
end |
OlderNewer