Skip to content

Instantly share code, notes, and snippets.

View ehabkost's full-sized avatar

Eduardo Habkost ehabkost

View GitHub Profile
import re, sys
fieldre = re.compile(r'^ *\.([a-z0-9_]+) *= *(.*?),? *([^,]*?)\n', re.M)
def fixmachine(m):
print >>sys.stderr,"whole: %r" % (m.group(0))
name = m.group(2)
if name.endswith('_machine'):
name = name[:-len('_machine')]
fields = m.group(4)
print >>sys.stderr,"fields: %r" % (fields)
@ehabkost
ehabkost / gist:3061695
Created July 6, 2012 18:05 — forked from melissaboiko/crep
simple script to color matching lines (like grep --color, but also prints non-matching lines)
#!/bin/bash
pname="$(basename $0)"
function usage()
{
echo "Usage: $pname [OPTIONS] PATTERN [FILES and/or GREP_OPTIONS...]
Colorize all matches for PATTERN, an extended regular expression.
Non-matching lines are still printed.
@ehabkost
ehabkost / NSDictionary+QueryStringBuilder.h
Created October 12, 2011 16:19 — forked from mramsden/NSDictionary+QueryStringBuilder.h
Creating a query string from an NSDictionary.
#import <Foundation/Foundation.h>
@interface NSDictionary (QueryStringBuilder)
- (NSString *)queryString;
@end