Skip to content

Instantly share code, notes, and snippets.

View alexrinass's full-sized avatar

Alexander Rinass alexrinass

View GitHub Profile
@alexrinass
alexrinass / gist:960736
Created May 7, 2011 18:57
NOW in shell
NOW=$(date +"%Y%d%m%H%M%S")
@alexrinass
alexrinass / gist:960814
Created May 7, 2011 20:30
Apache .htaccess dispatcher redirect
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
@alexrinass
alexrinass / gist:960815
Created May 7, 2011 20:31
Apache .htaccess maintenance redirect
RewriteCond %{REQUEST_URI} !/maintenance/
RewriteRule ^.*$ http://{DOMAIN}/maintenance/ [R=temp]
@alexrinass
alexrinass / gist:960816
Created May 7, 2011 20:31
Apache .htaccess single domain
RewriteCond %{SERVER_ADDR} x.x.x.x
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
@alexrinass
alexrinass / .gitconfig
Created July 6, 2011 12:55
Git config
[user]
name = Alexander Rinass
email = [email protected]
[core]
editor = mate -w
[github]
user = alexrinass
[color]
branch = auto
diff = auto
#!/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:
#
@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"
@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 / 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 / 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"