Skip to content

Instantly share code, notes, and snippets.

View alexrinass's full-sized avatar

Alexander Rinass alexrinass

View GitHub Profile
@alexrinass
alexrinass / deploy.rb
Created September 18, 2012 19:24
Capistrano Multistage Deployment Config
require "bundler/capistrano"
set :application, "your_app"
# multistage
set :stages, ["staging", "production"]
set :default_stage, "staging"
require "capistrano/ext/multistage"
@alexrinass
alexrinass / gist:2786573
Created May 25, 2012 08:17
Fix Xcode 4.3 issues
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
@alexrinass
alexrinass / gist:1986654
Created March 6, 2012 14:52
Redirect stdout and stderr to /dev/null for a script
# from http://stackoverflow.com/questions/314675/how-do-i-redirect-the-output-of-an-entire-shell-script-within-the-script-itself
# save stdout and stderr to file descriptors 3 and 4, then redirect them to "foo"
exec 3>&1 4>&2 >foo 2>&1
# ...
# restore stdout and stderr
exec 1>&3 2>&4
@alexrinass
alexrinass / gist:1723073
Created February 2, 2012 11:31
Generate self-signed certificate for Apache
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
sudo cp server.crt /opt/local/apache2/conf/server.crt
sudo cp server.key /opt/local/apache2/conf/server.key
@alexrinass
alexrinass / toggle-hidden-files
Created October 19, 2011 09:01
Show hidden files in Finder
defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
@alexrinass
alexrinass / addgitrepo.sh
Created August 18, 2011 09:36
Creates a new Git repository on Debian/Ubuntu Linux
#/bin/sh
#
# Script to create an empty Git-Repository.
#
GIT_BASEPATH=/var/cache/git
SCRIPT_NAME="`basename $0`"
PROJECT_NAME="$1"
if [ -z "$PROJECT_NAME" ]; then
echo "Usage: $SCRIPT_NAME PROJECT_NAME"
@alexrinass
alexrinass / addmysqluser.sh
Created August 16, 2011 14:45
Create new MySQL user
#!/bin/sh
NEWUSER="$1"
PASSWORD="$2"
if [ -z "$NEWUSER" ]; then
echo "Usage: addmysqluser USERNAME [PASSWORD]"
exit 0
fi
@alexrinass
alexrinass / addmysqldb.sh
Created August 16, 2011 14:45
Create new MySQL database
#!/bin/sh
DB="$1"
if [ -z "$DB" ]; then
echo "Usage: addmysqldb DB"
exit 0
fi
RESULT=$(echo "CREATE DATABASE \`$DB\` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" |mysql5 mysql 2>&1)
@alexrinass
alexrinass / shell_colors.sh
Created August 16, 2011 12:46
Shell colors
RED="\033[0;31m"
LRED="\033[1;31m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
BROWN="\033[0;33m"
YELLOW="\033[1;33m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
#!/bin/sh
#
# Changes the document root of a Apache 2 virtual host.
#
# Assumes /opt/local/www as base directory for virtual hosts.
#
# Usage: wwwhome [--host HOSTNAME] [PATH]
#
# Examples:
#