Skip to content

Instantly share code, notes, and snippets.

Avatar

brian d foy briandfoy

View GitHub Profile
@briandfoy
briandfoy / mega_pr.sh
Created Aug 26, 2022
Makin' some PRs. Hold my beer.
View mega_pr.sh
#!/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
@briandfoy
briandfoy / perl_features_by_version.pl
Created May 31, 2022
(Perl) What feature is what version?
View perl_features_by_version.pl
#!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 / basic_auth
Last active Apr 27, 2022
A Unicode-safe HTTP basic auth string encoder/decoder
View basic_auth
#!perl
use v5.10;
use utf8;
use Encode;
use I18N::Langinfo qw(langinfo CODESET);
use MIME::Base64;
my $codeset = langinfo(CODESET);
View gist:5a5b59c4b1e4a810d561cf03ba6b4bb9
# Here's the input, as an indented heredoc
my $string = <<~"_STRING";
ABCD
EFGH
IJKL
ABCD
EFGH
IJKL
_STRING
View Windows 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 Jun 16, 2021
(Perl) JSONify the US National Park sites that have passport stickers, by year and region
View national_park_passport_stickers.pl
#!/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 Jun 2, 2021
Process the LeanPub royalties CSV
View leanpub_sales
#!/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
View licenses.txt
$ 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 Feb 25, 2021
Convert rt.perl.org issue numbers to Github
View gist:2ffb4d4bb256dffd4f74e1a36a1af663
#!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;
}
View gist:30be6d46c005dc27003518ece2f53a74
#!/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