Skip to content

Instantly share code, notes, and snippets.

View ology's full-sized avatar
💭
🤔

Gene Boggs ology

💭
🤔
View GitHub Profile
@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 / .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 / .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 / .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 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 / 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 / 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 / .db
Created June 27, 2023 06:44
Mojo::SQLite warning on insert, but it happens anyway?
sqlite> .schema
CREATE TABLE moog_matriarch (id integer primary key autoincrement, json text not null);
CREATE TABLE sqlite_sequence(name,seq);
sqlite> select * from moog_matriarch;
1|{"bottom":20,"control":"knob","group":"filter","is_default":0,"parameter":"cutoff","top":20000,"unit":"Hz","value":200}
@ology
ology / .db
Last active June 27, 2023 22:23
db->select(...) only returning one record?
sqlite> select * from moog_matriarch;
1|{"bottom":20,"control":"knob","group":"filter","is_default":1,"parameter":"cutoff","top":20000,"unit":"Hz","value":200}|Test setting!
2|{"bottom":0,"control":"patch","group":"modulation","is_default":1,"parameter":"wave out","top":1,"unit":"boolean","value":1}|Test setting!
@ology
ology / .txt
Created July 16, 2023 14:12
FAIL Music-ModalFunction-0.0312 5.28.0 GNU/Linux
Report for Music-ModalFunction-0.0312
Back
From: Andreas J. König (ANDK)
Subject: FAIL Music-ModalFunction-0.0312 5.28.0 GNU/Linux
Date: 2023-07-12T06:01:26Z
This distribution has been tested as part of the CPAN Testers
project, supporting the Perl programming language. See
http://wiki.cpantesters.org/ for more information or email
questions to [email protected]