Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
import praw # simple interface to the reddit API, also handles rate limiting of requests
import re
from collections import deque
from time import sleep
USERNAME = "Your username here"
PASSWORD = "Your password here"
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit"
r = praw.Reddit(USERAGENT)
@brock
brock / 0_reuse_code.js
Created October 29, 2013 19:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@brock
brock / README.md
Created August 9, 2013 01:08 — forked from mbbx6spp/README.md

Distributed or Dancer Shell

Similar to ansible command but allows you to use any command that will work in your shell. Not tied to specific configuration management tooling, just SSH and your default shell on remote systems. Just works. I <3 it :)

What does it do?

Runs commands across potentially many machines. Allows you to organize your servers/VMs/instances into groups very easily.

Getting Started

#!/usr/bin/env ruby
#
# stevie_chambers@viewyonder.com July 2012
#
# I'm playing around with APIs, and sharing my learnings
# You can follow my trials and tribulations at http://viewyonder.com/apis
#
# This is a simple Ruby script to show how a simple API might work.
# The resource model is just a simple array of a single class - no back-end store (yet)
#
@brock
brock / gist:4123148
Created November 21, 2012 05:11 — forked from yuhonas/gist:4122118
iTerm / Sublime AppleScript
tell application "System Events"
# create an iTerm session if we dont have one
if not (exists (processes where name is "iTerm")) then
tell application "iTerm" to (make new terminal)
end if
tell application "iTerm"
activate
tell the current terminal
set SublimeSessionName to "sublime"
@brock
brock / vimblog.vim
Created November 21, 2012 04:55 — forked from gavinzhou/vimblog.vim
vimblog
" Requirements:
" - you'll need VIM compiled with Ruby scripting support
" - example: for Debian/Ubuntu: sudo apt-get install vim-ruby
" - please, copy this file to one of your VIM dir
" - example: to your .vim home folder: $HOME/.vim/vimlog.vim
" - please, add this code to your .vimrc file:
"
" if !exists('*Wordpress_vim')
" runtime vimlog.vim
" endif
@brock
brock / hack.sh
Created November 14, 2012 05:36 — forked from neil477/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@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
@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 / 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]