Skip to content

Instantly share code, notes, and snippets.

Steve: wtf is a gramophone
Alan: ben franklink invetned it
record player with the horn thing
Steve: dude
Alan: instead of speakers
Steve: is he like the oscar meyer version of ben franklin?
Alan: yup
Steve: awesome
does he taste like a hot god?
Alan: he was made of sausage links
@bentglasstube
bentglasstube / HexBase64.pm
Created September 16, 2012 01:14
Generate base64 to base16 look-up tables
package HexBase64;
use strict;
use warnings;
use base 'Exporter';
our @EXPORT = (qw(base64_to_hex hex_to_base64));
# lookup tables for conversion
@bentglasstube
bentglasstube / quest.pl
Created November 27, 2012 19:12
Random quest generator
#!/usr/bin/perl
use strict;
use warnings;
my %data = (
subject => [
'A <modifier> <person> named <name>',
'A <modifier> <person> named <name>',
'<title> <name>',
@bentglasstube
bentglasstube / gist:5020807
Created February 23, 2013 18:34
sunsong ranch macro
#showtooltip 3 3
/cleartarget
/tar tilled soil
/use [exists] 3 3; master plow
John Holleran: How do I do "Q1 performance (70), refueling 20, pax 20" to "(70),20,20”
It really depends on what the whole data looks like not just one line, but I'll give it a shot. I have no idea how (un)familiar you are with regular expressions so I will assume you know nothing to err on the side of overexplanation.
As a warning, these are perl regular expressions. Whatever you are using has a different (and shittier) regex engine than perl does so some things might be a little bit different for you. If you tell me what language you are using, I might know more about its particular engine. If you tell me it is something that costs money like Oracle DB regex you are on your own, sorry.
Assuming that the text is mostly the same you could do something like
^Q[1-4] performance (\(\d+\)), refueling (\d+), pax (\d+)$
@bentglasstube
bentglasstube / pinlock.tsk.xml
Last active December 18, 2015 19:39
Tasker profile to pin lock phone when not on home wifi.
<TaskerData sr="" dvi="1" tv="4.1u3m">
<Profile sr="prof6" ve="2">
<cdate>1371538376764</cdate>
<clp>true</clp>
<edate>1371851913695</edate>
<id>6</id>
<mid0>5</mid0>
<mid1>8</mid1>
<nme>Home</nme>
<State sr="con0">
use Irssi;
use strict;
use FileHandle;
use vars qw($VERSION %IRSSI);
$VERSION = "1.0";
%IRSSI = (
authors => 'Alan Berndt <[email protected]>',
name => 'auto_away',
@bentglasstube
bentglasstube / Makefile
Last active August 29, 2015 13:57
Makefile for making certificates with openssl
BITSIZE=4096
FILE=server
$(FILE).crt: $(FILE).csr
@echo "Copy and paste the following into your CA:"
@cat $(FILE).csr
@echo "Paste the certificate from your CA here (^D to finish):"
@cat >$(FILE).crt
rm $(FILE).csr
@bentglasstube
bentglasstube / pwm.sh
Created March 30, 2014 15:04
Password manager written in bash.
#!/bin/sh
FILE="$HOME/Dropbox/passwords.gpg"
quiet=""
output=""
while getopts hqo opt
do
case $opt in
q) quiet="y" ;;
BITSIZE=4096
FILE=eatabrick.org
all: $(FILE).pem $(FILE).key dhparam.pem
chown http:http $(FILE).*
chmod 600 $(FILE).key
$(FILE).pem: $(FILE).csr intermediate.pem
@echo "Copy and paste the following into your CA:"
@cat $(FILE).csr