This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE=$(cd "$(dirname "$0")" && pwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2236 13:08:37 ~ % brew doctor | |
Your OS X is ripe for brewing. | |
Any troubles you may be experiencing are likely purely psychosomatic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Do bit rotations. x is the data to rotate, c is the number of bits to rotate */ | |
#define ROTATE_R(x,c) (x) = ((x) >> c) | ((x) << (sizeof(x) - c)) | |
#define ROTATE_L(x,c) (x) = ((x) << c) | ((x) >> (sizeof(x) - c)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch --set-upstream foo upstream/foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command | while read x; do [some stuff on $x]; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a unique temporary direction | |
// This procedure is safe from a number of potential problems including | |
// concurrency, file permission, security, and persistence issues | |
// Taken from http://cocoawithlove.com/2009/07/temporary-files-and-folders-in-cocoa.html | |
NSString *tmpdirTemplate = [NSTemporaryDirectory() | |
stringByAppendingPathComponent:@"app.XXXXXX"]; | |
const char *tmpdirTemplateCStr = [tmpdirTemplate fileSystemRepresentation]; | |
char *tmpdirCStr = (char *) malloc(strlen(tmpdirTemplateCStr) + 1); | |
strcpy(tmpdirCStr, tmpdirTemplateCStr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$module = 'name.of.module' | |
Get-Command | Where { $_.ModuleName -Eq $module } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -maxdepth 1 -type d -print | sed '/^.$/d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loghandler = logging.StreamHandler(sys.stdout) | |
loghandler.setFormatter(logging.Formatter( | |
fmt='%(asctime)s:%(name)s:%(levelname)s: %(message)s', | |
datefmt='%Y-%m-%d %H:%M:%S')) | |
rootlog = logging.getLogger() | |
rootlog.addHandler(loghandler) | |
rootlog.setLevel(logging.DEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import StringIO | |
from xml.etree.ElementTree import ElementTree, Element, parse, ParseError | |
class XMLDict(dict): | |
'''A dictionary-like object to represent XML data.''' | |
def __init__(self, xml=None): | |
'''Expects a string containing XML data.''' | |
try: | |
self.populate(parse(StringIO(unicode(xml))).getroot()) |
OlderNewer