Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
@swieton
swieton / vhost_tests.rb
Created November 7, 2010 19:00
Simple validation of redirects and URL rewrites
require 'rubygems'
require 'http-access2' # from gem httpclient
tests = {
# A simple test: GET a URL and expect a successful response
"Home page" => {
:get => "http://www.myapp.com/",
:result => 200
},
@andyadams
andyadams / gist:2030363
Created March 13, 2012 18:08
Capistrano Pulldown scripts for WordPress database and uploads
desc "Pull a database dump from remote server, drop the local database, then import the dump"
task :pull_database_to_local do
# Build out temporary file name with timestamp for uniqueness
timestamp = get_timestamp
temp_file_name = "database_dump_#{timestamp}"
remote_file_name = remote_mysqldump(temp_file_name)
download(remote_file_name, "/tmp/#{temp_file_name}.sql.gz")
@dharamgollapudi
dharamgollapudi / gist:3976754
Created October 29, 2012 21:47 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@sgottlieb
sgottlieb / word_count.rb
Created October 29, 2012 22:08
Word count with Ruby
def open_file(filename)
word_list = []
aFile = File.open(filename, "r+")
aFile.each do |line|
list = line.split(" ")
list.each do |word|
word_list << word
end
end
@vlucas
vlucas / gist:3976934
Created October 29, 2012 22:22 — forked from ericboehs/gist:3863345
PHP / MySQL Server (Ubuntu 12.04)
#!/usr/bin/env bash
###
# Run this script as root
###
# Setup variables for this script
USER_NAME=vlucas
USER_EMAIL=vance@vancelucas.com
SSH_PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxoQkUlUr+GcEpY1Its3mXFq/xi6yUgknxcSfGx0Yl25zo9nLl5UpeA+r0SmTfnu5oj674i+Ccx7NgwIkhGONXyKZaWyQf7jQZRa6sAMyETQ8QFbkprLCcF6LXJ9B1Khj16ZgXgcuSjMQKmbi8FA3iCcP5jGeT/02x5QhC5hXNPZafODwR5Xty559mLqsZ3LwzQZ4YaQDi4fnEDz7z4iA5+2Xo44de4ypmAmRBsOJZ0mgiRyClDEa0TVCctIXLeOt5OU76DE/IXuKHmtpwWiAI+c6ZNLmXeidrMQzhS6XfDwtTS0YMNnXn4aSSSJNhuvRAhCj9qjAXT1lV1QPb2P84Q== vance@vancelucas.com"
@joshweinstein
joshweinstein / gist:3977183
Created October 29, 2012 23:21
Capistrano Performance Report
# Courtesy of PagerDuty
Capistrano::Configuration.instance(:must_exist).load do |config|
start_times = {}
end_times = {}
order = []
on :before do
order << [:start, current_task]
start_times[current_task] = Time.now
@fabiancarlos
fabiancarlos / git_ex_comands.md
Last active October 12, 2015 05:27
Git Essential Comands
git init # initalize a empty git repo
git status # check modifications in the repo repo
git log # check commits in the git repo
@danwdart
danwdart / getrepos.sh
Last active October 13, 2015 02:07
Clones all the repos of a github user (via git+ssh)
wget -O- https://api.github.com/users/$1/repos 2>/dev/null | grep ssh_url | cut -d '"' -f 4 | awk '{ print "git clone " $0 }' | sh
@Morse-Code
Morse-Code / gist:4122759
Created November 21, 2012 03:03 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
anonymous
anonymous / hello.java
Created December 9, 2015 01:38
public class JTestbuild
{
public static void main(String[] args)
{
int i = 0;
while(i < 14)
{
switch(i)
{
case(0):