Skip to content

Instantly share code, notes, and snippets.

You put the stack trace into my logs
You send the load sky-high when the server starts
Hiesenbug killin’ my brain
My fingers bang on the keyboard ‘till my head does the same
The debugger ain’t helping
This code just ain’t right
Stack overflow says
I should call it a night
Finished with my language 'cause it didn't fit in with my mind
People think I'm insane because I am coding all the time
All day long I hack on Go but nothing seems to satisfy
I'll refactor one more time to avoid dreaded DRY
Can you help me?
Perl just fits my brain!
Oh, yeah
@hercynium
hercynium / ssl-cert-saver.sh
Last active August 29, 2015 14:12
script to save SSL/TLS certs to files
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
host="$1"
port="$2"
starttls_prot="${3:-}" # xmpp, smtp, pop3, imap, or ftp (optional)
@hercynium
hercynium / opt-perl.spec
Created December 8, 2013 23:40
RPM .spec file for building a specific version of perl to install under /opt
#!/bin/bash
#
# This is a simple script to allow someone on an RPM-based
# system to build the custom opt-perl package defined by
# the RPM specfile in this same directory.
#
# @author: Stephen R. Scaffidi <sscaffidi@tripadvisor.com>
# @date: Oct. 2012
#
@hercynium
hercynium / bash-getopt-example.sh
Created November 16, 2012 17:34
declarative getopt in bash
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
source /bath/to/bash-getopt
foo_dflt="wibble"
bash-getopt "$@" <<END_OPTS
@hercynium
hercynium / gist:3908427
Created October 17, 2012 21:39
Some insane bash that might end up useful in the future
#!/bin/bash
#
# Summary:
# This script will set up your environment et al so you can run the Hive
# Query Tool. This script is intended to be sourced, but can be run without
# sourcing. The /path/to/perl argument(s) are optional.
#
# Usage:
# source setup-hqt [/path/to/perl /path/to/other/perl ...]
# setup-hqt [/path/to/perl /path/to/other/perl ...]
@hercynium
hercynium / relpath.bash
Created October 16, 2012 13:51 — forked from netj/relpath
A Bash script providing a command for computing relative path between two filesystem paths
#!/bin/bash
# relpath -- Compute relative path from a given DIR to given PATHs
# Usage: relpath DIR PATH...
#
# Example: relpath /a/b/c /a/d/e/f
# prints: ../../d/e/f
#
# Example: relpath /a/b/c /
# prints: ../../../
#
@hercynium
hercynium / Foo.pm
Created August 28, 2012 19:29
I am a terrible, horrible person
use feature ':5.10.0';
package Foo;
use Text::Template;
# needs to be in scope for Text::Template's processing
my %data;
sub get_metadata {
my ($tmpl) = @_;
return Bar::get_metadata($tmpl);
@hercynium
hercynium / resize-rrds.sh
Created August 10, 2012 13:14
create a new rrd with data from an old one and different RRA & step & heartbeat parameters
#!/bin/bash
set -e
tar czf rrds.tar.gz rrds/
find rrds/ -name '*.rrd' \
| xargs -P8 -I{} bash -c '
set -e
echo "{}"
./rrd-clone.pl "{}" "{}.new"
@hercynium
hercynium / anyevent_ev_fork_test.t
Created December 20, 2010 19:12
test destroying and re-initializing an EV loop in a forked child
#!/usr/bin/env perl
use strict;
use warnings;
use English qw( -no_match_vars );
use Data::Dumper;
use EV;
use AnyEvent;
use AnyEvent::Strict;