Skip to content

Instantly share code, notes, and snippets.

View williamsjj's full-sized avatar

Jason J. W. Williams williamsjj

View GitHub Profile
*snip*
Install Phase ... Done
Reading Existing Index ... Done
Indexing Packages ... Done
Download: SUNWcsd ... Done
Install Phase ... Done
Reading Existing Index ... Done
Indexing Packages ... Done
Download: SUNWcs ... Done
*snip*
Install Phase ... Done
Reading Existin Index ... Done
Indexing Packages ... Done
Download: SUNWcsd ... Done
Install Phase ... Done
Reading Existing Inex ... Done
Indexing Packages ... Done
Download: SUNWcs ... Done
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# Add this to your PS1 as appropriate
"\[\033[1;31m\] $(parse_git_branch)"
import time
from traceback import extract_stack, format_list
def wrap_func(base_class):
def check_func(f):
old_func_name = 'old%s' % (f.__name__,)
if hasattr(base_class, f.__name__):
setattr(base_class, old_func_name,
getattr(base_class, f.__name__))
def new_func(*args, **kwargs):
Received: from localhost ([::1] helo=s0.nanog.org)
by s0.nanog.org with esmtp (Exim 4.68 (FreeBSD))
(envelope-from <nanog-bounces@nanog.org>)
id 1N2xH0-0009Q3-Or; Wed, 28 Oct 2009 01:24:26 +0000
Received: from unobtainium.braintrust.co.nz ([123.100.101.131])
by s0.nanog.org with esmtp (Exim 4.68 (FreeBSD))
(envelope-from <nanog@daork.net>) id 1N2xFA-0007Rr-2A
for nanog@nanog.org; Wed, 28 Oct 2009 01:22:32 +0000
Received: from [192.168.0.11] (unknown [121.98.191.176])
by unobtainium.braintrust.co.nz (Postfix) with ESMTP id 18FBC2786D
def all_same(*args):
for arg in args:
if args[0] != arg:
return False
return True
def return_bools(class_obj):
bools_array = []
for attr in class_obj.__dict__.iteritems():
if type(attr[1]) == type(bool()):
bools_array.append(attr[1])
return bools_array
Declare firstQuery Cursor for
SELECT [id]
FROM TableName
for Read Only;
Declare @myid int;
Open firstQuery;
Fetch Next from firstQuery Into @myid;
def rotate(self):
"""
Rotate the file and create a new one.
If it's not possible to open new logfile, this will fail silently,
and continue logging to old logfile.
"""
if not (os.access(self.directory, os.W_OK) and os.access(self.path, os.W_OK)):
return
logs = self.listLogs()
def rotate(self):
"""
Rotate the file and create a new one.
If it's not possible to open new logfile, this will fail silently,
and continue logging to old logfile.
"""
def rotateOldLogs():
"""