Skip to content

Instantly share code, notes, and snippets.

View timabell's full-sized avatar
🍵
418 I'm a teapot

Tim Abell timabell

🍵
418 I'm a teapot
View GitHub Profile
#!/usr/bin/python
# https://timwise.co.uk/2014/02/03/converting-kml-to-gpx-with-python/
# https://gist.github.com/timabell/8791116
import argparse
import xml.sax
parser = argparse.ArgumentParser(description='Convert annoying google android my tracks kml data to sensible gpx files')
parser.add_argument('input_file')
#!/bin/bash
# http://blog.nguyenvq.com/blog/2011/09/13/remote-unlocking-luks-encrypted-lvm-using-dropbear-ssh-in-ubuntu/
host=pink
timeout=35
echo "ssh'ing to $host to unlock luks. Wait $timeout secs for password prompt"
ssh -o "UserKnownHostsFile=~/.ssh/known-initram" root@$host << EOF
pid=\`ps | grep "/scripts/local-top/cryptroot" | grep -v "grep" | cut -d " " -f 3\`
echo "Found pid(s) of cryptroot: \$pid"
kill -9 \$pid
echo "Waiting $timeout secs for wait-for-root script to time out..."
# error running npm for tutorial
# http://docs.angularjs.org/tutorial
# fix: https://github.com/angular/angular-phonecat/pull/129
tim@sammy:~/repo/angular-phonecat(7fd0846...)
$ npm install
npm ERR! peerinvalid The package karma-requirejs does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer karma@0.10.10 wants karma-requirejs@~0.2.0
npm ERR! System Linux 3.11.0-17-generic
@timabell
timabell / README.md
Last active August 29, 2015 13:59 — forked from mbostock/.block

Run like so:

node gist-clone-all.js username

You'll want to replace "username" with your own username.

This script clones using the push URL, so you should probably be the owner of the gists. You could also use this to clone someone else's gists, but in that case you may wish to edit the code to use gist_pull_url instead.

using System;
class puke{
static void Main(string[] args) {
try {
ThrowException1();
} catch (Exception x) {
Console.WriteLine("Exception 1:");
Console.WriteLine(x);
}
@timabell
timabell / SqlExceptionMocker.cs
Created May 30, 2014 21:32
Workaround completely test-unfriendly sql error classes
using System.Data.SqlClient;
using System.Reflection;
namespace HorribleThingsInHere
{
/// <summary>
/// Workaround completely test-unfriendly sql error classes.
/// Copy-paste from http://stackoverflow.com/a/1387030/10245
/// Adjusted with updates in comments
/// </summary>
@timabell
timabell / rsnapshot-backup.sh
Created September 1, 2014 19:46
rsnapshot anacron script
#!/bin/sh
# to be called from anacron.
# first arg is name of backup set to run
if [ ! -d /backup/ ]; then
echo "ERROR: backup disk not mounted at /backup/, aborting"
exit 1
fi
/usr/bin/rsnapshot $1
echo "rsnapshot $1 done"
@timabell
timabell / tidy-insert-sql.pl
Last active August 29, 2015 14:08
takes generated SQL for INSERTing records en masse and strips repetition of column names
#!/usr/bin/perl
# https://gist.github.com/timabell/94b55a12db4c6ee42e10
# takes generated SQL for INSERTing records en masse and strips repetition of column names
# modern sql server accepts multiple rows separated by commas in one insert block
# before
# INSERT (x,y,z) VALUES (1,2,3)
# INSERT (x,y,z) VALUES (1,2,3)
# INSERT (x,y,z) VALUES (1,2,3)
@timabell
timabell / git-fire
Last active August 29, 2015 14:11
git-tfs scripts
#!/bin/sh -v
git branch -D fire 2>&1 > /dev/null
git branch fire
time git tfs rcheckin
git branch -D fired 2>&1 > /dev/null
git branch fired
git poll
@timabell
timabell / get-forks.js
Last active August 7, 2018 07:46
#abandonded# add remotes to a git repository for all the forks on github. not as good as https://github.com/frost-nzcr4/find_forks
#!/usr/bin/env node
console.log('use https://github.com/frost-nzcr4/find_forks instead')
process.exit()
// copy of clone-all-gists modified to get all forks of a repo
// https://gist.github.com/timabell/fae531441e30d42f8b6c
var fs = require("fs");
var https = require("https");
// var exec = require("child_process").exec;