Skip to content

Instantly share code, notes, and snippets.

kwharrigan /
Created Apr 4, 2014
Starcluster plugint to install dmtcp.
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class DMTCP(ClusterSetup):
def __init__(self, url, archive_file, install_hbict, hbict_url):
self.dmtcp_url = url
self.archive_file = archive_file
self.install_hbict = install_hbict
self.hbict_url = hbict_url
kwharrigan /
Last active Mar 1, 2019
A simple script to form a multipage PDF using scanimage / sane. It is hard-coded to my MF4270 device id as provided by scanimage -L.
if [ $# -lt 1 ]
echo "Usage: <filename.pdf>"
exit 1;
kwharrigan /
Created Oct 18, 2012
Server monitoring script
from twisted.internet import task
from twisted.internet import reactor
from subprocess import Popen, PIPE, STDOUT
logfile = open('status.txt', 'a')
def runEverySecond():
output = Popen(["ssh", "user@host", "date"], stdout=PIPE, stderr=STDOUT).communicate()[0]
kwharrigan /
Created Jul 27, 2012 — forked from bollwyvl/
A Python port of Perl's Apache::AuthenMSAD
A port of Perl's Apache::AuthenMSAD
Takes advantage of Microsoft Active Directory allowing a user to be verified
with 'user@domain' instead of searching for the distinguished name.
To merge as seamlessly as possible with existing systems (i.e. SharePoint,
etc.) munge the incoming "domain\user" into "user@domain".
kwharrigan / trac.wsgi
Created May 7, 2012
trac cgi-bin deploy snippet to shorten SSL_CLIENT_S_DN_CN
View trac.wsgi
def application(environ, start_request):
common_name = environ.get('SSL_CLIENT_S_DN_CN', '')
if common_name != '':
last_first = common_name.split('=')[-1].split('.')
#username = '%s.%s' % (last_first[1],last_first[0]) # first.last
username = '%s%s' % (last_first[1][0],last_first[0]) # <first_initial>last
username = username.lower().replace(' ','-')
environ['REMOTE_USER'] = username
kwharrigan / md5_test.c
Created Apr 15, 2012
Use openssl to produce an md5 hash of a file
View md5_test.c
#include <openssl/md5.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char**argv)
FILE *fh;
long filesize;
unsigned char *buf;
kwharrigan /
Created Apr 12, 2012
MKS fast-import script for git
#Copyright (c) 2012 Kyle Harrigan
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
kwharrigan /
Created Apr 11, 2012
migrate repos to gitolite from old server...
import os
repos = [''] # list of repo names here...
for repo in repos:
print repo
shortname = repo.split('.git')[0]
os.system('git clone --bare me@oldserver:/git/%s' % repo)
kwharrigan /
Created Mar 28, 2012
Extract home folder authorized keys into multiple files...
import sys
import os
# Run this script on a linux "home" folder
def find_authkeys():
Walk home folders looking for .ssh/authorized_keys files.
If you find them, run authkeys_to_pub
kwharrigan /
Created Mar 20, 2012
Split up a single openssl authorized keys file into multiple files, suitable for gitolite
import sys
import os
filename = sys.argv[1]
fh = open(filename, 'r')
line = fh.readline()
ct = 0
while line != '':
ct += 1
You can’t perform that action at this time.