Skip to content

Instantly share code, notes, and snippets.

🙇
I don't really have time for this anymore

Peter Sergeant pjlsergeant

🙇
I don't really have time for this anymore
Block or report user

Report or block pjlsergeant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pjlsergeant
pjlsergeant / util-graph.xsl
Created May 8, 2017
BFS algorithm in XSLT
View util-graph.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!-- Templates which operate on directed graphs -->
<xsl:import href="util-map.xsl"/>
<!--
Simple breadth-first search implementation to return a tree from a starting node
-->
<xsl:template name="generate-paths">
@pjlsergeant
pjlsergeant / Wrong.pm
Created Nov 17, 2016
First few steps of porting `wrong` to Perl. This is stupid.
View Wrong.pm
# `wrong` in Perl. https://github.com/sconover/wrong
#
#
=head1 SYNOPSIS
#!perl
use strict;
@pjlsergeant
pjlsergeant / solver.pl
Created Jul 8, 2016
Simple OO backtracking Sudoku solver
View solver.pl
package Sudoku;
1;
package Sudoku::Grid {
use strict;
use warnings;
use Cell;
View gist:fb33fe3bd15cf02865b582c2b1350670
/(?: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
View Test::Mojo and Cucumber
#!perl
use strict;
use warnings;
use Test::BDD::Cucumber::StepFile;
use Test::Mojo;
# Instantiates a new Test::Mojo object, and save it in the scenario-level stash.
# Rather than do this per-scenario, we'll store a copy in the feature-level and
View gist:0c2415964f3911e6d5bc
### Keybase proof
I hereby claim:
* I am pjlsergeant on github.
* I am pjlsergeant (https://keybase.io/pjlsergeant) on keybase.
* I have a public key whose fingerprint is 24D0 CFF6 6CE6 C9EE 9731 962B AA91 4EB0 D57E E0AC
To claim this, I am signing this object:
View gist:4a40b5bf6ced969c1f8c
1993
* 02 Jun '93: Dave Raggett updates his HTML+ DTD to include support for "INPUT and SELECT form interaction elements"[0]
* 05 Sep '93: Marc Andreessen says NCSA Mosaic 2.0 will submit form parameters as: "name=value&name=value&name=value"[1]
* 13 Sep '93: Rob McCool announces NCSA httpd 1.0a1[2], which supports:
"server scripts, which are executable programs which the server runs to generate documents on the fly. They are easy to write and can be written in your favorite language, whether it be C, PERL, or even the Bourne shell" [3]
* 14 Nov '93: Rob McCool complains that his users are avoiding writing code because they think the interface will change, and throws open a bunch of open-issues he wants fixing in what he calls the "gateway"
View gist:c63fb15a4b1502219097
#!perl
use strict;
use warnings;
my %digits = map { $_ => 1 } ( 0 .. 9 );
sub choose ($&) {
my ( $set, $sub ) = @_;
map { $sub->($_) } grep { $set->{$_} } keys %$set;
@pjlsergeant
pjlsergeant / output.html
Created Aug 17, 2013
Pause author ID creation over time
View output.html
<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"},
@pjlsergeant
pjlsergeant / gist:6255791
Created Aug 17, 2013
Count new Pause IDs
View gist:6255791
#!perl
use strict;
use warnings;
use LWP::Simple;
use DateTime;
use Data::Google::Visualization::DataTable;
# Create a datatable
You can’t perform that action at this time.