Skip to content

Instantly share code, notes, and snippets.

View bhallstein's full-sized avatar
🌳
/|\ ^._.^ /|\

Benjamin Hall bhallstein

🌳
/|\ ^._.^ /|\
View GitHub Profile
@bhallstein
bhallstein / file_lines_over_time.rb
Created November 21, 2017 12:36
Output lines of code in a file over a git repo's history
require 'date'
if ARGV.count != 1
puts "Need file argument!"
exit
end
filename = ARGV[0]
i = 0
@bhallstein
bhallstein / gpx_reduce.rb
Created September 5, 2016 09:29
Reduce the number of waypoints in a GPX file
#!/usr/bin/env ruby
require 'nokogiri'
require 'Date'
require 'Time'
if (ARGV.count != 2)
puts "usage:"
puts " gpx_reduce.rb file_name number_of_reductions"
puts "e.g. to reduce the number of waypoints to one third:"
puts " gpx_reduce.rb my_file.gpx 3"
@bhallstein
bhallstein / lexy_sort.cpp
Last active August 29, 2015 14:21
Lexy Sort
/*
* lexy_sort - Lexical sorting for files, keys etc.
* - NB Fails badly with long numeric components, due to reliance on sscanf+int64
*
* Compile: clang++ lexy_sort.cpp -std=c++11 -o lexy
*
* Example: bh$ lexy monkeys1n11 monke1n2 monke10n2 monke10n100 monke10n10
* => monke1n2
* monke10n2
* monke10n10