Skip to content

Instantly share code, notes, and snippets.

View alexrinass's full-sized avatar

Alexander Rinass alexrinass

View GitHub Profile
@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
@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 / 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: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:960736
Created May 7, 2011 18:57
NOW in shell
NOW=$(date +"%Y%d%m%H%M%S")
@alexrinass
alexrinass / gist:960735
Created May 7, 2011 18:56
Create new MySQL UTF-8 database
CREATE DATABASE `DATABASE` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
@alexrinass
alexrinass / gist:960734
Created May 7, 2011 18:56
Create new restricted MySQL user
CREATE USER 'USER'@'localhost' IDENTIFIED BY 'PASSWORD';
INSERT INTO `db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`) VALUES
('localhost', 'DATABASE', 'USER', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N');
@alexrinass
alexrinass / gist:960733
Created May 7, 2011 18:55
Absolute path of script file in shell
$(cd $(dirname $0);pwd)
@alexrinass
alexrinass / gist:960731
Created May 7, 2011 18:52
chmod dirs/files only
# dirs only
find "$DIRECTORY" -type d -exec chmod "$MODE" {} \;
# files only
find "$DIRECTORY" -type f -exec chmod "$MODE" {} \;
@alexrinass
alexrinass / gist:960730
Created May 7, 2011 18:50
TextMate as git editor
[core]
editor = mate -w