Skip to content

Instantly share code, notes, and snippets.

View briandfoy's full-sized avatar

brian d foy briandfoy

View GitHub Profile
@briandfoy
briandfoy / Windows time zones
Created July 6, 2021 03:56
Windows 10 time zones
#!perl
use v5.10;
use strict;
use POSIX;
my @zones = sort map { chomp; $_ } grep { /Time$/ } qx( tzutil /l );
my @new;
foreach my $zone ( @zones ) {
@briandfoy
briandfoy / national_park_passport_stickers.pl
Last active June 16, 2021 03:05
(Perl) JSONify the US National Park sites that have passport stickers, by year and region
#!/usr/bin/perl
use v5.28;
use open qw(:std :utf8);
use utf8;
use Mojo::JSON qw(encode_json);
use Mojo::UserAgent;
use Mojo::Util qw(dumper trim);
@briandfoy
briandfoy / leanpub_sales
Last active June 2, 2021 20:11
Process the LeanPub royalties CSV
#!/usr/bin/perl
# https://gist.github.com/briandfoy/f0f9405dda27aafd90ee79efb1ffa139
=head1 NAME
=head1 SYNOPSIS
# first, get your royalty report from
# https://leanpub.com/u/USER/generate_all_royalties_csv
# download that somewhere
$ bmt licenses
MyCPAN-Indexer artistic_2
Archive-Extract-Libarchive perl_5
File-Slurp perl_5
Object-Tiny perl_5
Path-Class perl_5
Archive-Zip perl_5
CPAN-Checksums perl_5
Compress-Bzip2 perl_5
Data-Compare artistic_1, gpl_2
@briandfoy
briandfoy / gist:2ffb4d4bb256dffd4f74e1a36a1af663
Created February 25, 2021 16:40
Convert rt.perl.org issue numbers to Github
#!perl
use v5.26;
my %rt_to_github = map { chomp; split /,/ } <DATA>;
foreach my $arg ( @ARGV ) {
unless( exists $rt_to_github{$arg} ) {
say "No mapping for RT #$arg\n";
next;
}
@briandfoy
briandfoy / gist:30be6d46c005dc27003518ece2f53a74
Created January 15, 2021 09:57
Convert an ePub to Mobi
#!/usr/bin/perl
use v5.26;
use experimental qw(signatures);
=head1 NAME
zamzar_epub_to_mobi - use Zamzar to convert an ePub to Mobi
=head1 SYNOPSIS
@briandfoy
briandfoy / wp2local.pl
Created November 9, 2020 08:05
Turn a WordPress XML dump into a bunch of local files
#!perl
use v5.10;
use experimental qw(signatures);
use File::Path qw(make_path);
use File::Spec::Functions;
use Mojo::DOM;
use Mojo::URL;
use Mojo::Util qw(dumper);
use XML::LibXML;
theme = perl7
[TestingAndDebugging::RequireUseStrict]
add_themes = perl7
[TestingAndDebugging::RequireUseWarnings]
add_themes = perl7
[InputOutput::ProhibitBarewordFileHandles]
add_themes = perl7
@briandfoy
briandfoy / minion_outline.md
Created May 27, 2020 21:20
Ideas for a Minion book

Minion draft outline

  • Introduction

  • Setup

    • SQLite
    • Postgres
    • dashboard
    • enqueue a job, run a task
    • one Minion to bind them all
@briandfoy
briandfoy / new_password
Last active May 22, 2020 12:34
(Perl) generate some random passwords
#!/Users/brian/bin/perl -CASD
use v5.30;
use open qw(:std :utf8);
use Math::Random::Secure qw(irand rand);
=encoding utf8
=head1 NAME