From: Nicolas Boisselier Date: Thu, 19 Feb 2015 23:52:43 +0000 (+0000) Subject: nb-mails X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=09de1bd2d1e352c81ae18f49268f473e7f508044;p=nb.git nb-mails --- diff --git a/etc/bashrc.function b/etc/bashrc.function index 778bee52..8cc10cb0 100644 --- a/etc/bashrc.function +++ b/etc/bashrc.function @@ -24,6 +24,11 @@ case "$OSTYPE" in darwin*) esac +nb-mails() { + printf 'f *\nx\n' | mail | perl -e '@_=<>; shift @_; print shift @_; print reverse @_' +} + +nb-git-create() { # NB 19.02.15 root@pi:puppet# nb-git-create puppet/data # NB 19.02.15 Initialized empty Git repository in /home/git/puppet/data.git/ # NB 19.02.15 Cloning into 'data'... @@ -43,7 +48,6 @@ esac # NB 19.02.15 fatal: remote origin already exists. # NB 19.02.15 Branch master set up to track remote branch master from origin. # NB 19.02.15 Everything up-to-date -function nb-git-create() { declare name="${1%.git}" declare dir=$(basename $name) declare repo='git@git.nbdom.net' @@ -80,7 +84,7 @@ DESCRIPTION git remote add origin $repo:${name}.git } -function nb-git-clone() { +nb-git-clone() { git clone git@git.nbdom.net:${1%.git}.git } @@ -111,15 +115,15 @@ env-add-path() { echo "$env_value" } -function realpath() { +realpath() { perl -MFile::Spec -MCwd -e 'print File::Spec->rel2abs( Cwd::abs_path($ARGV[0]) )."\n"' $1 } -function ascii() { +ascii() { perl -e 'binmode(STDOUT, ":utf8"); for(32..255){ print "$_:".chr($_)."\n"; }' } -function psmem() { +psmem() { #ps -C $1 -O rss | xargs -r cat | gawk '\ #ps -p `pgrep -f $1` -O rss 2>/dev/null| xargs -r | gawk '\ ps=`ps ax -O rss 2>/dev/null` @@ -136,7 +140,7 @@ END { return } -function unzipurl() { +unzipurl() { declare url=$1 #declare file=`echo "$url"|sed 's,^.*?\([^/]+\.zip\)$,\1,'` declare file=`echo "$url"|awk -F/ '/\.zip$/ { print $NF }'` @@ -146,7 +150,7 @@ function unzipurl() { rm "$file" } -function bytes2h() { +bytes2h() { declare in="cat" args="" if [ "$1" == "-regex" ]; then args="regex=$2"