Skip to content

Instantly share code, notes, and snippets.

bash-3.2$ make
Making all in faq
make[1]: Nothing to be done for `all'.
Making all in icons
make[1]: Nothing to be done for `all'.
Making all in interpreter
./config-images.sh ../..
../../doc/interpreter/images.mk is unchanged
../../run-octave -f -q -H ./mk_doc_cache.m doc-cache ../../scripts/DOCSTRINGS ../../src/DOCSTRINGS || { rm -f doc-cache; exit 1; }
dyld: Symbol not found: _amd_calloc
@kwharrigan
kwharrigan / fix_crlf.sh
Created October 13, 2011 16:04
Example of fixing crlf on a subset of commits using git-filter-branch
#!/bin/bash
all2dos()
{
find * -exec dos2unix {} \;
}
export -f all2dos
git filter-branch -f --tree-filter 'all2dos' HEAD ^master
@kwharrigan
kwharrigan / excerpt_from_mount.log
Created October 14, 2011 09:40
s3 mount error
2011-10-13 21:47:44.567 [2006] MainThread: [root] Uncaught top-level exception
Traceback (most recent call last):
File "/usr/bin/mount.s3ql", line 9, in <module>
load_entry_point('s3ql==1.4', 'console_scripts', 'mount.s3ql')()
File "/usr/lib/pymodules/python2.6/s3ql/cli/mount.py", line 84, in main
bucket_factory = get_bucket_factory(options)
File "/usr/lib/pymodules/python2.6/s3ql/backends/common.py", line 1144, in get_bucket_factory
bucket = bucket_class(bucket_name, backend_login, backend_pw)
File "/usr/lib/pymodules/python2.6/s3ql/backends/s3.py", line 57, in __init__
self._init()
@kwharrigan
kwharrigan / split_authorizedkeys.py
Created March 20, 2012 20:24
Split up a single openssl authorized keys file into multiple files, suitable for gitolite
#!/bin/python
import sys
import os
filename = sys.argv[1]
fh = open(filename, 'r')
line = fh.readline()
ct = 0
while line != '':
ct += 1
@kwharrigan
kwharrigan / harvest_keys.py
Created March 28, 2012 14:40
Extract home folder authorized keys into multiple files...
#!/usr/bin/python
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
kwharrigan / migrate.py
Created April 11, 2012 21:17
migrate repos to gitolite from old server...
#!/bin/python
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)
os.chdir(repo)
@kwharrigan
kwharrigan / mks_git_checkpoints.py
Created April 12, 2012 16:50
MKS fast-import script for git
#!/usr/bin/python
#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
kwharrigan / md5_test.c
Created April 15, 2012 03:22
Use openssl to produce an md5 hash of a file
#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
kwharrigan / trac.wsgi
Created May 7, 2012 20:55
trac cgi-bin deploy snippet to shorten SSL_CLIENT_S_DN_CN
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
kwharrigan / authen_msad.py
Created July 27, 2012 20:41 — forked from bollwyvl/authen_msad.py
A Python port of Perl's Apache::AuthenMSAD
"""
authen_msad
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".