Skip to content

Instantly share code, notes, and snippets.

View plainprogrammer's full-sized avatar

James Thompson plainprogrammer

View GitHub Profile
@plainprogrammer
plainprogrammer / nginx.conf
Created June 17, 2011 20:36
Orabrush Unicorn Application Server Configs
worker_processes 5;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@plainprogrammer
plainprogrammer / Capfile
Created October 11, 2011 21:41
A Capfile for Node.js deployment
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
##################################
# Edit these
set :application, "app_name"
set :node_file, "server.js"
set :host, "app.example.com"
set :repository, "git://github.com/example/example.git"
set :branch, "master"
set :deploy_to, "/var/apps/#{application}"
---
:verbose: true
gem: --no-ri --no-rdoc
:update_sources: true
:sources:
- http://gems.rubyforge.org
:backtrace: false
:bulk_threshold: 1000
:benchmark: false
audio = Audio.first
configuration = RefNetAdmin::Application.config.zencoder
id = audio.id
bucket = configuration['bucket']
base_path = configuration['base_path']
options = {
input: audio.file.url(:original),
outputs: [
@plainprogrammer
plainprogrammer / S3 bulk rename script
Created July 3, 2012 18:13
This is a quick script for doing a mass copy or rename of all files in an Amazon S3 bucket.
# This is a quick script for doing a mass rename of all files in an Amazon S3 bucket.
# In this case, the rename operation was to unescape all filenames which had been
# previously escaped in error.
#############################
# Configuration:
bucketname = "YOUR_S3_BUCKET_NAME"
access_key = 'YOUR_ACCESS_KEY_ID'
secret_key = 'YOUR_SECRET_ACCESS_KEY'
@plainprogrammer
plainprogrammer / readyproject-soa-template.rb
Created November 19, 2012 21:48
The Ready Project Ruby Application Templates
require 'rvm'
rvm_env = RVM::Environment.new("jruby")
rvm_env.gemset_create(app_name)
rvm_env.gemset_use!(app_name)
create_file ".rvmrc", "rvm use jruby@trpsoa-#{app_name} --create"
run "rm README.rdoc"
run "rm doc/README_FOR_APP"
@plainprogrammer
plainprogrammer / .bash_profile
Last active December 10, 2015 05:08
Custom BASH prompt including username, working directory, git branch and status on one line; followed by a simple prompt that reflects the exit status of the last command.
source /usr/local/etc/bash_completion.d/git-prompt.sh
function parse_git_dirty {
local retval=$?
[[ $(git status 2> /dev/null | tail -n1) != "" && $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
return $retval
}
function parse_git_branch {
local retval=$?
@plainprogrammer
plainprogrammer / README.md
Created January 27, 2014 17:09
FoundationDB Sandbox in Vagrant (Virtualbox and VMware)

FoundationDB Sandbox

The provided Vagrant file and BASH provisioning script will setup a Precise 64 environment with version 1.0.1 of FoundationDB installed and ready to go.

@plainprogrammer
plainprogrammer / README.md
Created January 27, 2014 17:17
FoundationDB Sandbox with RVM in Vagrant (Virtualbox and VMware)

FoundationDB Sandbox

The provided Vagrant file and BASH provisioning script will setup a Precise 64 environment with version 1.0.1 of FoundationDB installed and ready to go, along with a working RVM environment.

Requirements

The Vagrantfile expects the vagrant-exec plugin to be present.

namespace :failover do
desc 'Roll failover back to primary database configuration'
task :primary do
File.delete('config/database.yml')
symlink('database.primary.yml', 'config/database.yml')
end
end
desc 'Failover to secondary database configuration'
task :failover do