Skip to content

Instantly share code, notes, and snippets.

View jbarrett's full-sized avatar
🤘
Be excellent to each other

John Barrett jbarrett

🤘
Be excellent to each other
View GitHub Profile
@jbarrett
jbarrett / chmayor.pl
Created March 18, 2013 20:38
First pass at a script to change the mayor and organisation name in SimCity 2000 for DOS
#!/usr/bin/env perl
# Change the mayor's name in SimCity 2000
#
# You should probably stick with plain ASCII if you use it.
use strict;
use warnings;
use bytes;
@jbarrett
jbarrett / QDB.pm
Last active December 14, 2015 20:09
Very quick first pass at WWW::QDB, quote retrieval from qdb.us and bash.org with cache for random quotes.
package WWW::QDB;
use v5.10.1;
use strict;
use warnings;
use HTTP::Tiny;
use HTML::TreeBuilder::XPath;
use Scalar::Util qw/looks_like_number/;
@jbarrett
jbarrett / shizzle.pl
Last active July 21, 2017 18:35
Shizzle text script for irssi. Was going to be a bot (bizzle) output mode, but had trouble getting other scripts to emit the right signals
# vim: filetype=perl
use strict;
use warnings;
use Irssi;
use WWW::Mechanize;
=encoding utf8
@jbarrett
jbarrett / post-receive.sh
Created November 14, 2012 11:06
First pass at Git (+ Gitweb) integration with FogBugz. Notes in comments.
#!/bin/bash
# Git hook to link a commit's BugzID in Fogbugz.
#
# Instead of a filename, script populates URL with repository name.
# This saves us needing to configure a repository per-project in Fogbugz.
# Description, first word in file should be repository-name.git
DESC=description
@jbarrett
jbarrett / bitrate_report.pl
Created November 13, 2012 19:32
Quick and dirty script to report on audio files encoded at less than a given bitrate
#!/usr/bin/env perl
use strict;
use warnings;
use v5.10.1;
use Image::ExifTool qw/:Public/;
use Getopt::Long;
use File::Which qw/which/;
@jbarrett
jbarrett / db_migrate.pl
Created September 18, 2012 13:39
Quick DBIx::Class::Schema::Versioned deployment skeleton
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Foo::Schema;
@jbarrett
jbarrett / testloop.sh
Created September 6, 2012 09:24
A very simple loop to give constant feedback on tests v code. Stick it in a small tmux/screen pane for TDD goodness.
#!/bin/bash
# Wait for project changes, run tests, report.
RED=1
GREEN=2
testcmd="make test"
exclude='^\.git|.*swp'
function report {
@jbarrett
jbarrett / controller.pl
Created August 29, 2012 19:53
VERY rough prototype for midi control from analogue joystick.
#!/usr/bin/env perl
use MIDI::ALSA;
use SDL;
use SDL::Joystick;
use Time::HiRes qw( usleep );
SDL::init_sub_system(SDL_INIT_JOYSTICK);
my $joystick = SDL::Joystick->new(0);
my $x;
@jbarrett
jbarrett / rssfs.pl
Created August 24, 2012 14:05
FUSE Module to read/mount a RSS feed
#!/usr/bin/env perl
# rssfs.pl
use strict;
use warnings;
use Date::Parse;
use Fuse;
use HTML::FormatText::WithLinks;
@jbarrett
jbarrett / .bash_profile
Created March 6, 2012 10:30
Git prompt snippet
# from http://www.entropy.ch/blog/Developer/2009/03/30/Git-and-SVN-Status-in-the-Bash-Prompt.html :
# Prompt setup, with SCM status
parse_git_branch() {
local DIRTY STATUS
STATUS=$(git status 2>/dev/null)
[ $? -eq 128 -o $? -eq 127 ] && return
[[ "$STATUS" == *'working directory clean'* ]] || DIRTY=' *'
echo "($(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* //')$DIRTY)"
}