This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GH | |
# by Brock Angelo | |
# for Mac OSX & Unix | |
# https://gist.github.com/1917716 | |
# Description: when you are on the command line and want to open your project in Github, just type "gh". Latest version opens the current branch on github as well. | |
# | |
# SETUP: | |
# 1. Copy this snippet to ~/bin/gh | |
# 2. Make it executable by running: chmod +x ~/bin/gh | |
# 3. From the command line, inside your project, type gh and the browser window will open. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------------------------------------------------------------- | |
# FILE: smt-mod.zsh-theme | |
# DESCRIPTION: oh-my-zsh theme file, based on smt by Stephen Tudor | |
# AUTHOR: Brock Angelo | |
# VERSION: 0.1 | |
# SCREENSHOT: | |
# ----------------------------------------------------------------------------- | |
MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" | |
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKUP_DIR="~/db_backups" | |
DBUSER="" | |
DBPASSWORD="" | |
BUCKET="" | |
FROM='"Backups" <backups@localhost>' | |
TO='"Admin" <admin@localhost>' | |
SUBJECT='Backup Log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER="" | |
PASSWORD="" | |
if [ -z $1 ]; then | |
echo -e "ERROR: No database name. Usage: export_db DATABASE_NAME" | |
exit; | |
fi | |
DB=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save this file somewhere # ~/bin/ghd.sh | |
# Create an alias in .bashrc # alias ghd='bash ~/bin/ghd.sh' | |
# | |
# Usage: ghd <name_of_branch_on_github> | |
# Browser will open showing you the diff between current branch and the branch specified | |
DIFF_BRANCH=$1 | |
if [[ -z "$DIFF_BRANCH" ]]; then | |
echo "Please specifiy a branch to compare." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'aws/s3' | |
# Change the access key and secret to your amazon credentials | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'ACCESS_KEY_ID', | |
:secret_access_key => 'SECRET' | |
) | |
# Change this to your S3 bucket name | |
WEBSITE_BUCKET_NAME = "YOUR_BUCKET_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to MattLor | |
# http://stackoverflow.com/questions/27267/delete-amazon-s3-buckets | |
require 'aws/s3' | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'your access key', | |
:secret_access_key => 'your secret key' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
# Challenge 1: use the <digits> array to display the | |
# numbers 1 - 100 in a 10x10 block. Try to use only | |
# one *puts* statement | |
# terminal output: | |
# | |
# 1 2 3 4 5 6 7 8 9 10 | |
# 11 12 13 14 15 16 17 18 19 20 | |
# 21 22 23 24 25 26 27 28 29 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'colored' | |
require 'time' | |
date = Date.today | |
puts date.strftime("%B %Y").center(20) | |
puts "Su Mo Tu We Th Fr Sa" | |
days_in_month = (Date.new(date.year, 12, 31) << (12 - date.month)).day |
OlderNewer