Skip to content

Instantly share code, notes, and snippets.

@tijn
tijn / date_from_string.rb
Last active January 1, 2016 16:49
Trying to help Arjan
# this script proves that no matter how many bytes you leave out of the original string it won't result in a valid date that is in the specified range (within one year)
string = "\x04\x02R\xA6a\xC4M"
bytes = string.unpack("C*")
MIN = Time.new(2013,1,1)
MAX = Time.new(2013,12,31)
# equivalent to:
# string.bytes
@tijn
tijn / autostart.sh
Created October 24, 2014 09:05
pi-kiosk
chromium --incognito --kiosk --disable-translate http://status-manager.herokuapp.com/?id=`rpi-id`
@tijn
tijn / rpi-id
Last active February 3, 2016 14:06
raspberry-pi ID
#!/bin/sh
cat /proc/cpuinfo | grep Serial | sha256sum | cut -f1 -d' '
@tijn
tijn / dd-fast
Created October 24, 2014 11:10
OS X write a disk image faster with dd
sudo dd if=raspberrypi.dmg of=/dev/rdisk2 bs=1m
@tijn
tijn / bitbucket-sort-pr-by-nr.user.js
Last active December 10, 2015 11:00
Sort pull requests by number
// ==UserScript==
// @name Bitbucket: sort pull requests by number
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Sort pull requests by number
// @author Victor Yap, changes by Tijn Schuurmans
// @match https://bitbucket.org/*/*/pull-requests/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@tijn
tijn / git-scrub
Created January 4, 2017 21:18
remove merged branches; could be generalized and cleaned up but it's already useful in its current form
#!/usr/bin/env ruby
if ARGV.include? '--help'
puts "git-scrub"
puts
puts "Remove all merged and stale branches."
puts
puts " merged = merged into master (the command will only run on the master branch)"
puts " stale = removed from the remote"
exit 0
@tijn
tijn / install-ruby-shim.rb
Last active August 8, 2019 08:51
install-ruby-shim
#!/usr/bin/env ruby
require 'erb'
require 'optparse'
require 'pathname'
PROJECT_ROOT_FILES = %w(.ruby-version Gemfile .env)
$verbose = false
$force = false
$dry_run = false