Skip to content

Instantly share code, notes, and snippets.

View pjf's full-sized avatar

Paul Fenwick pjf

View GitHub Profile
#!/usr/bin/perl -w
use strict;
use warnings;
use autodie;
use utf8;
use FindBin qw($Bin);
use lib "$Bin/lib";
use IO::Prompt qw(prompt);
use Term::Cap;
use Term::ANSIScreen qw(locate);
@pjf
pjf / netk
Created November 16, 2014 12:15
Inflate and validate netkan files directory into CKAN-meta
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use autodie qw(:all);
my ($file) = @ARGV;
my ($base) = ($file =~ m{(?:.*/)?(.*)\.netkan$});
@pjf
pjf / gist:c12c76f4db45a09d2050
Created November 14, 2014 04:13
Possible `ckan available` display?
./ckan.exe available
Mods available for KSP 0.25.0
* Advanced Fly-By-Wire 1.2.3_0 (AdvancedFlyByWire)
* Action Groups Extended 1.21a (AGExt)
* Advanced Jet Engine (AJE) 1.6.4 (AJE)
* AMEG 1.1 (AMEG)
* Community Resource Pack 0.2.3 (CommunityResourcePack)
* CrewFiles 2.0.0.3 (CrewFiles)
* Cross Feed Enabler 3.1 (CrossFeedEnabler)
@pjf
pjf / gist:d203eec5fb3dc61b5fc9
Last active August 29, 2015 14:09
CKAN release announcement

Introduction

When I first discovered Kerbal Space Program, I found it was great. And then I discovered the mods; and they turned a great game into an amazing one.

About 70 mod installs later, I realised that installing mods was time-consuming, and error-prone. Each mod seemed to have its own set of dependencies, its own way of being packaged, its own way of being installed. Worst of all, some mods would conflict with each other, something I'd often discover after it was already too late.

I saw the same problems were plaguing mod authors as well. Users would be asking for help because they had installed the wrong version, or were experiencing conflicts with existing mods.

@pjf
pjf / push
Created November 8, 2014 22:55
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use autodie qw(:all);
use IPC::System::Simple qw(capturex systemx);
my $upstream = $ARGV[0] || "pjf";
my $branch = capturex(qw(git rev-parse --abbrev-ref HEAD));
== Permitted, but not defined (BUGS!) ==
- [ ] ACID_AMMO (entity_dwarf_evil.txt)
- [ ] ARMORPLATE (entity_dwarf_evil.txt entity_human.txt)
- [ ] BADTHOUGHTS_KOBOLD (entity_kobold_camp.txt)
- [ ] BAYONET (entity_default.txt entity_dwarf_evil.txt)
- [ ] BAYONET_2 (entity_dwarf_evil.txt entity_human.txt)
- [ ] BAYONET_AIRGUN (entity_dwarf_evil.txt)
- [ ] BAYONET_RIFLE (entity_dwarf_evil.txt)
There was a staffer named erry
Who helped on hash-freenode
She heard my humble cries for help;
While she was hacking code.
So now I have my favourite nick
That I've wanted for six years
And it's all due to erry's help!
For that I give a cheer!
# Usage: {% pullquote : Here's some pullquote text. %}
module Jekyll
class PullQuote < Liquid::Tag
# (Options) : (Message)
Syntax = /^(.*?)\s*:\s*(.*)/
def initialize(tag_name, markup, tokens)
super
@pjf
pjf / rickroll.pl
Created January 22, 2014 12:24
Rickroll cmdline utility
#!/usr/bin/perl -w
use 5.010;
use strict;
use warnings;
use autodie;
use WWW::Twilio::API;
my $lucky_person = shift || die "Usage: $0 phone-number";
my $rick = WWW::Twilio::API->new(
@pjf
pjf / gist:8231962
Last active January 2, 2016 01:39
The curious matter of finding a given merge

My problem:

I'm working on a project where upstream doesn't use source control of any sort. Yes, that's exactly the same reaction I had as well.

I keep track of their releases on a branch named upstream. When new releases are made, I add them to this branch as a single commit, so at least I know what changed (in bulk) from the last release.

My changes (usually!) end up in the official releases, but because they don't use source control, my commits never do. Hence I want to find all the commits I've made since the last merge, as an "approximation" of what's changed between my release and theirs. Simple git log A..B isn't what I want here.

So, here's the network graph. I want to find the last point on master where upstream was merged in. In this case, that's 9039b22b .