Skip to content

Instantly share code, notes, and snippets.

@dakkar
dakkar / arrays.sh
Created June 11, 2014 16:38
Dealing with arrays in bash
#!/bin/bash
# this is *complicated*
#
# we want to be able to set an array to the value of another
# array. this is harder than it should be
#
# The call:
# _set_array foo 1 "2 3" "4 5 6"
# should execute:
@dakkar
dakkar / .gitignore
Created August 15, 2012 11:43 — forked from chizmeeple/.gitignore
MooseX::Types::Structured validation example
*.sw?
@dakkar
dakkar / spamdyke-cleaner
Created January 9, 2012 14:29
cronjob to clean spamdyke graylisting dir
#!/bin/bash
CONF=/etc/spamdyke/spamdyke.conf
graylist_dir=$(grep graylist-dir "$CONF");graylist_dir=${graylist_dir##*=}
graylist_max_secs=$(grep graylist-max-secs "$CONF");graylist_max_secs=${graylist_max_secs##*=}
find ${graylist_dir} -type f -mmin +$[ ${graylist_max_secs} / 60 ] -print0 | xargs -0 rm -f
@dakkar
dakkar / add-irpc
Created July 10, 2011 16:13
micro-patch for gas-preprocessor
# first way: in pre-processing
# before calling «parse_line($_)» from the «while» loop
if (/\.irpc\s+([\d\w.]+)\s*(.*)/) {
my ($id,$vals)=($1,$2);
my @vals = split //,$vals;
$_ = ".irp $id @vals";
}
# second way: in «parse_line»