Skip to content

Instantly share code, notes, and snippets.

@eiro
eiro / guifa.p6
Created October 1, 2019 19:41
thank you #perl6
my %files{Buf} =
classify {.slurp: :bin},
grep {.f && .r},
dir 'videos';
@eiro
eiro / fat.zsh
Created October 1, 2019 19:00
detect the fat of your pdf
count_fat () awk -vmd5=1 -vfile=2 '
{ ++used[$md5] ; name[$md5]=$file }
END {
# is fat only if used more than 1 time
for (n in name)
if (--used[n])
print name[n],used[n]
}
'
@eiro
eiro / viml-debugger-anymone.txt
Last active September 21, 2019 11:55
a viml debugger? (bd adding extra "ghost" lines in my registers)
ehllo people,
using vim 8.1.1401 (provided by debian), i wanted to write
a plugin to highlight the covered and uncovered parts
of a golang code.
this is a sample of the cover.out file:
mode: set
github.com/libretro/ludo/input/input.go:53.43,54.34 1 0
@eiro
eiro / perl
Created March 20, 2019 17:24
lecture
sub { @{shift->{TrafficChecker}{Proxy}}{qw(Protocol Host Port)} = qw(https hello.com 1212) }
sub {
map { @$_{qw(Protocol Host Port)} = qw(https hello.com 1212) };
shift>{TrafficChecker}{Proxy}
}
sub ($self) {
map { @$_{qw(Protocol Host Port)} = qw(https hello.com 1212) };
$self->{TrafficChecker}{Proxy}
@eiro
eiro / gist:2da9cd61b3b4f65dd5a33d35b4ee765f
Created January 12, 2018 13:11
error while starting sympa (from buster, apt install sympa)
Created symlink /etc/systemd/system/multi-user.target.wants/sympa.service → /lib/systemd/system/sympa.service.
sympa-archived.service is a disabled or a static unit, not starting it.
sympa-bounced.service is a disabled or a static unit, not starting it.
sympa-bulk.service is a disabled or a static unit, not starting it.
sympa-task_manager.service is a disabled or a static unit, not starting it.
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
Affected packages: sympa:amd64
@eiro
eiro / outch.ksh
Created May 12, 2017 17:43
weird mksh local array ?
# i use MIRBSD KSH R54 2016/11/11
# i don't understand why if i uncomment this line
# set -u
# i get this message
# outch.ksh[21]: _m4a[@]: parameter not set
# as it seems _m4 works
_mma () {
@eiro
eiro / hello.pl
Created May 4, 2015 19:32
my first attempt to log
use vars qw($VERSION %IRSSI);
use Irssi;
use Eirotic;
use re '/x';
Irssi::signal_add "message public" , sub {
my ( $srv, $msg, $nick, $address, $target ) = @_;
state $fh = do {
open my $w, '>>','/tmp/logmetender';
@eiro
eiro / gist:5299751
Created April 3, 2013 09:31
ASN to MIR and ISO2709
#! /usr/bin/perl
use Modern::Perl;
use YAML;
use Perlude;
use MARC::MIR;
sub tokenize {
my @t;
push @t,{%+} while m{
\G\s*
sub parse_path (_) {
my %data;
@data{qw< name path file ext >} = map {
$_
, [split m(/)]
, m{
( # file
[^/]*?
( # ext
[^.]*?)) $ }x
@eiro
eiro / p5_ls_packlist.pl
Created January 27, 2013 23:28
remove cpan packlist and content
#! /usr/bin/perl
# usage: perl p5_ls_packlist.pl Perlude MARC::MIR | xargs rm
use Modern::Perl;
use File::Find::Rule;
use File::Slurp;
my $matches = do {
s,::,/,g for my @path = @ARGV;
my $pattern = sprintf '/(?:%s)/.packlist$', join '|', @path;