Skip to content

Instantly share code, notes, and snippets.

View pjlsergeant's full-sized avatar
🙇‍♂️
I don't really have time for this anymore

Peter Sergeant pjlsergeant

🙇‍♂️
I don't really have time for this anymore
  • Bangkok, Thailand
View GitHub Profile

adet - Drive docker, docker-compose, and aws ecs from one config

adet attempts to provide maximum DWIM for projects using docker, Docker Compose and AWS ECS from YAML configuration files. It supports the three projects I'm working on nicely, each one of which has several component Docker images organized into tasks and services, and deployed on ECS.

Synopsis

Login

@pjlsergeant
pjlsergeant / gist:2556399
Created April 30, 2012 08:01
Concise map-reduce in Perl
use strict; use warnings;
use List::Util qw(reduce);
use File::Slurp qw(read_file);
# Given a list of filenames, return a hash of each word and the number of times
# it occurs.
sub word_count {
reduce { $a->{$b}++; $a } {},
package FixEncodings;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(explain attempt_decode);
# This should be in terms of longest first
@pjlsergeant
pjlsergeant / git.pl
Created November 27, 2012 12:42
GraphViz Git Commit Tree
#!perl
# Draw the commit graph of a git repository, using GraphViz. Supply the directory
# the repo is in as the first argument. Writes a file called 'repo.svg' to the CWD.
use strict; use warnings;
use Cwd;
use Git::PurePerl;
use GraphViz2;
@pjlsergeant
pjlsergeant / bubble.pl
Created November 27, 2012 09:23
BubbleCharts of DB Tables
#!perl
# Display a bubble chart of DB tables, with rows and relationships to other tables
# Either run directly: perl bubble.pl
# Or with Plack: plackup bubble.pl
use strict; use warnings;
# cpanm Dancer Template DBIx::Class::Schema::Loader Data::Google::Visualization::DataTable
use Dancer;
@pjlsergeant
pjlsergeant / Wrong.pm
Created November 17, 2016 09:53
First few steps of porting `wrong` to Perl. This is stupid.
# `wrong` in Perl. https://github.com/sconover/wrong
#
#
=head1 SYNOPSIS
#!perl
use strict;
@pjlsergeant
pjlsergeant / solver.pl
Created July 8, 2016 08:47
Simple OO backtracking Sudoku solver
package Sudoku;
1;
package Sudoku::Grid {
use strict;
use warnings;
use Cell;
@pjlsergeant
pjlsergeant / gist:fb33fe3bd15cf02865b582c2b1350670
Last active June 2, 2016 05:24
Perl RE Australian Postcodes
/(?:3(?:7(?:5[0-9]|6[0-7]|2[02-8]|3[0235-9]|1[1-5789]|8[1235-9]|0[0145789]|9[1235679]|4[014679]|7[05789])|5(?:5[0124-9]|8[013-689]|6[1-8]|7[0-3569]|2[0-3579]|0[0125679]|9[014-79]|4[02469]|1[25-8]|3[0137])|3(?:5[0-7]|3[0-578]|1[01245789]|7[01345789]|0[0-59]|2[1-589]|9[0-356]|8[014578]|4[0125]|6[0134])|8(?:5[0-46-9]|0[02-9]|9[0-3568]|1[02-68]|8[025-9]|2[0-5]|7[013458]|4[01247]|6[02459]|3[1235])|0(?:[245][0-9]|6[0-8]|7[0-689]|3[0-46-9]|1[0-35689]|9[013-79]|8[1-5789]|0[0-468])|6(?:3[0-9]|6[0-69]|7[0-35-8]|4[0134679]|9[0145789]|1[0246-9]|2[0-49]|8[235789]|0[78]|5[89])|4(?:6[0-5789]|3[0-578]|4[0124678]|8[0235789]|2[034789]|1[2-589]|0[01279]|9[01468]|5[0138]|7[2578])|2(?:[37][0-9]|2[0-8]|8[0-79]|1[1-9]|0[0124-7]|6[04-9]|4[0-39]|5[014]|9[234])|9(?:2[0-35-9]|1[0-35689]|[35][01346-9]|4[0-6]|6[024-7]|7[15-9]|9[01256]|8[01478]|0[02349])|1(?:[346-9][0-9]|5[0-689]|[02][1-9]|1[13-6]))|2(?:7(?:3[0-9]|9[0-5789]|5[0-46-9]|6[0-35-9]|1[0-7]|0[0-35-8]|7[03-9]|2[0125679]|8[02-7]|4[5789])|3(?:[25][0-9]|4[0-8]|1[0124-9]|0[02-9]|3[03
@pjlsergeant
pjlsergeant / gist:6255791
Created August 17, 2013 07:51
Count new Pause IDs
#!perl
use strict;
use warnings;
use LWP::Simple;
use DateTime;
use Data::Google::Visualization::DataTable;
# Create a datatable
@pjlsergeant
pjlsergeant / output.html
Created August 17, 2013 07:54
Pause author ID creation over time
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart","table"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable( {
"cols": [
{"id":"date","label":"Month Beginning","type":"date"},