This file contains hidden or 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
# remove CVS ignored files | |
for x in `find . -name ".cvsignore"`; do for i in `cat $x`; do echo $(dirname $x)/$i; done; done | xargs rm -rf |
This file contains hidden or 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
# Apple script | |
# from http://www.macosxhints.com/article.php?story=20070525090946356 | |
set talkTRIES to 0 | |
set TRYCOUNT to 250 | |
# you might need to run sudo touch /private/var/db/.AccessibilityAPIEnabled | |
# to enable Accessibility API for AppleScript | |
tell application "System Preferences" |
This file contains hidden or 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 . -name '*.txt' | grep surefire | xargs grep "Time elapsed: $REGEX" | sed -e 's%^./\([^/]*\)/target/surefire-reports/%\1 => %' -e 's/.txt://' -e 's/\(.*\)Tests run.*Time elapsed:\(.*\)/\2 => \1/' | sort -r | awk '{sum+= $1 } {if ($1 >= 1) slow+= $1} {if ($1 >= 1) print $0} END {print "\nTotal time in slow tests = " slow " sec"} END {print "Total time in all tests = " sum " sec"} END {print "Ratio = " slow/sum};' |
This file contains hidden or 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
# tzdate - helper functions for using timezones from dateutil. utcnow and localnow. | |
import datetime | |
from dateutil import tz | |
UTC_TZ = tz.gettz('UTC') | |
LOCAL_TZ = tz.gettz() | |
def utcnow(): | |
return datetime.datetime.now(UTC_TZ) |
This file contains hidden or 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
# saner syntax for optparse add_option | |
import os | |
def make_option_maker(parser, cmdline_prefix="", env_prefix="", dest_prefix=""): | |
"""Return a function that can be used to add_option with saner syntax. | |
Arguments: | |
parser: the parser object that will be used by the returned function | |
cmdline_prefix: will be used together with the name to build the command |
This file contains hidden or 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
require("clicks-in-new-buffer.js"); | |
clicks_in_new_buffer_target = OPEN_NEW_WINDOW; | |
url_completion_use_history = true; | |
url_completion_use_bookmarks = false; | |
can_kill_last_buffer = false; | |
download_buffer_automatic_open_target = OPEN_NEW_BUFFER_BACKGROUND; | |
interactive("instapaper", "Add current page to instapaper", | |
function(I) { |
This file contains hidden or 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
import os, sys | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEBase import MIMEBase | |
from email.MIMEText import MIMEText | |
from email.Utils import formatdate | |
from email import Encoders | |
SMTP_SERVER='localhost' |
This file contains hidden or 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
#one-liner awk 'NR == 1 {lastfield = $1; matchline = $0; count = 1; next} {if (lastfield != $1) {print count " " matchline; count = 0; matchline=$0; } count += 1; lastfield = $1} END {print count " " matchline}' inp.txt | |
NR == 1 { | |
lastfield = $1; | |
matchline = $0; | |
count = 1; | |
next | |
} | |
{ |
This file contains hidden or 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
import base64 | |
from hashlib import sha1, md5 | |
import re | |
from pyasn1.codec.ber import encoder | |
from pyasn1.type.univ import * | |
def rsa_key_to_der(key): | |
seq = Sequence() |