Skip to content

Instantly share code, notes, and snippets.

View drench's full-sized avatar

Daniel Rench drench

View GitHub Profile
@drench
drench / nucore-merge-describer.sh
Created January 17, 2017 20:35
This generate a list of PR merges between `develop` and the current branch in markdown, suitable for pasting into a PR
#!/bin/sh
git log develop.. | egrep '\(#\d+\)$' | while read LINE; do
pr=$(echo $LINE | sed -E 's/^.+\(#//' | sed -E 's/\)$//')
desc=$(echo $LINE | sed -E 's/ *\(#[0-9]+\)$//')
echo "$pr\t$desc"
done | sort -n |
while read LINE; do
pr=$(echo $LINE | cut -d' ' -f1)

Keybase proof

I hereby claim:

  • I am drench on github.
  • I am drench (https://keybase.io/drench) on keybase.
  • I have a public key whose fingerprint is CCD6 A1F2 12FC 8166 C7F3 F4D3 B250 C47C E31B B020

To claim this, I am signing this object:

# db/migrate/20120625030355_add_deleted_at_to_user.rb
class AddDeletedAtToUser < ActiveRecord::Migration
def change
add_column :users, :deleted_at, :datetime
end
end
@drench
drench / gist:5972614
Last active October 3, 2021 18:14
Use this if your Amazon wishlist has mysterious items that are unhelpfully "no longer available". While on the offending wish list page, open your browser debugger console and run this to get a list of IDs for the "no longer available" items. Paste them in to Google and there's a very good chance you'll find out what that item was.
(function () {
let result = document.evaluate('//span[contains(text(), "is no longer available")]', document.body);
let node = null;
while (node = result.iterateNext()) { console.log(node.id.replace(/^itemName_/, '')) }
})();
@drench
drench / git-rest
Created March 23, 2012 16:57
git-rest
#!/bin/sh
case "$1" in
put)
hash=`git hash-object -w --stdin`
if [ -z $2 ]; then
echo $hash
else
git tag $2 $hash
fi
@drench
drench / gist:1322405
Created October 28, 2011 14:32
Reverse lines in a file
perl -pe '$_ = ++$x."\t$_"' | sort -nr | cut -f2-
@drench
drench / gist:1224343
Created September 17, 2011 20:37
webvi bookmarklet
<p><a href="http://news.ycombinator.com/item?id=3007879">web vi discussion on HN</a></p>
<a href="javascript:(function(){var d=document;var t=d.getElementsByTagName('textarea');for(var i in t){if(typeof t[i]=='object') t[i].setAttribute('class','webvi');} var s=d.createElement('script');s.src='http://webvi.googlecode.com/svn/trunk/lib/webvi.js';s.onload=function(){webvi_init();};d.body.appendChild(s);})();">webvi</a>
@drench
drench / necho
Created August 13, 2011 05:32
necho(): attempt echoing without a newline, under any common shell
necho() {
echo -n "$*"
}
if [ -s "$BASH" ]; then
e=`necho A; echo B`
if [ "$e" != "AB" ]; then
shopt -s xpg_echo
@drench
drench / gist:1105113
Created July 25, 2011 20:29
Above.Net traceroute
% traceroute 208.109.254.176
traceroute to 208.109.254.176 (208.109.254.176), 64 hops max, 52 byte packets
1 dd-wrt (192.168.1.1) 2.162 ms 3.705 ms 16.959 ms
2 c-67-167-224-1.hsd1.il.comcast.net (67.167.224.1) 46.980 ms 38.692 ms 51.518 ms
3 te-2-3-ur08.mtprospect.il.chicago.comcast.net (68.85.131.193) 17.670 ms 20.240 ms 14.270 ms
4 68.86.187.197 (68.86.187.197) 19.514 ms 19.109 ms 25.049 ms
5 pos-3-5-0-0-cr01.350ecermak.il.ibone.comcast.net (68.86.95.237) 18.499 ms 40.868 ms 17.846 ms
6 pos-1-2-0-0-pe01.350ecermak.il.ibone.comcast.net (68.86.86.78) 20.950 ms 32.143 ms 30.656 ms
7 66.208.229.254 (66.208.229.254) 61.138 ms 46.967 ms 55.414 ms
8 xe-2-1-0.cr2.ord2.us.above.net (64.125.26.253) 102.158 ms 64.158 ms 58.034 ms
@drench
drench / ipod2json
Created July 22, 2011 04:18
reads the iTunesDB from an iPod and converts (most of it) to JSON
#!/usr/bin/env python
import gpod
import json
import sys
ipodpath = sys.argv[1]
itdb = gpod.itdb_parse(ipodpath, None)