Skip to content

Instantly share code, notes, and snippets.

@ffjia
ffjia / bldpkg.sh
Created December 12, 2012 07:35 — forked from crazed/bldpkg.sh
#!/bin/bash
MPATH=$1
BETCDIR='/etc/mcollective'
BRUBYDIR='/Library/Ruby/Site/1.8'
BSBINDIR='/usr/sbin'
BBINDIR='/usr/bin'
BLIBEXECDIR='/usr/libexec/mcollective'
BDOCDIR='/usr/share/doc/mcollective'
BLAUNCHDIR='/Library/LaunchDaemons'
BLOGDIR='/var/log/mcollective'
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

#!/bin/sh
exec 2>/dev/null 1>/dev/null
export PATH=$PATH:%%PREFIX%%/bin
logdir=/var/db/mongodb
suffix=.bz2
prefix=mongod.log.
selflog=${prefix}rotate.`date +%Y-%m-%d`
days_to_keep=14

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
#!/bin/sh
# Author: RA <ravageralpha@gmail.com>
USAGE(){
echo "Usage:fetchsub [eng] file"
}
[ $# -eq 0 -o "$1" = '--help' ] && USAGE && exit 0
ERROR(){
#!/bin/bash
# Assumptions:
#
# Puppet >= 2.7 is installed on this machine
# puppet-lint is installed on this machine
# ERB is installed on this machine
# Adjust LINTFLAGS as appropriate
# Redirect output to stderr.
@ffjia
ffjia / .vimrc
Created September 30, 2013 07:00
" Functions
" ================
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Make script executable
function SetScriptExecutable()
" TODO make shell script executable first
if synIDattr(synID(1,1,1),"name")=="perlSharpBang"
execute ':!(if [ \! -x '.expand("<afile>").' ]; then chmod u+x '.expand("<afile>").'; fi)'
"elseif exists("b:is_sh") || exists("b:is_kornshell") || exists("b:is_bash")
/var/log/supervisor/*.log {
weekly
rotate 52
compress
delaycompress
notifempty
missingok
copytruncate
}