Skip to content

Instantly share code, notes, and snippets.

View arodland's full-sized avatar

Andrew Rodland arodland

View GitHub Profile
#!/bin/bash
# display commands and their arguments as they are executed
set -x
WEEK=$(date +%-V)
if [ $[ $WEEK % 2 ] -ne 1 ]; then
exit 0
fi
### Keybase proof
I hereby claim:
* I am arodland on github.
* I am arodland (https://keybase.io/arodland) on keybase.
* I have a public key whose fingerprint is DF5C D13A 67B6 218A BE70 0F05 EB17 696A E94B 2C55
To claim this, I am signing this object:
@arodland
arodland / gist:a1a9a97bfcbb9ea8c440
Created September 12, 2014 23:05
Prologix USB - Ethernet emulator
#!/usr/bin/perl
use strict;
use warnings;
use IO::Async::Loop;
use IO::Async::Stream;
use IO::Async::Socket;
use IO::Async::Listener;
use IO::Socket::INET;
use Socket;
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index 7c8a72c..520dfd4 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -10,7 +10,7 @@
package Data::Dumper;
BEGIN {
- $VERSION = '2.151'; # Don't forget to set version and release
+ $VERSION = '2.154'; # Don't forget to set version and release
diff --git a/arch/arm/mach-mx6/board-mx6_seco_UDOO.c b/arch/arm/mach-mx6/board-mx6_seco_UDOO.c
index 435a50d..7689c7d 100644
--- a/arch/arm/mach-mx6/board-mx6_seco_UDOO.c
+++ b/arch/arm/mach-mx6/board-mx6_seco_UDOO.c
@@ -46,6 +46,7 @@
#include <linux/fec.h>
#include <linux/memblock.h>
#include <linux/gpio.h>
+#include <linux/pps-gpio.h>
#include <linux/etherdevice.h>
@arodland
arodland / gist:e7f6a2704948d43dc914
Created November 5, 2014 19:50
Flask per-route statsd magic
@app.before_request
def statsd_start():
startTime = time.time()
endpoint = request.endpoint
if endpoint:
@flask.after_this_request
def statsd_finish(response):
endTime = time.time()
duration = endTime - startTime
status = response.status_code
*Q = *pQuery;
print Dumper map [
sort { $b->{ratio} <=> $a->{ratio} }
map {
@h{qw(s a)} = map
$_->getAttribute("title") =~ /(\d+)/,
@{ Q($_)->find("td span") };
$h{u} = Q($_)->find(".user-details a")->text;
$h{ratio} = $h{s}/$h{a};
+{%h};
$ perl -MBenchmark=cmpthese -mPOSIX -e 'cmpthese(-3, { backticks => sub { my $date = `date +%Y%m%d` }, strftime => sub { my $date = POSIX::strftime("%Y%m%d", localtime()) } })'
Rate backticks strftime
backticks 1169/s -- -100%
strftime 321983/s 27450% --
# make sure we're up to date to begin with
git remote update --prune
echo Archiving branches that have been merged into master for 2 weeks...
MASTER2WEEKS=$(git rev-list -n 1 --before='2 weeks ago' origin/master)
OLDBRANCHES=$(git branch -r --merged "$MASTER2WEEKS" | sed 's/\s*origin\///')
echo "$OLDBRANCHES"
@arodland
arodland / length-prefixed.pl
Created January 19, 2015 04:43
Working parser for a simple length-prefixed language
#!/usr/bin/perl
use strict;
use warnings;
use Marpa::R2;
use Data::Dumper;
# array: 'A' count ':' element+
# string: 'S' length ':' byte+
# element: array | string