Skip to content

Instantly share code, notes, and snippets.

View bmuller's full-sized avatar
🐒
Whoa github has statuses

Brian Muller bmuller

🐒
Whoa github has statuses
View GitHub Profile
We couldn’t find that file to show.
@bmuller
bmuller / config_template.rb
Created October 28, 2010 01:35
ConfigTemplate class
require 'yaml'
require 'erb'
class Struct
def get_binding
binding
end
end
class ConfigTemplate
@bmuller
bmuller / status.py
Created December 11, 2010 20:59
Python script to post to http://identi.ca
#!/usr/bin/env python
import urllib, urllib2, json, sys
username = "username"
password = "password"
def formatAtom(atom):
atom = atom.strip()
if atom.startswith('http://') or atom.startswith('https://'):
data = urllib.urlopen("http://ur.ly/new.json?href=%s" % urllib.quote(atom)).read()
@bmuller
bmuller / r.rb
Created January 3, 2011 19:05
r.rb
require 'formula'
class R <Formula
url 'http://cran.r-project.org/src/base/R-2/R-2.12.1.tar.gz'
homepage 'http://www.R-project.org/'
md5 '078e8d1179fc9a762e326e6da2725468'
depends_on 'readline'
def install
@bmuller
bmuller / DOMLight.py
Created April 23, 2011 20:04
DOMLight is a little library for making DOM's more accessable in python.
"""
DOMLight is a little library for making DOM's more accessable in python.
Copyright (C) 2011 Brian Muller <bamuller@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
@bmuller
bmuller / symbol_expressions.rb
Created May 24, 2011 23:04
Symbol Expressions Simplified
class Symbol
def |(*args)
@args = args
self
end
def to_proc
Proc.new { |obj|
obj.send *[self] + (@args || [])
}
@bmuller
bmuller / pivotalfixes.user.js
Created May 27, 2011 14:12
gresasemonkey script to show all active stories across projects on projects page
// ==UserScript==
// @name Pivtol Tracker Fixes
// @namespace userscripts.org
// @description Show all stories that have been started on the projects page
// @include https://tracker.*.com/projects
// @copyright Brian Muller
// @version 0.0.1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js
// ==/UserScript==
@bmuller
bmuller / gitconfig
Created June 23, 2011 14:03
gitconfig
[user]
email = bamuller@gmial.com
name = Brian Muller
[color]
branch = auto
diff = auto
interactive = auto
status = auto
[core]
editor = emacs
@bmuller
bmuller / execuspeak.rb
Created January 31, 2012 15:11
execuspeak detector
def detect_executive(resume)
words = resume.downcase.scan(/[a-z0-9#]+/i)
corporatespeak = { :budget => 'budget', :revenue => 'revenue', :strategy => 'strateg', :seo => 'seo', :sem => 'sem', :enable => 'enable', :service => 'service', :analytics => 'analy', :consulting => 'consult', :directing => 'direct', :enterprise => 'enterpris', :media => 'media', :empower => 'empower', :lead => 'lead', :plan => 'plan', :executive => 'executive' }
counts = {}
corporatespeak.each { |title, match|
counts[title] = words.select { |w| w.include? match }.count
}
puts "Word Counts:"
score = 0
counts.select { |k,v| v > 1 }.each { |k,v| puts "#{k}: #{v}"; score += v }
@bmuller
bmuller / twisted_web_test_utils.py
Created February 21, 2012 02:13
Twisted Web site stub
from twisted.internet.defer import succeed
from twisted.web import server
from twisted.web.test.test_web import DummyRequest
class SmartDummyRequest(DummyRequest):
def __init__(self, method, url, args=None, headers=None):
DummyRequest.__init__(self, url.split('/'))
self.method = method
self.headers.update(headers or {})