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 / sc3000_widescreen.pl
Last active July 16, 2016 17:21
SimCity 3000 Widescreen hack - run from same dir as SC3.EXE / SC3U.EXE
#!/usr/bin/env perl
use strict;
use warnings;
use bytes;
use Carp;
use File::Copy qw/ cp /;
# See: http://www.wsgf.org/dr/simcity-3000/en
@jbarrett
jbarrett / echo_headers.pl
Created January 20, 2016 13:29
What were my request headers?
# plackup echo_headers.pl
use strict;
use warnings;
use Plack::Request;
use JSON;
my $app = sub {
my $req = Plack::Request->new(shift);
@jbarrett
jbarrett / RootURIFor.pm
Created April 14, 2015 17:48
Dancer2::Plugin::RootURIFor prototype
package Dancer2::Plugin::RootURIFor;
use strict;
use warnings;
my $VERSION = 0;
use URI::Escape;
use Dancer2::Plugin;
@jbarrett
jbarrett / todo.html
Last active August 29, 2015 14:05
The cheapest firefox todo list ever - add to bookmarks, set to load in sidebar
<meta http-equiv="refresh" content="10" />
<html>
<frameset cols="*">
<frame id="todo" src="todo.txt">
</frameset>
</html>
@jbarrett
jbarrett / repl.rc
Created January 25, 2014 03:29
Devel::REPL config / plugins, goes in ~/.re.pl/repl.rc
use warnings;
load_plugin qw(
Colors
Interrupt
Completion
CompletionDriver::INC
CompletionDriver::LexEnv
CompletionDriver::Keywords
CompletionDriver::Methods
@jbarrett
jbarrett / author-versions.t
Created November 27, 2013 18:07
Check Module, Dist::Zilla's dist.ini, POD and Changelog version number consistency. Probably better to let Dist::Zilla do versioning and changelog generation, but there you go.
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for testing by the author');
}
}
use strict;
use warnings;
@jbarrett
jbarrett / Makefile
Last active December 22, 2015 11:08
Cheap and cheerful Megadrive Gamepad -> PC via Arduino.
sendkeys: sendkeys.cpp
g++ -o sendkeys sendkeys.cpp -L/usr/lib64/ -lX11
all: sendkeys
@jbarrett
jbarrett / rename_movies.pl
Last active December 20, 2015 14:29
Quick and dirty script to rename DVD Rips, supplies the existing filename (minus ext) to IMDB for a suggested title/year. Confirms each action (occasionally IMDB::Film comes back with the wrong title or nothing at all, so full automation would be bad). `yes | rename_movies.pl` if you *really* want to do this.
#!/usr/bin/env perl
use IMDB::Film;
use File::Copy;
use autodie;
# Rename DVD Rips, with suggestion from IMDB.
my $dir = shift || '/media/usb1/vids/Movies';
opendir (my $dh, $dir);
@jbarrett
jbarrett / gist:5501284
Last active December 16, 2015 21:39
First pass at .bash_profile function for quick creation of new git projects. Requires sudoer rights.
newrepo() {
repo=$1
if [ -z $repo ] ; then
echo "No repository name specified"
return 1
fi
[[ ! $repo =~ \.git$ ]] && repo="${repo}.git"
sudo -u git git init --bare "/home/git/${repo}"
}
@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;