Skip to content

Instantly share code, notes, and snippets.

View brandondrew's full-sized avatar

Brandon Zylstra brandondrew

  • UC Berkeley
  • the tubes
View GitHub Profile
@schacon
schacon / stopwatch.rb
Created June 22, 2011 15:59
simple ruby stopwatch
class Stopwatch
attr_writer :splits, :max, :start, :end, :total
def initialize(message)
@message = message
@splits = []
@max = 5
end
@CrCs2O4
CrCs2O4 / gems_homepages.rb
Last active June 4, 2018 19:04
Get ruby gems homepages fo fast googling. Sometimes 'gem list' is not enough
#!/usr/bin/env ruby
# bundler exec ruby gems_homepages.rb
# based on http://stackoverflow.com/questions/5177634/list-of-installed-gems
require 'rubygems'
def local_gems
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name }
end
puts local_gems.map{ |name, specs|
For those folks not already hanging out in #documentcloud... here's the log of this afternoon's Ember/Backbone politics discussion.
12:21 PM <wycats> jashkenas: hey
12:21 PM <wycats> jashkenas: I'm sorry
12:21 PM <wycats> how would you like me to describe backbone?
12:21 PM <wycats> let's work this out for once and for all :)
12:21 PM <wycats> I'm definitely not intentionally saying incorrect things about backbone
12:22 PM • knowtheory gets out popcorn
12:24 PM <jashkenas> don't worry about it too much -- I'm just not terribly pleased with backbone being continued to be used as the strawman...
12:24 PM <wycats> jashkenas: I am worried about it a lot
@n1k0
n1k0 / 404checker.js
Created January 11, 2013 10:55
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@karmi
karmi / whats-wrong-with-ruby-libraries-for-couchdb.markdown
Created August 1, 2010 19:17
What's wrong with Ruby libraries for CouchDB?

What's wrong with Ruby libraries for CouchDB?

During the last year, I have worked on couple of Ruby/Rails based projects where the primary datastore was CouchDB. CouchDB, to me, is a dream database for web developer come true. The simplicity, the HTTP-based API, the abandonment of SQL semantics, the inspiring community, that all reminds me of when I came into Rails years ago.

However, working with Couch in Ruby and Rails is very, very painful, in my opinion. I'd like to briefly summarize some of my frustrations here. Maybe they are shared, maybe not -- if they are, I think we should launch some coordinate effort to make using Couch in Ruby a pleasure and intelectual satisfaction, not endless loops of research and hacks to „make it work“.

Please note, that my interest is solely to stir the debate. I may be severely mistaken in any point. But, I'd like using Couch in a Ruby application to be a joy, not a frustration, which is what I've met more times than I'd ha

@ianmurrays
ianmurrays / deploy.rb
Created July 21, 2011 17:26
Runs test locally before deploying on capistrano.
set :test_log, "logs/capistrano.test.log"
namespace :deploy do
before 'deploy:update_code' do
puts "--> Running tests, please wait ..."
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null'
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong."
exit
else
puts "--> Tests passed"
@mletterle
mletterle / gist:8048086
Last active November 26, 2021 08:56
Replay Two Git Repositories History Into A New One, Chronologically

Combining Two (or more potentially) Git Repos

###Moving one repo into a subdirectory of the other

Preserves notes and sets commit details to author details

in newrepo

@rwest
rwest / README
Created January 9, 2012 16:42 — forked from symposion/README
Convert OS X Keychain exported entries into logins for 1Password import
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@brandondrew
brandondrew / build_home.sh
Last active December 23, 2021 14:16
Script to automatically build your new home directory on Unix or Linux boxes (with Spartan enhancements)
#!/bin/bash
###############################################################
# BUILD HOME script:
# This script sets up your home directory fast with basic
# necessities and amenities, to give you sanity when you
# work on a Unix box where you don't have root access.
###############################################################
### TO USE:
# wget https://gist.github.com/raw/3639058/build_home.sh
# bash build_home.sh
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print "ARP Probe from: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)