Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
@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
@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"
@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
@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
@erikthered
erikthered / gist:3500628
Created August 28, 2012 16:58
Hubot Upstart script with logging
# hubot
description "Hubot chat bot"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
# Path to Hubot installation
env HUBOT_DIR='/opt/hubot/'
env HUBOT='bin/hubot'
@taterbase
taterbase / system-beep.js
Created July 21, 2012 05:01
System Beep in Node.js
function alertTerminal(){
console.log("\007");
}
@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")
@febuiles
febuiles / hubot.sh
Created November 25, 2011 22:02
Hubot startup script
#!/bin/sh
# This assumes you have:
# 1) A user called `hubot` in charge of the bot.
# 2) A file called /home/hubot/.hubotrc that contains the Hubot credentials.
#
# To set the adapter either edit bin/hubot to specify what you want or append
# `-- -a campfire` to the $DAEMON variable below.
#
### BEGIN INIT INFO
class Hash
def to_html
[
'<ul>',
map { |k, v| ["<li><strong>#{k}</strong>", v.respond_to?(:to_html) ? v.to_html : "<span>#{v}</span></li>"] },
'</ul>'
].join
end
end
@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e