This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: docs clean | |
docs: | |
PYTHONPATH=. sphinx-build -M markdown . output | |
clean: | |
rm -rf output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:bookworm-slim | |
RUN apt-get update && apt-get install -y --no-install-recommends rsyslog | |
COPY rsyslog.d-demo.conf /etc/rsyslog.d/00-demo.conf | |
RUN mkdir -vp /var/log/user | |
# this command just comments out kernel logging support (the line `module(load="imklog")`) | |
RUN perl -wMstrict -i -ple 's/^(?=\s*module\s*\(\s*[^)]*\bimklog\b)/#/' /etc/rsyslog.conf | |
COPY *.sh /usr/local/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
igbpyutils >= 0.0.3 | |
sleep_until |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
// Documented at: https://www.perlmonks.org/?node_id=11116369 | |
$(function () { | |
var CB_FETCHTIME_MS = 15 * 1000; | |
var GERNERAL_REFRESHTIME_MS = 60 * 1000; | |
// AJAX CB Refresh | |
var refresh = function () { | |
$.ajax({ url: '/', dataType: 'html', | |
// testing shows the table rendered here is the same as in the nodelet | |
data: { node: 'showchatmessages', displaytype: 'raw', ticker: 'yes' } }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cpanm --installdeps . | |
requires 'Mojo::DOM'; | |
requires 'HTML::TreeBuilder::XPath'; | |
requires 'HTML::LinkExtor'; | |
requires 'WWW::Mechanize', '1.97'; | |
requires 'XML::LibXML'; | |
# for runsols.pl: | |
requires 'Path::Class'; | |
requires 'IPC::Run3'; | |
requires 'Test::More'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
my %tehcodez = ( | |
sortfirst => q{ | |
@list = sort {$a<=>$b} @list; | |
@list = ( (grep {$_>=0} @list), (grep {$_<0} @list) ); }, | |
grepfirst => q{ | |
my @pos = grep {$_>=0} @list; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use warnings; | |
use 5.018; | |
# run this multiple times: sometimes it prints "x1x2x1x", sometimes "x2bar-x2x2bar-x" | |
{ | |
my %repl = ( '-foo-bar-'=>1, '-foo-'=>2 ); | |
my $re = join '|', map { "\\b$_\\b" } keys %repl; | |
$re = qr/$re/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING # WARNING # WARNING # the following command generates a ~1 GIGABYTE file! | |
$ perl -le '$,=$/;for(1..50000){print+("Foo")x5000,"Bar CAPTURE Bar"}print+("Foo")x5000' >test.txt | |
# For testing outputs: | |
# perl -le '$,=$/;print"Bar CAPTURE Bar";for(1..49999){print+("Foo")x5000,"Bar CAPTURE Bar"}' >out_expect.txt | |
# UPDATE: Replace "time" with "/usr/bin/time" to get memory usage stats as well! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use Time::HiRes qw/gettimeofday tv_interval/; | |
use DBI; | |
my $dbh = DBI->connect("dbi:SQLite:dbname=:memory:",undef,undef, | |
{ RaiseError=>1, AutoCommit=>0 } ); | |
{ # create table and fill with fake data | |
$dbh->do(<<'END_SQL'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use Benchmark 'cmpthese'; | |
use List::Util 'first'; | |
my @tests = ( | |
{ nrand=> 100, nlook=> 10, match=>'beginning' }, | |
{ nrand=> 100, nlook=> 100, match=>'beginning' }, | |
{ nrand=>10_000, nlook=> 100, match=>'beginning' }, |
NewerOlder