Skip to content

Instantly share code, notes, and snippets.

View ology's full-sized avatar
💭
🤔

Gene Boggs ology

💭
🤔
View GitHub Profile
@ology
ology / stacktrace.txt
Created June 16, 2023 18:30
Dancer + Mysql mystery - logs-in select people. Others - no dice.
...
Jun 15 21:33:53 chess uwsgi_psgi[179061]: [pid: 179061|app: 0|req: 1450/1450] 143.110.222.166 () {36 vars in 512 bytes} [Thu Jun 15 21:33:53 2023] GET / => generated 0 bytes
in 12 msecs (HTTP/1.1 302) 6 headers in 293 bytes (0 switches on core 0)
Jun 15 21:37:39 chess uwsgi_psgi[179061]: [pid: 179061|app: 0|req: 1451/1451] 216.244.66.245 () {36 vars in 515 bytes} [Thu Jun 15 21:37:39 2023] GET /robots.txt => generated
26 bytes in 5 msecs via sendfile() (HTTP/1.1 200) 3 headers in 111 bytes (0 switches on core 0)
Jun 15 21:42:19 chess uwsgi_psgi[179061]: _ANON__('HASH(0x555a86dd4580)') called at /home/gene/repos/Family-Site/bin/app.pl line 0
Jun 15 21:42:19 chess uwsgi_psgi[179061]: eval {...} at /home/gene/repos/Family-Site/bin/app.pl line 0
Jun 15 21:42:19 chess uwsgi_psgi[179061]: Trace begun at (eval 342) line 1
Jun 15 21:42:19 chess uwsgi_psgi[179061]: main::__ANON__('DBIx::Class::Exception=HASH(0x555a86ddb910)') called at /usr/local/share/perl/5.30.0/DBIx/Class/Exception.pm line 77
Jun 15 21:42:19
@ology
ology / build.log
Last active June 12, 2023 17:54
IO::Async fails to install on my macOS Monterey 12.6 :\
cpanm (App::cpanminus) 1.7044 on perl 5.034000 built for darwin-2level
Work directory is /Users/geneboggs/.cpanm/work/1686591626.77409
You have make /usr/bin/make
You have LWP 6.59
You have /usr/bin/tar: bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8
You have /usr/bin/unzip
Searching IO::Async () on cpanmetadb ...
--> Working on IO::Async
Fetching https://cpan.metacpan.org/authors/id/P/PE/PEVANS/IO-Async-0.802.tar.gz
-> OK
@ology
ology / .pl
Created June 10, 2023 20:08
$m->method(); vs $m->$method(); benchmark
#!/usr/bin/env perl
use strict;
use warnings;
use Benchmark;
use lib map { "$ENV{HOME}/sandbox/$_/lib" } qw(Music-FretboardDiagram);
use Music::FretboardDiagram ();
my $count = shift || 100_000_000;
@ology
ology / .pl
Last active May 28, 2023 14:19
Error fixed!
mode(maj, [
meta{ chord:maj, roman:r_I, function:tonic },
meta{ chord:min, roman:r_ii, function:supertonic },
meta{ chord:min, roman:r_iii, function:mediant },
meta{ chord:maj, roman:r_IV, function:subdominant },
meta{ chord:maj, roman:r_V, function:dominant },
meta{ chord:min, roman:r_vi, function:submediant },
meta{ chord:dim, roman:r_vii, function:leading_tone }
]).
mode(ionian, Meta) :- mode(maj, Meta).
@ology
ology / .pl
Created May 20, 2023 07:39
require Some::Module in a single function
sub cfsqrt {
my ($self, $n, $m) = @_;
$m ||= $n;
my @terms;
my $ok = eval {
require Math::NumSeq::SqrtContinued;
1;
};
die 'ERROR: Math::NumSeq::SqrtContinued not installed'
unless $ok;
@ology
ology / .txt
Created May 12, 2023 00:05
Look up stuff in CPAN by parsing release bits
$ perl parse-cpan --or devel,trace
Getting 02packages.details.txt.gz ...
Saved 02packages.details.txt.gz
Parsing 02packages.details.txt.gz ... Done.
Removing 02packages.details.txt.gz
Processing...
1. https://metacpan.org/dist/Devel-Optrace 0.05 2013-09-11T15:07:39 38065 GFUJI
2. https://metacpan.org/dist/App-tracepm 0.230 2020-04-08T02:56:49 24737 PERLANCAR
3. https://metacpan.org/dist/Stacktrace-Configurable 0.06 2014-08-04T05:45:54 25573 OPI
4. https://metacpan.org/dist/FreeBSD-i386-Ptrace 0.05 2015-01-15T00:01:38 7778 DANKOGAI
@ology
ology / undef.js
Last active May 3, 2023 17:06
Assigning to an undefined key in node? Crazy!
const foo = { x: 123, y: 667 };
console.log(foo['z']);
foo[foo['z']] = 'HELLO?';
console.log(foo);
/**
* output:
* undefined
* { x: 123, y: 667, undefined: 'HELLO?' }
**/
@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);
@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 / 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 |
---------------------------------------------------