Skip to content

Instantly share code, notes, and snippets.

View briandfoy's full-sized avatar

brian d foy briandfoy

View GitHub Profile
@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;
}
$ 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 / 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
@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 / 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 ) {
# Here's the input, as an indented heredoc
my $string = <<~"_STRING";
ABCD
EFGH
IJKL
ABCD
EFGH
IJKL
_STRING
@briandfoy
briandfoy / basic_auth
Last active April 27, 2022 18:18
A Unicode-safe HTTP basic auth string encoder/decoder
#!perl
use v5.10;
use utf8;
use Encode;
use I18N::Langinfo qw(langinfo CODESET);
use MIME::Base64;
my $codeset = langinfo(CODESET);
@briandfoy
briandfoy / perl_features_by_version.pl
Created May 31, 2022 22:48
(Perl) What feature is what version?
#!perl
use v5.36;
use feature ();
my( %Features, %Versions );
foreach my $key ( keys %feature::feature_bundle ) {
next unless $key =~ /\A5\.\d[02468]\z/;
$Versions{$key}++;
foreach my $feature ( $feature::feature_bundle{$key}->@* ) {
$Features{$feature}{$key}++;
@briandfoy
briandfoy / mega_pr.sh
Created August 26, 2022 12:44
Makin' some PRs. Hold my beer.
#!/bin/bash
# Don't judge me too harshly. This is a throwaway that I put
# together in 5 minutes to make a couple hundred pull requests
DEV=/Users/brian/Dev
target=.github/workflows/windows.yml
message="Update windows workflow"
echo MESSAGE $message
branch=windows-update
json=$(cat <<-END
#!/Users/brian/bin/perl
use v5.36;
use open qw(:std :utf8);
use utf8;
use File::Basename;
use Text::Shellwords qw(shellwords);
=head1 NAME