Skip to content

Instantly share code, notes, and snippets.

View ology's full-sized avatar
💭
🤔

Gene Boggs ology

💭
🤔
View GitHub Profile
@ology
ology / .perlbot
Created September 13, 2022 00:32
random slice of perlbot
17:29:12 -!- Irssi: Starting query in libera with perlbot
17:29:12 ology> talk like a pirate
17:29:12 perlbot> No factoid found. Did you mean one of these: [_tld_list] [tools] [teal`c] [typeglob] [polyglot] [talk to buu] [blackletter] [file::slurp] [class::light] [placeholders]
17:29:23 ology> pirate
17:29:23 perlbot> No factoid found. Did you mean one of these: [parrot] [pbride] [port 0] [port 1] [port 2] [port 3] [port 5] [port 7] [port 9] [port 11]
17:29:32 ology> Bite me!
17:29:33 perlbot> No factoid found. Did you mean one of these: [bottom] [button] [blow me] [bidi] [.bd] [.bt] [bad] [bot] [mdn] [8bit]
17:29:39 ology> blow me
17:29:40 perlbot> alright.
@ology
ology / Athena.pm
Created September 27, 2022 18:55
Code taken from the athena.pl Paws distro example
package Compliance::Athena;
# Abstract: AWS Athena database connection
use strict;
use warnings;
use Compliance::Config;
use Carp qw/croak/;
@ology
ology / .release
Created October 23, 2022 17:37
A t/control.mid file is shipped with the module, but causes an ugly failure?
[2022-10-23 10:13:51] gene@mopey:~/sandbox/MIDI-Tab master
▸ dzil release
[DZ] beginning to build MIDI-Tab
[DZ] guessing dist's main_module is lib/MIDI/Tab.pm
[VersionFromModule] dist version 0.0402 (from lib/MIDI/Tab.pm)
[PkgVersion] skipping lib/MIDI/Tab.pm: assigns to $VERSION
[ExtraTests] rewriting author test xt/author/pod-coverage.t
[ExtraTests] rewriting author test xt/author/pod-syntax.t
[ExtraTests] rewriting author test xt/author/no-tabs.t
[ExtraTests] rewriting author test xt/author/eol.t
@ology
ology / .pl
Last active November 26, 2022 15:50
Turning any sharps into flats
sub accidental {
my ($x) = @_; # note or chord
if ($x =~ /^([A-G]#)(.*)?$/) {
my $note = $1;
my $flav = $2;
my $mn = Music::Note->new($note, 'isobase');
$mn->en_eq('b');
$x = $mn->format('isobase');
$x .= $flav if $flav;
}
@ology
ology / .pl
Last active December 8, 2022 23:42
My $0.02 :)
my @post_links = map {
$self->url_for(
'single_' . $_->{type},
$_->{type} . '_id' => $link->{id}
)
} @$flagged_posts;
$self->stash(post_links => \@post_links);
@ology
ology / process.pl
Last active December 14, 2022 18:26
Process F1 & F2 into F3 text files
#!usr/bin/env perl
use strict;
use warnings;
my $F1 = 'F1.txt';
my $F2 = 'F2.txt';
my $F3 = 'F3.txt';
my %f2_map;
@ology
ology / find.pl
Last active March 5, 2023 18:46
File::Find::Rule->file()->...->size(...) error?
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find::Rule ();
my @files = File::Find::Rule
->file()
->name('image*.jpg')
->in('/home/gene/tmp/pi')
@ology
ology / perlver.out
Created March 28, 2023 17:50
kd: Why do you say 5.32 is required?
gene@mopey:~/sandbox/Groove-Tool main ▸ perlver ./lib/Groovetool.pm
---------------------------------------------------
| file | explicit | syntax | external |
| --------------------------------------------------- |
| ./lib/Groovetool.pm | ~ | v5.14.0 | n/a |
| --------------------------------------------------- |
| Minimum explicit version : ~ |
| Minimum syntax version : v5.14.0 |
| Minimum version of perl : v5.14.0 |
---------------------------------------------------
@ology
ology / copy-cells.py
Created April 2, 2023 16:56
Copy cells + styles
from copy import copy
from openpyxl import load_workbook
file = '/home/gene/tmp/test.xlsx'
wb = load_workbook(file)
sheet_name = wb.sheetnames[0]
sheet = wb[sheet_name]
sheet["A4"].font = copy(sheet["A2"].font)
@ology
ology / .pl
Last active April 22, 2023 16:02
Remove DOM element conditionally
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::DOM ();
use Mojo::File ();
my $xml_file = shift || die "Missing XML file\n";
my $path = Mojo::File->new($xml_file);