Skip to content

Instantly share code, notes, and snippets.

@rwstauner
rwstauner / dump.log
Created October 16, 2025 21:58
Insn dump of ruby prelude
== disasm: #<ISeq:<internal:jit_hook>@<internal:jit_hook>:1 (1,0)-(13,3)>
0000 putspecialobject 3 ( 1)[Li]
0002 putnil
0003 defineclass :Module, <class:Module>, 0
0007 leave
== disasm: #<ISeq:<class:Module>@<internal:jit_hook>:1 (1,0)-(13,3)>
0000 putself ( 4)[LiCl]
0001 definemethod :with_jit, with_jit
0004 putobject :with_jit
@rwstauner
rwstauner / nvim_undo_viewer.md
Last active September 9, 2025 15:39
neovim undofile content viewer

This works with undo files having "version 3".

usage: nvim_undo_viewer.py [-h] [--original ORIGINAL] [--seq SEQ] [--last]
                           [--all] [--tree] [--debug]
                           undofile

View Neovim undo file contents

positional arguments:
@rwstauner
rwstauner / hashthread.rb
Created January 22, 2024 23:20
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because "store[...]" is null
h = { a: 0 }
n = 1000
threads = (1..n).flat_map do |i|
[
Thread.new { h["i#{i}"] = 1 },
Thread.new { h.delete("i#{i}") },
]
end.map(&:join)
puts h.inspect
@rwstauner
rwstauner / input.pl
Created January 8, 2015 18:12
perl, pod, and data tokens
# Module::Faker should prepend 3 lines above this
=head1 NAME
Pod::With::Data::Token - yo
=head1 SYNOPSIS
use warnings;
print <DATA>;
@rwstauner
rwstauner / command.sh
Last active August 29, 2015 14:11
Pod::Simple parsing binary
perl -e ' print "hi\n\n=F\0?}\302\240\0?}\302\200\n\nyo\n" '| perl -0777 -M'5; sub Pod::Simple::DEBUG { 10 }' -MPod::Text -ne ' my $parser = Pod::Text->new( code => 0, alt => 1, sentence => 0, width => 78 ); $parser->no_errata_section(1); $parser->parse_string_document($_) '
@rwstauner
rwstauner / cpangrep.txt
Last active August 29, 2015 13:57
Use cpangrep to search pod headings and get a list of distributions to reindex
$ cpangrep '=head1\s{2,}NAME\b'
147 results in 23 files. Showing first 23 results.
BLX/XSDSQL_20130411/xsdsql/lib/blx/xsdsql/connection.pm
130:
131:=head1 NAME
→ 115 more files matched in XSDSQL_20130411.
CPANEL/cPanel-TaskQueue-0.606/lib/cPanel/TaskQueue.pod
@rwstauner
rwstauner / curl.sh
Last active August 29, 2015 13:56
Find "main modules" that have pod but no matching `=head1 NAME`
curl api.metacpan.org/file/_search -d '{ "filter": {"and":[ {"missing": {"field": "documentation"}}, {"exists": {"field": "file.module.name"}}, {"exists": {"field": "description"}}, {"term": {"mime": "text/x-script.perl-module"}}, {"term": {"status": "latest"}} ]}, "fields": ["distribution", "path", "file.module.name", "date"], "size":1140, "sort": [{"date":"desc"}] }' > unnamed-pod.json
@rwstauner
rwstauner / check_prereqs.pl
Last active January 4, 2016 13:29
Look for unlisted perl prereqs
#!/usr/bin/env perl
# Originally from http://github.com/cpan-api/cpan-api (5c280d86fb0db818bedefdc46ee1d2c6276a01e4).
# PODNAME: check_prereqs.pl
# TODO: this stuff should be in other modules somewhere
use strict;
use warnings;
use Perl::PrereqScanner 1.014;
use CPAN::Meta::Requirements;
@rwstauner
rwstauner / gist:5678576
Last active December 17, 2015 21:59
Get an ini string from a plugin bundle
*$ perl -MData::Dumper -e 'use Dist::Zilla::Config::BundleInspector;
print Dist::Zilla::Config::BundleInspector->new(
bundle_class => "Dist::Zilla::PluginBundle::RJBS"
)->ini_string'
[Git::GatherDir]
[CheckPrereqsIndexed]
[CheckExtraTests]
[@Filter]