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
def self.initialize(opts) | |
opts.each do |k,v| | |
instance_variable_set("@#{k}",v) | |
eigenclass = class<<self; self; end | |
eigenclass.class_eval do | |
attr_accessor k | |
end | |
end | |
end |
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
#!/usr/bin/env perl -w | |
use strict; | |
use Data::Dumper qw(Dumper); | |
sub _right_split { | |
my ( $strstr, $delim, $ary ) = @_; | |
$ary ||= []; | |
return $ary unless $strstr; | |
my $rindex = rindex( $strstr, $delim ) or return $ary; |
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
# added year to SYSLOGTIMESTAMP | |
SYSLOGTIMESTAMPYEAR %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} | |
SYSLOGBACKFILLYEAR %{SYSLOGTIMESTAMPYEAR:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{PROG:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message} |
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
#!/usr/bin/env python | |
import sys | |
from os.path import basename, dirname | |
from re import compile as regxcomp | |
from re import match as regxmat | |
INIT_BNAME = regxcomp('__init__.py') | |
def try_import(module_name): |
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
def mock_stack(func): | |
@mock.patch.object(FooObject, 'method') | |
@mock.patch('some.module') | |
@functools.wraps(func) | |
def wrapped_func(*args, **kwargs): | |
return func(*args, **kwargs) | |
return wrapped_func |
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
#!/bin/bash | |
# use the current date | |
curr_date=`date +%Y-%m-%d` | |
clang_home=~/github/llvm_${curr_date} | |
# exit on any error | |
set -e | |
mkdir ${clang_home} |
OlderNewer