Skip to content

Instantly share code, notes, and snippets.

View briandfoy's full-sized avatar

brian d foy briandfoy

View GitHub Profile
@briandfoy
briandfoy / net-ssh-perl-rt2github.pl
Created January 14, 2024 19:11
Import rt.cpan.org issues to GitHub issues
use v5.26;
use open qw(:std :utf8);
use Mojo::JSON qw(decode_json);
use Mojo::UserAgent;
use Mojo::Util qw(dumper);
# See another gist to create JSON https://gist.github.com/briandfoy/656a8986e2d998122e37486df1f1f999
@ARGV = '/Users/brian/Desktop/net-ssh-perl-rt.json';
my $raw = Mojo::File->new($ARGV[0])->slurp;
@briandfoy
briandfoy / rt_cpan_org_export
Created July 14, 2023 08:03
rt_cpan_org_export - a program to export an rt.cpan.org queue to JSON
use v5.26;
use warnings;
=encoding utf8
=head1 NAME
rt_cpan_org_export - grab the tickets for an rt.cpan.org queue
=head1 SYNOPSIS
@briandfoy
briandfoy / make_pull_request_feed.pl
Created June 27, 2023 11:40
Make an Atom feed for pull requests to a GitHub repo
#!/Users/brian/bin/perl
use v5.36;
use open qw(:std :utf8);
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my( $user, $repo ) = split m|/|, $ARGV[0];
my $url = $ARGV[1];
<html>
<head>
<title>Selector example</title>
</head>
<body>
<a href="https://stackoverflow.com/a/76537358/2766176">https://stackoverflow.com/a/76537358/2766176</a>
<div>
@briandfoy
briandfoy / grab-gist
Last active June 30, 2023 12:42
A Mojo::UserAgent program to grab all the files in a gist
#!/usr/bin/perl
=encoding utf8;
=head1 NAME
grab-gist - download all the files in a gist
=head1 SYNOPSIS
#!/Users/brian/bin/perl
use v5.36;
use open qw(:std :utf8);
use utf8;
use File::Basename;
use Text::Shellwords qw(shellwords);
=head1 NAME
@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
@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 / 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);
# Here's the input, as an indented heredoc
my $string = <<~"_STRING";
ABCD
EFGH
IJKL
ABCD
EFGH
IJKL
_STRING