Skip to content

Instantly share code, notes, and snippets.

View nkh's full-sized avatar
💭
I may be slow to respond.

Nadim Khemir nkh

💭
I may be slow to respond.
View GitHub Profile
I took an example from Data::Dump::Tree (DDT)and started playing with Promises, the
goal was simply educative, I am following "Parallelism, Concurrency,
and Asynchrony in Perl 6" document to try the different mechanisms. The final goal
being the parallelization of DDT as it is too sluggish and also in preparation of
Asciio 2.0.
<jnthn>
1 will probably because the thread pool over-subscribes the CPU. Second is 'cus you exhausted the thread pool (16 is the number of threads it has by default). Third one may be a data race that's worth reporting.
Hi Jonathan,
I took an example from Data::Dump::Tree (DDT)and started playing with Promises, the
goal was simply educative, I am following your "Parallelism, Concurrency,
and Asynchrony in Perl 6" document to try the different mechanisms. The final goal
being the parallelization of DDT as it is too sluggish and also in preparation of
Asciio 2.0. Tell me if you want the development branch and the example on github to
check the problems below.
#!/bin/bash
# prompt matching function for tmux
# it can be also defined elsewhere
if ! type -t __copy_app_match_my_prompt 1> /dev/null ; then
__copy_app_match_my_prompt() { printf '^(\\\\033\\[[^m]+m)?[[:digit:]]+\ ' ; } # the way it looks for me in a tmux buffer
fi
last_command() { history -p !! | perl -pe 's/^\s*[0-9]+\s*//' | tr -d '\n' ; }
@nkh
nkh / piper
Created November 24, 2016 13:53
#!/usr/bin/env perl
use strict ;
use warnings ;
use Term::ANSIColor qw(color colorvalid) ;
# todo:
# local $Term::ANSIColor::AUTOLOCAL = 1;
# push /pop
# Xterm position
@nkh
nkh / tdu
Created November 14, 2016 22:25
#!/usr/bin/env perl
use strict ;
use warnings ;
use Getopt::Long;
use File::Find::Rule ;
use File::LsColor qw(ls_color);
tdu() ;
export bold='\e[01m'
export underlined='\e[04m'
export flashing='\e[05m'
export black='\e[30m'
export red='\e[31m'
export green='\e[32m'
export yellow='\e[33m'
export blue='\e[34m'
export magenta='\e[35m'
#!/bin/bash
file_tree()
{
pid="$1"
indentation=$(printf "%${indent}s")
[[ "$$" -eq "$pid" ]] && printf "$yellow"
echo "$indentation"$(ps -o pid= -o cmd= -p $pid | perl -pe 's/^\s+// ; s/\s+/,/')
#!/usr/bin/env perl
use strict ;
use warnings ;
# 256colors display index-rgb and small cubes
# 256colors index display system colors on background index
# 256colors R G B display system colors on background RGB
if(@ARGV == 1)
@nkh
nkh / color_pipe
Created September 29, 2016 20:24
put colors in pipes
#!/usr/bin/env perl
use strict ;
use warnings ;
use Term::ANSIColor ;
if (grep {/^--help/} @ARGV)
{
print <<'EOH' ;
Usage: $> command | color_pipe regex color [regex color ...] | command ...