Skip to content

Instantly share code, notes, and snippets.

View ferki's full-sized avatar
🆓
I accept new customers

Ferenc Erki ferki

🆓
I accept new customers
View GitHub Profile
$include /etc/inputrc
# allow the use of the Delete/Insert keys
"\e[P": delete-char
"\e[4h": quoted-insert
"\e[5~": history-search-backward
"\e[6~": history-search-forward
set colored-stats On
@ferki
ferki / .bashrc
Created April 27, 2018 08:54
git bash prompt with elapsed time and return code
function timer_start {
timer=${timer:-$SECONDS}
}
function timer_stop {
exit_code=$?
timer_show=$(($SECONDS - $timer))
unset timer
}
@ferki
ferki / gist:c7cb8c37be953db9dd029d5655cbe18e
Created June 28, 2019 18:32
rexify-website indent count
3060 2
2023 4
340 9
309 10
285 12
255 1
232 3
171 8
153 5
114 7
@ferki
ferki / Rexfile
Created August 22, 2019 17:03
Rex+Minion
use strict;
use warnings;
use Rex -feature => [ '1.4', 'exec_autodie' ];
use Time::HiRes qw(time);
use Minion;
my $minion = Minion->new( SQLite => 'sqlite:/tmp/minion.backend' );
add_minion_tasks();
@ferki
ferki / Rexfile
Created August 22, 2019 17:04
Rex+MQTT
use strict;
use warnings;
use Rex -feature => [ '1.4', 'exec_autodie' ];
use Net::MQTT::Simple;
use Time::HiRes qw(time);
no_ssh task 'agent', sub {
my $mqtt = Net::MQTT::Simple->new('localhost');
$mqtt->run(
@ferki
ferki / Rexfile
Created August 26, 2019 18:18
Rex+inotify
use strict;
use warnings;
use Rex -feature => [ '1.4', 'exec_autodie' ];
use Linux::Inotify2;
use File::Basename qw(dirname);
use Time::HiRes qw(time tv_interval);
use DDP;
my $inotify = Linux::Inotify2->new();
@ferki
ferki / Rexfile
Last active February 27, 2023 22:53
rex sudo pass
use strict;
use warnings;
use Rex -feature => [ '1.4', 'exec_autodie' ];
sudo_password get_password('path/to/sudo/password/in/pass');
user 'myuser';
task 'a' => sub {
say run 'whoami'; # should be myuser
@ferki
ferki / Rexfile
Created January 26, 2020 22:15
Parallel task execution with Rex
use strict;
use warnings;
use Rex -feature => [ '1.4', 'exec_autodie' ];
use Parallel::Subs;
use Parallel::Forker;
desc 'Sleep for some time';
task 'rexsleep', sub {
my $params = shift;
@ferki
ferki / Rex::Hook::File::Diff.pm
Created January 27, 2020 17:59
Show diff of file changes during a Rex run
package Rex::Hook::File::Diff;
use strict;
use warnings;
use Rex -base;
use Rex::Hook;
use Text::Diff;
@ferki
ferki / Rexfile
Last active March 28, 2020 17:50
file encoding issue RexOps/Rex#1274
use Rex;
task 'files', sub {
# utf8 disabled
say 'disabling utf8 pragma';
no utf8;
my $file = '/tmp/test';
file $file, content => 'Daniel Böhmer';