Skip to content

Instantly share code, notes, and snippets.

@tjdett
tjdett / trac2md.rb
Created November 24, 2011 07:02
Convert Trac wiki syntax to Markdown
#!/usr/bin/env ruby
# Based on: https://gist.github.com/619537
body = STDIN.read
body.gsub!(/\{\{\{([^\n]+?)\}\}\}/, '`\1`')
body.gsub!(/\{\{\{(.+?)\}\}\}/m){|m| m.each_line.map{|x| "\t#{x}".gsub(/[\{\}]{3}/,'')}.join}
body.gsub!(/\=\=\=\=\s(.+?)\s\=\=\=\=/, '### \1')
body.gsub!(/\=\=\=\s(.+?)\s\=\=\=/, '## \1')
body.gsub!(/\=\=\s(.+?)\s\=\=/, '# \1')
#!/bin/bash
for i in {1..8}
do
openssl dgst -d -dss1 -sign elise_private_key.pem -out s800000${i}_signature.pem s800000${i}_digest.txt &&
openssl base64 -in s800000${i}_signature.pem -out s800000${i}_signature_base64.pem
done
@tjdett
tjdett / checkout_coretardis.sh
Created November 30, 2011 23:47
Scripts to checkout MyTardis and contrib apps
#!/bin/bash
# MyTardis read-only (CoreTardis branch)
git clone git://github.com/mytardis/mytardis.git -b coretardis mytardis
# Checkout plugins
mkdir apps
git clone git://github.com/mytardis/hpctardis.git -b coretardis apps/hpctardis
git clone git://github.com/mytardis/microtardis.git -b coretardis apps/microtardis
@tjdett
tjdett / example_file_monitoring.sh
Created December 21, 2011 00:52
Util for testing - prints green for 0 exit status, otherwise red
#!/bin/sh
while (true)
do
inotifywait -r -e close_write tardis/apps
red_green.sh bin/django test --settings=tardis.test_settings --failfast --tests='tardis.apps.oaipmh.tests.test_oai'
done
@tjdett
tjdett / attach_coretardis_to_mytardis.sh
Created January 6, 2012 05:13
Migrate CoreTardis into MyTardis branch
#!/bin/bash
# NOTE: You can specify alternate locations environment variables
CORETARDIS_REPO=${CORETARDIS_REPO:-'https://github.com/aaryani/CoreTardis.git'}
MYTARDIS_REPO=${MYTARDIS_REPO:-'git://github.com/mytardis/mytardis.git'}
# Fork commit
FORK_BASE='9445c33ab383940fb4da556ff69fc21e5983ebdf'
# commit 9445c33ab383940fb4da556ff69fc21e5983ebdf
# Author: Ryan Braganza <ryan.braganza@gmail.com>
<?php
/*
* Static Class to handle getting information from the request better
*
* @author D.Holborow
* @version 1.0 2006/04/03
*
*/
class Request {
//--------------------------------------------------------------------------
@tjdett
tjdett / Procfile
Created January 31, 2012 01:43
Test case for Foreman Issue #97
test: ./test.sh $PORT
@tjdett
tjdett / reload_usb.sh
Created May 24, 2012 05:04
Reloading USB controller in Fedora 17
# used to fix "unable to enumerate USB device on port"
lspci
# Replace "xx.x" with the controller to unload
echo -n "0000:00:xx.x" > /sys/bus/pci/drivers/ehci_hcd/unbind
echo -n "0000:00:xx.x" > /sys/bus/pci/drivers/ehci_hcd/bind
@tjdett
tjdett / bottom-right.js
Created May 31, 2012 00:16
Bottom-right pusher
// Works, but has odd side-effects with complex content
var handlePullBottomRight = function() {
_.chain($(".pull-bottom.pull-right"))
.map(function(v) { return $(v).parent(); })
.uniq()
.each(function(v) {
var pusher = $('<div></div>').addClass('pusher pull-right')
.css('width','0px');
var items = $(v).find(".pull-bottom.pull-right");
@tjdett
tjdett / postgres_and_identd.markdown
Created August 28, 2012 00:04
Postgres and Identd on Fedora 17 - HOW-TO

Why?

Most commonly because you'd like to use JDBC to connect to your local Postgres server without using password auth. Very quickly you'll realise Unix sockets aren't supported in Java, so you can't use peer authentication.

How?

First, ensure your /var/lib/pgsql/pg_hba.conf uses ident for TCP/IP connections:

# IPv4 local connections:
host    all             all             127.0.0.1/32            ident