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
@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 / 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 / .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
}
$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 / Rexfile
Last active May 29, 2017 16:51
Hidden tasks in Rex
task 'hidden', sub {
say q(Ssshh! I'm hiding!);
}, { dont_register => TRUE };
@ferki
ferki / Rexfile
Last active October 29, 2016 10:41
generate Rex CMDB pathes programmatically
use Rex -feature => [qw(1.4)];
set cmdb => {
type => 'YAML',
path => sub {
my ( $self, $item, $server ) = @_;
my @pathes;
push @pathes, "cmdb/hosts/$server.yml";
push @pathes, "cmdb/items/$item.yml";
use Rex -feature => [ '1.4', 'exec_autodie' ];
user 'myuser';
environment production => sub {
group destination => 'server1';
};
environment staging => sub {
group destination => 'server2';
@ferki
ferki / backup
Last active July 28, 2016 14:59
full system backup and restore with rsync
#!/bin/bash
source=${1:-/}
destination=${2:-/mnt/backup}
rsync --archive \
--hard-links --human-readable --inplace --numeric-ids \
--delete --delete-excluded --progress \
--exclude-from $source/home/ferki/.backup/filter \
$source $destination
@ferki
ferki / modulelist
Last active October 4, 2016 13:38
rex modules owned by ferki
Rex::Commands::Mkfs
Rex::Cron::FreeBSD
Rex::Helper::File::Spec
Rex::Helper::File::Stat
Rex::Helper::File::Stat::Unix
Rex::Helper::File::Stat::Win32
Rex::Helper::Rexfile::ParamLookup
Rex::Interface::Exec::IOReader
Rex::Pkg::Arch
Rex::Resource::firewall
@ferki
ferki / Rexfile
Created July 6, 2016 13:34
rex custom cmdb
set cmdb => {
type => 'YAML',
path => sub {
my ( $self, $item, $server ) = @_;
return ( "cmdb/$server.yml", "cmdb/default.yml" );
},
merge_behavior => 'LEFT_PRECEDENT',
};