Skip to content

Instantly share code, notes, and snippets.

View lehrblogger's full-sized avatar

Steven Lehrburger lehrblogger

View GitHub Profile
@lehrblogger
lehrblogger / logsearch.sh
Created July 19, 2011 02:26
a shell script to search my Adium logs
logdir="/Users/lehrblogger/Dropbox/sync/Adium 2.0/Users/Default/Logs"
buddy=$1
search=$2
find "$logdir"/*/"$buddy" -type f -name \*.xml -exec grep -il $search {} \;
function (key, values, rereduce) {
// value -> [count, min, max, mean]
var i = 0
, l = values.length
, min = values[i][2] // set min to the first max
, max = 0
, weighted_sum_of_means = 0
, count = 0
, cur_count // just for clarity, feel free to remove later
, cur_min
import sbt._
class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
val liftVersion = "2.3"
val rogue = "com.foursquare" %% "rogue" % "1.0.9" withSources()
// uncomment the following if you want to use the snapshot repo
// val scalatoolsSnapshot = ScalaToolsSnapshots
@lehrblogger
lehrblogger / flor.py
Created February 27, 2011 03:28
Comparison shopping on the Internet! Ordering samples of all of them was $$$, so I needed a way to annotate the alternatives and narrow it down...
import urllib2
import time
from BeautifulSoup import BeautifulSoup
f = open('/Users/lehrblogger/Desktop/flor.csv')
soup = BeautifulSoup(urllib2.urlopen('http://www.flor.com/get-samples.html?limit=all'))
for a in soup.findAll('a', 'samples-link'):
try:
href = 'http://www.flor.com' + a['href']
@lehrblogger
lehrblogger / gist:378170
Created April 25, 2010 04:43 — forked from jehiah/gist:376179
Bitly tech talk 4/22/2010
Bitly tech talk 4/22/2010
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here!
# @jehiah
# in place file regex replacement
perl -pi -e 's/this/that/g' filename_pattern
# print the last column of a file ($NF stands for 'Number of Fields' or more commonly Last Field).
<?php
$key_char = '';
$row = '';
$col = '';
$type = '';
$name = '';
$slug = '';
$text = '';
if( isset($_GET['key_char']) ) $key_char = $_GET['key_char'];
<?php
$key_char = '';
$row = '';
$col = '';
$type = '';
$name = '';
$slug = '';
$text = '';
if( isset($_GET['key_char']) ) $key_char = $_GET['key_char'];
<?php
require('keyboardLogin.php');
// show all errors
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
error_reporting( E_ALL );
dbConnect();
$query = "SELECT * from keyboard.keys"