Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
@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")
@taterbase
taterbase / system-beep.js
Created July 21, 2012 05:01
System Beep in Node.js
function alertTerminal(){
console.log("\007");
}
@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'
@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
[email protected]
SSH_PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxoQkUlUr+GcEpY1Its3mXFq/xi6yUgknxcSfGx0Yl25zo9nLl5UpeA+r0SmTfnu5oj674i+Ccx7NgwIkhGONXyKZaWyQf7jQZRa6sAMyETQ8QFbkprLCcF6LXJ9B1Khj16ZgXgcuSjMQKmbi8FA3iCcP5jGeT/02x5QhC5hXNPZafODwR5Xty559mLqsZ3LwzQZ4YaQDi4fnEDz7z4iA5+2Xo44de4ypmAmRBsOJZ0mgiRyClDEa0TVCctIXLeOt5OU76DE/IXuKHmtpwWiAI+c6ZNLmXeidrMQzhS6XfDwtTS0YMNnXn4aSSSJNhuvRAhCj9qjAXT1lV1QPb2P84Q== [email protected]"
@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
@gre
gre / Application.scala
Created November 12, 2012 11:10
Generate Zip on-the-fly with Play!> Framework (2.1+)
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def zip = Action {
import play.api.libs.iteratee._
import java.util.zip._
@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