mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 2650ae90cef0a58305e07ca104f17cb5338d7203
parent 665680e994ca7fc8103218e04704338de9ad14f7
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 27 Dec 2014 18:54:46 +0100

Merge branch 'master' of gitorious.org:mybin/mybin

Diffstat:
kiwix | 3+++
notmuch-backup.sh | 4++++
notmuch-cmd-bg.sh | 8++++++++
notmuch-cmd.sh | 8++++++++
notmuch-new.sh | 11+++++++++++
pdfmin | 8++++++++
startup | 11++++++-----
svn-wdiff | 3+++
unwrap | 8++++++++
wdiff-colours | 3+++
wdiff-colours.awk | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
wdiff-svn | 3+++
12 files changed, 149 insertions(+), 5 deletions(-)

diff --git a/kiwix b/kiwix @@ -0,0 +1,3 @@ +#!/bin/bash + +~/apps/kiwix/bin/kiwix-serve --port=3171 ~/USEFUL/wikipedia_en_all_nopic_01_2012.zim & diff --git a/notmuch-backup.sh b/notmuch-backup.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +mkdir -p ~/backup/notmuch +/usr/local/bin/notmuch dump > ~/backup/notmuch/dump-`date +%s` diff --git a/notmuch-cmd-bg.sh b/notmuch-cmd-bg.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -x +grep -i '^Message-id' | cut -d ' ' -f2 | tr -d '><' | while read l; +do + nohup notmuch "$@" id:$l >/dev/null 2>/dev/null & +done + diff --git a/notmuch-cmd.sh b/notmuch-cmd.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -x +grep -i '^Message-id' | cut -d ' ' -f2 | tr -d '><' | while read l; +do + notmuch "$@" id:$l +done | less + diff --git a/notmuch-new.sh b/notmuch-new.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +NEW_MAIL=~/temp/new_mail + +while true +do + nice ionice -c 3 chrt --idle 0 /bin/sh -c "notmuch new && afew --tag --new" + sleep 1 + inotifywait $NEW_MAIL +done + diff --git a/pdfmin b/pdfmin @@ -0,0 +1,8 @@ +#!/bin/bash + +TEMP=`mktemp` +PSOM="${1%.pdf}.psom.pdf" +cp $1 $1.bak +python ~/apps/pdfsizeopt-read-only/pdfsizeopt.py --use-jbig2=false --use-pngout=false $1 +mv $PSOM $1 + diff --git a/startup b/startup @@ -1,13 +1,14 @@ #!/bin/bash -~/scripts/proxy.sh -~/scripts/notmuch-new.sh & +~/bin_private/proxy.sh +~/bin/notmuch-new.sh & urxvtd & -fetchmail +~/bin_private/myfetchmail ~/bin/rehashpath nm-applet & -~/scripts/log +#~/bin_private/logkeys rm ~/temp/terminals ~/bin/layout -~/scripts/kiwix +#~/bin/kiwix xsetroot -solid '#000000' & + diff --git a/svn-wdiff b/svn-wdiff @@ -0,0 +1,3 @@ +#!/bin/sh + +svn diff --diff-cmd wdiff-svn "$@" diff --git a/unwrap b/unwrap @@ -0,0 +1,8 @@ +#!/bin/sh +# takes a wrapper script name and returns the wrapped program on stdout + +oldpath=${PATH} +here=`dirname $1` +export PATH=`echo ${PATH} | sed -e "s_${here}:__g"` +which `basename $1` +export PATH=${oldpath} diff --git a/wdiff-colours b/wdiff-colours @@ -0,0 +1,3 @@ +#!/bin/sh + +wdiff "$1" "$2" | awk -f `dirname $0`/wdiff-colours.awk diff --git a/wdiff-colours.awk b/wdiff-colours.awk @@ -0,0 +1,84 @@ +# awk program to clean up wdiff output +# prints one line of before and after context +# turns deletes red +# turns inserts green +# http://www.sable.mcgill.ca/~cpicke/swd/README + +BEGIN { + printing = 0; # true if we are in printing mode + printed_last = 0; # true if we printed the last line and it was not just context + first_match = 1; # true if we are at the first match + + color_context = "\033[0m\033[37m"; + color_insert = "\033[1m\033[32m"; + color_delete = "\033[1m\033[31m" + color_off = "\033[0m\033[00m"; + + printf "%s", color_context; +} + +END { + printf "%s", color_off; +} + +{ + should_print = 0; # true if we need to print the current line and it is not context + delete_start = gsub (/\[\-/, color_delete, $0); + delete_end = gsub (/\-\]/, color_context, $0); + insert_start = gsub (/{\+/, color_insert, $0); + insert_end = gsub (/\+}/, color_context, $0); + + # if we have any special tokens we need to print the current line + if (delete_start > 0 || + delete_end > 0 || + insert_start > 0 || + insert_end > 0) + { + should_print = 1; + } + # if there are more starts than ends we want to turn printing on + if (delete_start + insert_start > delete_end + insert_end) + { + printing = 1; + } + # if there are less starts than ends we want to turn printing off + if (delete_start + insert_start < delete_end + insert_end) + { + printing = 0; + } + if (printing) + { + should_print = 1; + } + if (should_print) + { + if (printed_last == 0) + { + # print before context unless it was already after context + if (last_NR != context_NR) + { + # print separators from the beginning of the second match + if (!first_match) + { + print "---"; + } + print last; + } + } + print; + first_match = 0; + printed_last = 1; + } + else + { + # print after context + if (printed_last == 1) + { + context_NR = NR; + print; + printed_last = 0; + } + } + last = $0; + last_NR = NR; +} diff --git a/wdiff-svn b/wdiff-svn @@ -0,0 +1,3 @@ +#!/bin/sh + +wdiff-colours "$6" "$7"