Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
@brock
brock / gh.sh
Created February 26, 2012 16:59
Open Git Project in Github
# 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.
@brock
brock / smt-mod.zsh-theme
Last active May 9, 2019 15:26
ZSH Theme
# -----------------------------------------------------------------------------
# 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%}"
@brock
brock / backup_all_dbs.sh
Created September 20, 2012 01:03
Backup All DB's and transfer to S3 with s3cmd
#!/bin/bash
BACKUP_DIR="~/db_backups"
DBUSER=""
DBPASSWORD=""
BUCKET=""
FROM='"Backups" <backups@localhost>'
TO='"Admin" <admin@localhost>'
SUBJECT='Backup Log'
@brock
brock / export_db.sh
Created September 20, 2012 01:03
Export DB, gzip and domain replacement.
#!/bin/bash
USER=""
PASSWORD=""
if [ -z $1 ]; then
echo -e "ERROR: No database name. Usage: export_db DATABASE_NAME"
exit;
fi
DB=$1
@brock
brock / ghd.sh
Created November 1, 2012 14:31
Open Github Diff comparing current branch to branch specified.
#!/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."
@brock
brock / upload.rb
Created November 7, 2012 19:48 — forked from thechrisoshow/upload.rb
This script uploads files to a S3 bucket
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"
@brock
brock / clearS3Bucket.rb
Created November 8, 2012 02:23
Delete all files in s3 bucket
# 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'
)
@brock
brock / gist:4036187
Created November 8, 2012 02:28
htaccess redirect www to non-www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@brock
brock / ruby_challenge_11_7_12.rb
Created November 8, 2012 02:32
Ruby Challenge 2
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
@brock
brock / git_cal.rb
Created November 14, 2012 05:35
Git Commit Calendar
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