diff options
-rw-r--r-- | README.md (renamed from doc/README.mdwn) | 1 | ||||
-rw-r--r-- | TODO.md | 4 | ||||
-rwxr-xr-x | battery | 65 | ||||
-rwxr-xr-x | cdrecord | 23 | ||||
-rwxr-xr-x | chroot-chromium | 20 | ||||
-rwxr-xr-x | chroot-firefox | 20 | ||||
-rwxr-xr-x | commit | 145 | ||||
-rwxr-xr-x | csv2sc | 76 | ||||
-rwxr-xr-x | debian-dl | 87 | ||||
-rw-r--r-- | doc/TODO.md | 26 | ||||
-rwxr-xr-x | dupbackup (renamed from misc/dupbackup) | 0 | ||||
-rwxr-xr-x | firefox-profile | 9 | ||||
-rwxr-xr-x | git-subtree | 728 | ||||
-rwxr-xr-x | git-subtree-push | 33 | ||||
-rwxr-xr-x | git-subtree-update | 33 | ||||
-rwxr-xr-x | gitg | 6 | ||||
-rwxr-xr-x | gitlog-to-changelog | 433 | ||||
-rwxr-xr-x | gpg-agent-eval | 21 | ||||
-rwxr-xr-x | ical2rem | 279 | ||||
-rwxr-xr-x | image2ascii | 76 | ||||
-rwxr-xr-x | imgconv | 262 | ||||
-rwxr-xr-x | irssi-tor | 6 | ||||
-rwxr-xr-x | leds | 25 | ||||
-rwxr-xr-x | limbat | 67 | ||||
-rwxr-xr-x | lsign | 25 | ||||
-rw-r--r-- | migrate-scripts | 40 | ||||
-rwxr-xr-x | misc/email/checkmail | 14 | ||||
-rwxr-xr-x | misc/email/eml2mbox/eml2mbox.rb | 265 | ||||
-rw-r--r-- | misc/email/eml2mbox/licence.txt | 458 | ||||
-rwxr-xr-x | misc/email/estripa-emails.c | 50 | ||||
-rwxr-xr-x | misc/email/vcard-filter | 154 | ||||
-rwxr-xr-x | misc/parse-remind | 41 | ||||
-rw-r--r-- | misc/sed/entities.sed | 24 | ||||
-rwxr-xr-x | misc/sed/justify.sed | 68 | ||||
-rw-r--r-- | misc/sed/mail-iso2txt.sed | 55 | ||||
-rw-r--r-- | misc/sed/mini-html2latex.sed | 9 | ||||
-rw-r--r-- | misc/sed/syndication.sed | 27 | ||||
-rwxr-xr-x | misc/sed/twiki-to-tiki.sed | 14 | ||||
-rw-r--r-- | misc/sed/unicode-zoado.sed | 11 | ||||
-rwxr-xr-x | misc/sed/wrap-forced.sed | 46 | ||||
-rw-r--r-- | misc/sed/yahoogroups-kill-sig.sed | 248 | ||||
-rwxr-xr-x | mutt-notmuch-tag | 21 | ||||
-rwxr-xr-x | philter.py | 83 | ||||
-rwxr-xr-x | philter.sh | 67 | ||||
l--------- | playlist-copy | 1 | ||||
l--------- | playlist-drop | 1 | ||||
-rwxr-xr-x | playlist-get | 65 | ||||
-rwxr-xr-x | playlist-ls | 16 | ||||
-rw-r--r-- | prompt | 50 | ||||
-rwxr-xr-x | rem2ics | 31 | ||||
-rwxr-xr-x | sc2csv | 73 | ||||
-rwxr-xr-x | shell | 54 | ||||
l--------- | shells | 1 | ||||
-rwxr-xr-x | skype | 14 | ||||
-rwxr-xr-x | ssh-agent-eval | 46 | ||||
-rwxr-xr-x | ssl | 49 | ||||
-rwxr-xr-x | start-streaming | 54 | ||||
l--------- | sync-all | 1 | ||||
-rwxr-xr-x | sync-code | 51 | ||||
l--------- | sync-home | 1 | ||||
l--------- | sync-irssi | 1 | ||||
l--------- | sync-irssi-tor | 1 | ||||
-rwxr-xr-x | tails-dl | 45 | ||||
-rwxr-xr-x | telneter (renamed from misc/telneter) | 0 | ||||
-rwxr-xr-x | terminal | 38 | ||||
-rwxr-xr-x | timelog | 49 | ||||
-rwxr-xr-x | tor-browser | 16 | ||||
-rwxr-xr-x | tor-browser-dl | 70 | ||||
-rwxr-xr-x | ttyttertor | 6 | ||||
-rwxr-xr-x | vbox | 39 | ||||
-rwxr-xr-x | wav2dao | 71 | ||||
-rwxr-xr-x | wifi (renamed from misc/wifi) | 0 | ||||
-rwxr-xr-x | wscreen | 39 | ||||
-rwxr-xr-x | xconky | 57 | ||||
-rwxr-xr-x | xhibernate | 8 | ||||
-rwxr-xr-x | xlock | 6 | ||||
-rwxr-xr-x | xmutt | 6 | ||||
-rwxr-xr-x | xsuspend | 8 | ||||
-rwxr-xr-x | xwicd | 10 | ||||
-rwxr-xr-x | xwyrd | 13 |
80 files changed, 44 insertions, 5112 deletions
diff --git a/doc/README.mdwn b/README.md index 2d403a4..722dbcf 100644 --- a/doc/README.mdwn +++ b/README.md @@ -2,4 +2,3 @@ Misc scripts ============ This is a collection of simple scripts to be available on $PATH. - @@ -0,0 +1,4 @@ +TODO +==== + +* Empty! :) diff --git a/battery b/battery deleted file mode 100755 index 0fe1aeb..0000000 --- a/battery +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# See http://blog.lick-me.org/2013/08/yet-another-battery-widget-awesome-3-5-1/ -# - -# Returns battery charge as a percentage. -# Thanks http://blmath.wordpress.com/2010/03/19/bash-function-to-get-battery-charge/ -function battery_charge { - now=`cat /sys/class/power_supply/BAT0/energy_now` - full=`cat /sys/class/power_supply/BAT0/energy_full` - out=`echo $now/$full*100 | bc -l | cut -c 1-5` - - echo $out | sed -e 's/\./,/g' - #echo "Charge: "$out"%" -} - -# Returns battery capacity as a percentage. -# Thanks http://blmath.wordpress.com/2010/03/19/bash-function-to-get-battery-charge/ -function battery_capacity { - design=`cat /sys/class/power_supply/BAT0/energy_full_design` - current=`cat /sys/class/power_supply/BAT0/energy_full` - out=`echo $current/$design*100 | bc -l | cut -c 1-5` - - echo $out | sed -e 's/\./,/g' - #echo "Capacity: "$out"%" -} - -# Basic parameters -healthy='#859900' -low='#b58900' -discharge='#dc322f' - -# Abort if no battery is available -if [ ! -e "/sys/class/power_supply/BAT0" ]; then - exit -fi - -# Get battery status -if [ -e "/sys/class/power_supply/BAT0/charge" ]; then - charge=`cat /sys/class/power_supply/BAT0/charge` -else - charge="`battery_charge`" -fi - -# Set battery level indication -if ((`echo $charge | cut -d ',' -f 1` <= 25)); then - chargeColor=$low -else - chargeColor=$healthy -fi - -# Get battery status -status=`cat /sys/class/power_supply/BAT0/status` - -# Set battery status indication -if [[ "$status" = "Discharging" ]]; then - statusColor=$discharge - status="▼" -else - statusColor=$healthy - status="▲" -fi - -# Output -echo "<span color=\"$chargeColor\">$charge%</span> <span color=\"$statusColor\">$status</span>" diff --git a/cdrecord b/cdrecord deleted file mode 100755 index 50cd977..0000000 --- a/cdrecord +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Record an audio cd based on wav files in a folder -# - -if [ -z "$1" ] && [ -d "$1" ]; then - CWD="`pwd`" - cd $1 -fi - -echo CD_DA > toc - -for file in *.wav; do - echo >> toc - echo TRACK AUDIO >> toc - echo FILE \"$file\" 0 >> toc -done - -cdrdao write --speed 8x --device /dev/cdrom1 toc - -if [ ! -z "$CWD" ]; then - cd $CWD -fi diff --git a/chroot-chromium b/chroot-chromium deleted file mode 100755 index bc7ed38..0000000 --- a/chroot-chromium +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Chroot wrapper -# - -if [ -z "$1" ]; then - chroot="wheezy" -else - chroot="$1" -fi - -# Load configuration -if [ -e "$HOME/.config/scripts/chroot" ]; then - source $HOME/.config/scripts/chroot -fi - -xhost local:$CHROOT_USER -sudo su $CHROOT_USER -c "schroot -d /home/$CHROOT_USER -c $chroot -p chromium-browser" & -sleep 1 -xhost - diff --git a/chroot-firefox b/chroot-firefox deleted file mode 100755 index 5f78555..0000000 --- a/chroot-firefox +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Chroot wrapper -# - -if [ -z "$1" ]; then - chroot="wheezy" -else - chroot="$1" -fi - -# Load configuration -if [ -e "$HOME/.config/scripts/chroot" ]; then - source $HOME/.config/scripts/chroot -fi - -xhost local:$CHROOT_USER -sudo su $CHROOT_USER -c "schroot -d /home/$CHROOT_USER -c $chroot -p iceweasel" & -sleep 1 -xhost - @@ -1,145 +0,0 @@ -#!/bin/bash -# -# Commit both on git and svn -# - -# Parameters -ARGS="$*" - -# Check if a file is inside a git repository -# Usage: git_folder <file> -function git_folder { - - local folder="$1" folder folders dir_list cwd - - if [ -d "$folder/.git" ]; then - GIT_FOLDER="$folder" - return - fi - - # reverse folder order - dir_list="`echo $folder | tr '/' ' '`" - for i in $dir_list; do - folders="$i $folders" - done - - cwd="`pwd`" - cd $folder - - for i in $folders; do - cd .. - if [ -d "$(pwd)/.git" ]; then - GIT_FOLDER="$(pwd)" - cd $cwd - return - fi - done - - cd $cwd - return 1 - -} - -# Check if a folder is inside a git repository -function is_git { - # simple git folder checker - # usage: is_git <folder> - if [ -z "$1" ]; then - return 1 - elif [ ! -d "$1" ]; then - return 1 - elif [ -d "$1/.git" ]; then - return - else - ( cd "$1" && git status &> /dev/null ) - - if [ "$?" != "128" ]; then - return - else - return 1 - fi - fi -} - -# Check if a folder is inside a svn repository -function is_svn { - # simple svn folder checker - # usage: is_svn <folder> - - if [ -d "$1/.svn" ]; then - return - else - return 1 - fi -} - -# Push to repositories -function git_push { - if [ "`git remote | wc -l`" == "0" ]; then - return - elif git remote | grep -q 'all'; then - git push all --all - elif git remote | grep -q 'origin'; then - echo "Please configure the 'all' remote first." - exit 1 - #git push --all - fi -} - -# Check user information -function git_user { - if [ -z "`git config --local user.email`" ] || [ -z "`git config --local user.name`" ]; then - if echo $ARGS | grep -q -- '--config'; then - if grep -q "^\[user\]" $HOME/.gitconfig; then - grep -A 2 "^\[user\]" $HOME/.gitconfig >> $GIT_FOLDER/.git/config - else - grep -A 2 "^\[user\]" $HOME/.custom/gitconfig >> $GIT_FOLDER/.git/config - fi - else - - echo "No user configuration section found in the repository." - echo "This might be a privacy issue" - echo "" - - if [ -e "$HOME/.custom/gitconfig" ]; then - echo "You should try to use your default setting:" - echo "" - - if [ "$GIT_FOLDER" == "$(pwd)" ]; then - echo "cat <<EOF >> .git/config" - else - echo "cat <<EOF >> $GIT_FOLDER/.git/config" - fi - grep -A 2 "^\[user\]" $HOME/.custom/gitconfig - echo "EOF" - - echo "" - echo "Use --config if you want these lines to be added at .git/config" - fi - - exit 1 - - fi - fi -} - -# Commit changes -function git_commit { - # Remove '--config' from args, otherwise it goes to the commit log - params="`echo $* | sed -e 's/--config//'`" - git commit -a -m "$params" -} - -# Main -if [ ! -z "$1" ]; then - if is_svn .; then - svn commit -m "$*" - fi - - if is_git .; then - git_folder $(pwd) - git_user - git_commit $* - git_push - fi -fi @@ -1,76 +0,0 @@ -#!/usr/bin/gawk -f -# -# csv2sc ver. 0.1 (2001/12/4) -# Copyright (C) 2001 SIGEHUZI Tomoo (tomoo@s.email.ne.jp) - -function is_date(s) { - if (split(s, date, "/") != 3) return 0; - if (date[1] !~ /(19|20)?[0-9][0-9]/) return 0; - if (date[2] !~ /(0?[1-9]|1[012])/) return 0; - if (date[2] !~ /(0?[1-9]|[12][0-9]|3[01])/) return 0; - return 1; -} - -function i_index(n, i, s) { - s = ""; - for (s = ""; ; n = (n - i) / nix - 1) { - i = n % nix; - s = sprintf("%s%s", ix[i], s); - if (n < 1) break; - } - return s; -} - -BEGIN { - nix = split("BCDEFGHIJKLMNOPQRSTUVWXYZ", ix, "") + 1; - ix[0] = "A"; -} - -{ - s = sprintf("%s%s", s, $0); - np += gsub(/"/, "\a"); - if (np % 2) { - s = sprintf("%s\n", s); - next; - } - m = n = split(s, a, ","); - - np = 0; - s = ""; - for (i = j = 1; i <= n; i++) { - s = sprintf("%s%s", s, a[i]); - np += gsub(/"/, "\a", a[i]); - if (np % 2) { - s = sprintf("%s,", s); - continue; - } - np = 0; - a[j++] = s; - s = ""; - } - n = j - 1; - for (i = 1; i <= n; i++) { - s = a[i]; - sub(/^"/, "", s); - sub(/"$/, "", s); - gsub(/\\/, "\\\\", s); - gsub(/""/, "\\\"", s); - gsub(/\n/, "\\n", s); - gsub(/\t/, "\\t", s); - a[i] = s; - } - - for (i = 1; i <= n; i++) { - s = a[i]; - I = i_index(i - 1); - if (s ~ /^[0-9.]+$/) printf("let %s%d = %s\n", I, J, s); - else if (is_date(s)) - printf("let %s%d = @dts(%d,%d,%d)\nfmt %s%d \"\004%%Y/%%m/%%d\"\n", - I, J, date[1], date[2], date[3], I, J); - else printf("leftstring %s%d = \"%s\"\n", I, J, s); - } - - J++; - np = 0; - s = ""; -} diff --git a/debian-dl b/debian-dl deleted file mode 100755 index 3558085..0000000 --- a/debian-dl +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# Simple Debian image downloader. -# - -# Parameters -HASHES="MD5SUMS SHA1SUMS SHA256SUMS SHA512SUMS" - -# Arguments -BASENAME="`basename $0`" -URL="$1" -BASE="`dirname $URL`" -RATE="$2" -FILENAME="`basename $URL`" - -# Syntax -if [ -z "$1" ]; then - echo "usage: $BASENAME <image-url>" - exit 1 -fi - -# Determine signature extension -if echo $FILENAME | grep -qe '^debian-live'; then - SIGN="sig" -else - SIGN="sign" -fi - -# Fetch hashes -for hash in $HASHES; do - wget -c $BASE/$hash - wget -c $BASE/$hash.$SIGN -done - -# Determine transfer method -if echo $FILENAME | grep -qe '.jigdo$'; then - # Check for jigdo - if ! which jigdo-lite &> /dev/null; then - echo "Please install jigdo-file" - exit 1 - fi - - # Get the image using jigdo - jigdo-lite $URL - - # Fix filename - FILENAME="`basename $FILENAME .jigdo`.iso" -elif echo $FILENAME | grep -qe '.zsync$'; then - # Check for zsync - if ! which zsync &> /dev/null; then - echo "Please install zsync" - exit 1 - fi - - # Get the image using zsync - zsync $URL - - # Fix filename - FILENAME="`basename $FILENAME .zsync`" -else - # Check for wget - if ! which wget &> /dev/null; then - echo "Please install wget" - exit 1 - fi - - # Set rate limit - if [ ! -z "$RATE" ]; then - LIMIT="--limit-rate=$RATE" - fi - - # Get the image using wget - wget -c $LIMIT $URL -fi - -# Check hashes -for hash in $HASHES; do - echo "Checking $FILENAME against $hash file..." - check="`echo $hash | tr '[:upper:]' '[:lower:]' | sed -e 's/s$//'`" - grep -e "$FILENAME$" $hash | $check -c -done - -# Check hash integrity -for hash in $HASHES; do - echo "Checking $hash.$SIGN..." - gpg --verify $hash.$SIGN -done diff --git a/doc/TODO.md b/doc/TODO.md deleted file mode 100644 index 3e29861..0000000 --- a/doc/TODO.md +++ /dev/null @@ -1,26 +0,0 @@ -TODO -==== - -* Split scripts: - * Into separate, specific repositories. - * Leave here only those which don't fit a specific criteria. - * Submit all other repositories "upstream" to apps.git repo. - -* Enhance vbox: - * Support more VBoxManage commands. - * Iteration over a set of VMs. - * Support for upgrading VMs. - * Vagrant integration. - -* Write a "git" interceptor: - * Check proper user/email config. - * Automatically set git-flow when initializing a repository. - * Automatically set git-hooks integration. - * Implement global hooks. - * Check remote configuration. - -* Enhance shell: - * Add a counter-measure to prevent this attack: - http://users.ece.cmu.edu/~dawnsong/papers/ssh-timing.pdf - http://www.slideshare.net/idsecconf/countermeasure-against-timing-attack-on-ssh-using-random-delay - http://www.scribd.com/doc/59628153/Timing-Analysis-of-Keystrokes-and-Timing-Attacks-on-SSH-Revisited diff --git a/misc/dupbackup b/dupbackup index f020c36..f020c36 100755 --- a/misc/dupbackup +++ b/dupbackup diff --git a/firefox-profile b/firefox-profile deleted file mode 100755 index 8c06a5f..0000000 --- a/firefox-profile +++ /dev/null @@ -1,9 +0,0 @@ -# -# Wrapper around firefox -# - -if [ ! -z "$1" ]; then - iceweasel -p $1 --no-remote & -else - iceweasel --profilemanager -no-remote -fi diff --git a/git-subtree b/git-subtree deleted file mode 100755 index 8d8ff14..0000000 --- a/git-subtree +++ /dev/null @@ -1,728 +0,0 @@ -#!/bin/sh -# -# git-subtree.sh: split/join git repositories in subdirectories of this one -# -# Copyright (C) 2009 Avery Pennarun <apenwarr@gmail.com> -# -# TODO: remove this file from the scripts repository once it's shipped correctly -# into Debian. -# -if [ $# -eq 0 ]; then - set -- -h -fi -OPTS_SPEC="\ -git subtree add --prefix=<prefix> <commit> -git subtree add --prefix=<prefix> <repository> <commit> -git subtree merge --prefix=<prefix> <commit> -git subtree pull --prefix=<prefix> <repository> <refspec...> -git subtree push --prefix=<prefix> <repository> <refspec...> -git subtree split --prefix=<prefix> <commit...> --- -h,help show the help -q quiet -d show debug messages -P,prefix= the name of the subdir to split out -m,message= use the given message as the commit message for the merge commit - options for 'split' -annotate= add a prefix to commit message of new commits -b,branch= create a new branch from the split subtree -ignore-joins ignore prior --rejoin commits -onto= try connecting new tree to an existing one -rejoin merge the new branch back into HEAD - options for 'add', 'merge', 'pull' and 'push' -squash merge subtree changes as a single commit -" -eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)" - -PATH=$PATH:$(git --exec-path) -. git-sh-setup - -require_work_tree - -quiet= -branch= -debug= -command= -onto= -rejoin= -ignore_joins= -annotate= -squash= -message= - -debug() -{ - if [ -n "$debug" ]; then - echo "$@" >&2 - fi -} - -say() -{ - if [ -z "$quiet" ]; then - echo "$@" >&2 - fi -} - -assert() -{ - if "$@"; then - : - else - die "assertion failed: " "$@" - fi -} - - -#echo "Options: $*" - -while [ $# -gt 0 ]; do - opt="$1" - shift - case "$opt" in - -q) quiet=1 ;; - -d) debug=1 ;; - --annotate) annotate="$1"; shift ;; - --no-annotate) annotate= ;; - -b) branch="$1"; shift ;; - -P) prefix="$1"; shift ;; - -m) message="$1"; shift ;; - --no-prefix) prefix= ;; - --onto) onto="$1"; shift ;; - --no-onto) onto= ;; - --rejoin) rejoin=1 ;; - --no-rejoin) rejoin= ;; - --ignore-joins) ignore_joins=1 ;; - --no-ignore-joins) ignore_joins= ;; - --squash) squash=1 ;; - --no-squash) squash= ;; - --) break ;; - *) die "Unexpected option: $opt" ;; - esac -done - -command="$1" -shift -case "$command" in - add|merge|pull) default= ;; - split|push) default="--default HEAD" ;; - *) die "Unknown command '$command'" ;; -esac - -if [ -z "$prefix" ]; then - die "You must provide the --prefix option." -fi - -case "$command" in - add) [ -e "$prefix" ] && - die "prefix '$prefix' already exists." ;; - *) [ -e "$prefix" ] || - die "'$prefix' does not exist; use 'git subtree add'" ;; -esac - -dir="$(dirname "$prefix/.")" - -if [ "$command" != "pull" -a "$command" != "add" -a "$command" != "push" ]; then - revs=$(git rev-parse $default --revs-only "$@") || exit $? - dirs="$(git rev-parse --no-revs --no-flags "$@")" || exit $? - if [ -n "$dirs" ]; then - die "Error: Use --prefix instead of bare filenames." - fi -fi - -debug "command: {$command}" -debug "quiet: {$quiet}" -debug "revs: {$revs}" -debug "dir: {$dir}" -debug "opts: {$*}" -debug - -cache_setup() -{ - cachedir="$GIT_DIR/subtree-cache/$$" - rm -rf "$cachedir" || die "Can't delete old cachedir: $cachedir" - mkdir -p "$cachedir" || die "Can't create new cachedir: $cachedir" - mkdir -p "$cachedir/notree" || die "Can't create new cachedir: $cachedir/notree" - debug "Using cachedir: $cachedir" >&2 -} - -cache_get() -{ - for oldrev in $*; do - if [ -r "$cachedir/$oldrev" ]; then - read newrev <"$cachedir/$oldrev" - echo $newrev - fi - done -} - -cache_miss() -{ - for oldrev in $*; do - if [ ! -r "$cachedir/$oldrev" ]; then - echo $oldrev - fi - done -} - -check_parents() -{ - missed=$(cache_miss $*) - for miss in $missed; do - if [ ! -r "$cachedir/notree/$miss" ]; then - debug " incorrect order: $miss" - fi - done -} - -set_notree() -{ - echo "1" > "$cachedir/notree/$1" -} - -cache_set() -{ - oldrev="$1" - newrev="$2" - if [ "$oldrev" != "latest_old" \ - -a "$oldrev" != "latest_new" \ - -a -e "$cachedir/$oldrev" ]; then - die "cache for $oldrev already exists!" - fi - echo "$newrev" >"$cachedir/$oldrev" -} - -rev_exists() -{ - if git rev-parse "$1" >/dev/null 2>&1; then - return 0 - else - return 1 - fi -} - -rev_is_descendant_of_branch() -{ - newrev="$1" - branch="$2" - branch_hash=$(git rev-parse $branch) - match=$(git rev-list -1 $branch_hash ^$newrev) - - if [ -z "$match" ]; then - return 0 - else - return 1 - fi -} - -# if a commit doesn't have a parent, this might not work. But we only want -# to remove the parent from the rev-list, and since it doesn't exist, it won't -# be there anyway, so do nothing in that case. -try_remove_previous() -{ - if rev_exists "$1^"; then - echo "^$1^" - fi -} - -find_latest_squash() -{ - debug "Looking for latest squash ($dir)..." - dir="$1" - sq= - main= - sub= - git log --grep="^git-subtree-dir: $dir/*\$" \ - --pretty=format:'START %H%n%s%n%n%b%nEND%n' HEAD | - while read a b junk; do - debug "$a $b $junk" - debug "{{$sq/$main/$sub}}" - case "$a" in - START) sq="$b" ;; - git-subtree-mainline:) main="$b" ;; - git-subtree-split:) sub="$b" ;; - END) - if [ -n "$sub" ]; then - if [ -n "$main" ]; then - # a rejoin commit? - # Pretend its sub was a squash. - sq="$sub" - fi - debug "Squash found: $sq $sub" - echo "$sq" "$sub" - break - fi - sq= - main= - sub= - ;; - esac - done -} - -find_existing_splits() -{ - debug "Looking for prior splits..." - dir="$1" - revs="$2" - main= - sub= - git log --grep="^git-subtree-dir: $dir/*\$" \ - --pretty=format:'START %H%n%s%n%n%b%nEND%n' $revs | - while read a b junk; do - case "$a" in - START) sq="$b" ;; - git-subtree-mainline:) main="$b" ;; - git-subtree-split:) sub="$b" ;; - END) - debug " Main is: '$main'" - if [ -z "$main" -a -n "$sub" ]; then - # squash commits refer to a subtree - debug " Squash: $sq from $sub" - cache_set "$sq" "$sub" - fi - if [ -n "$main" -a -n "$sub" ]; then - debug " Prior: $main -> $sub" - cache_set $main $sub - cache_set $sub $sub - try_remove_previous "$main" - try_remove_previous "$sub" - fi - main= - sub= - ;; - esac - done -} - -copy_commit() -{ - # We're going to set some environment vars here, so - # do it in a subshell to get rid of them safely later - debug copy_commit "{$1}" "{$2}" "{$3}" - git log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' "$1" | - ( - read GIT_AUTHOR_NAME - read GIT_AUTHOR_EMAIL - read GIT_AUTHOR_DATE - read GIT_COMMITTER_NAME - read GIT_COMMITTER_EMAIL - read GIT_COMMITTER_DATE - export GIT_AUTHOR_NAME \ - GIT_AUTHOR_EMAIL \ - GIT_AUTHOR_DATE \ - GIT_COMMITTER_NAME \ - GIT_COMMITTER_EMAIL \ - GIT_COMMITTER_DATE - (printf "%s" "$annotate"; cat ) | - git commit-tree "$2" $3 # reads the rest of stdin - ) || die "Can't copy commit $1" -} - -add_msg() -{ - dir="$1" - latest_old="$2" - latest_new="$3" - if [ -n "$message" ]; then - commit_message="$message" - else - commit_message="Add '$dir/' from commit '$latest_new'" - fi - cat <<-EOF - $commit_message - - git-subtree-dir: $dir - git-subtree-mainline: $latest_old - git-subtree-split: $latest_new - EOF -} - -add_squashed_msg() -{ - if [ -n "$message" ]; then - echo "$message" - else - echo "Merge commit '$1' as '$2'" - fi -} - -rejoin_msg() -{ - dir="$1" - latest_old="$2" - latest_new="$3" - if [ -n "$message" ]; then - commit_message="$message" - else - commit_message="Split '$dir/' into commit '$latest_new'" - fi - cat <<-EOF - $commit_message - - git-subtree-dir: $dir - git-subtree-mainline: $latest_old - git-subtree-split: $latest_new - EOF -} - -squash_msg() -{ - dir="$1" - oldsub="$2" - newsub="$3" - newsub_short=$(git rev-parse --short "$newsub") - - if [ -n "$oldsub" ]; then - oldsub_short=$(git rev-parse --short "$oldsub") - echo "Squashed '$dir/' changes from $oldsub_short..$newsub_short" - echo - git log --pretty=tformat:'%h %s' "$oldsub..$newsub" - git log --pretty=tformat:'REVERT: %h %s' "$newsub..$oldsub" - else - echo "Squashed '$dir/' content from commit $newsub_short" - fi - - echo - echo "git-subtree-dir: $dir" - echo "git-subtree-split: $newsub" -} - -toptree_for_commit() -{ - commit="$1" - git log -1 --pretty=format:'%T' "$commit" -- || exit $? -} - -subtree_for_commit() -{ - commit="$1" - dir="$2" - git ls-tree "$commit" -- "$dir" | - while read mode type tree name; do - assert [ "$name" = "$dir" ] - assert [ "$type" = "tree" -o "$type" = "commit" ] - [ "$type" = "commit" ] && continue # ignore submodules - echo $tree - break - done -} - -tree_changed() -{ - tree=$1 - shift - if [ $# -ne 1 ]; then - return 0 # weird parents, consider it changed - else - ptree=$(toptree_for_commit $1) - if [ "$ptree" != "$tree" ]; then - return 0 # changed - else - return 1 # not changed - fi - fi -} - -new_squash_commit() -{ - old="$1" - oldsub="$2" - newsub="$3" - tree=$(toptree_for_commit $newsub) || exit $? - if [ -n "$old" ]; then - squash_msg "$dir" "$oldsub" "$newsub" | - git commit-tree "$tree" -p "$old" || exit $? - else - squash_msg "$dir" "" "$newsub" | - git commit-tree "$tree" || exit $? - fi -} - -copy_or_skip() -{ - rev="$1" - tree="$2" - newparents="$3" - assert [ -n "$tree" ] - - identical= - nonidentical= - p= - gotparents= - for parent in $newparents; do - ptree=$(toptree_for_commit $parent) || exit $? - [ -z "$ptree" ] && continue - if [ "$ptree" = "$tree" ]; then - # an identical parent could be used in place of this rev. - identical="$parent" - else - nonidentical="$parent" - fi - - # sometimes both old parents map to the same newparent; - # eliminate duplicates - is_new=1 - for gp in $gotparents; do - if [ "$gp" = "$parent" ]; then - is_new= - break - fi - done - if [ -n "$is_new" ]; then - gotparents="$gotparents $parent" - p="$p -p $parent" - fi - done - - if [ -n "$identical" ]; then - echo $identical - else - copy_commit $rev $tree "$p" || exit $? - fi -} - -ensure_clean() -{ - if ! git diff-index HEAD --exit-code --quiet 2>&1; then - die "Working tree has modifications. Cannot add." - fi - if ! git diff-index --cached HEAD --exit-code --quiet 2>&1; then - die "Index has modifications. Cannot add." - fi -} - -cmd_add() -{ - if [ -e "$dir" ]; then - die "'$dir' already exists. Cannot add." - fi - - ensure_clean - - if [ $# -eq 1 ]; then - git rev-parse -q --verify "$1^{commit}" >/dev/null || - die "'$1' does not refer to a commit" - - "cmd_add_commit" "$@" - elif [ $# -eq 2 ]; then - # Technically we could accept a refspec here but we're - # just going to turn around and add FETCH_HEAD under the - # specified directory. Allowing a refspec might be - # misleading because we won't do anything with any other - # branches fetched via the refspec. - git rev-parse -q --verify "$2^{commit}" >/dev/null || - die "'$2' does not refer to a commit" - - "cmd_add_repository" "$@" - else - say "error: parameters were '$@'" - die "Provide either a commit or a repository and commit." - fi -} - -cmd_add_repository() -{ - echo "git fetch" "$@" - repository=$1 - refspec=$2 - git fetch "$@" || exit $? - revs=FETCH_HEAD - set -- $revs - cmd_add_commit "$@" -} - -cmd_add_commit() -{ - revs=$(git rev-parse $default --revs-only "$@") || exit $? - set -- $revs - rev="$1" - - debug "Adding $dir as '$rev'..." - git read-tree --prefix="$dir" $rev || exit $? - git checkout -- "$dir" || exit $? - tree=$(git write-tree) || exit $? - - headrev=$(git rev-parse HEAD) || exit $? - if [ -n "$headrev" -a "$headrev" != "$rev" ]; then - headp="-p $headrev" - else - headp= - fi - - if [ -n "$squash" ]; then - rev=$(new_squash_commit "" "" "$rev") || exit $? - commit=$(add_squashed_msg "$rev" "$dir" | - git commit-tree $tree $headp -p "$rev") || exit $? - else - commit=$(add_msg "$dir" "$headrev" "$rev" | - git commit-tree $tree $headp -p "$rev") || exit $? - fi - git reset "$commit" || exit $? - - say "Added dir '$dir'" -} - -cmd_split() -{ - debug "Splitting $dir..." - cache_setup || exit $? - - if [ -n "$onto" ]; then - debug "Reading history for --onto=$onto..." - git rev-list $onto | - while read rev; do - # the 'onto' history is already just the subdir, so - # any parent we find there can be used verbatim - debug " cache: $rev" - cache_set $rev $rev - done - fi - - if [ -n "$ignore_joins" ]; then - unrevs= - else - unrevs="$(find_existing_splits "$dir" "$revs")" - fi - - # We can't restrict rev-list to only $dir here, because some of our - # parents have the $dir contents the root, and those won't match. - # (and rev-list --follow doesn't seem to solve this) - grl='git rev-list --topo-order --reverse --parents $revs $unrevs' - revmax=$(eval "$grl" | wc -l) - revcount=0 - createcount=0 - eval "$grl" | - while read rev parents; do - revcount=$(($revcount + 1)) - say -n "$revcount/$revmax ($createcount)
" - debug "Processing commit: $rev" - exists=$(cache_get $rev) - if [ -n "$exists" ]; then - debug " prior: $exists" - continue - fi - createcount=$(($createcount + 1)) - debug " parents: $parents" - newparents=$(cache_get $parents) - debug " newparents: $newparents" - - tree=$(subtree_for_commit $rev "$dir") - debug " tree is: $tree" - - check_parents $parents - - # ugly. is there no better way to tell if this is a subtree - # vs. a mainline commit? Does it matter? - if [ -z $tree ]; then - set_notree $rev - if [ -n "$newparents" ]; then - cache_set $rev $rev - fi - continue - fi - - newrev=$(copy_or_skip "$rev" "$tree" "$newparents") || exit $? - debug " newrev is: $newrev" - cache_set $rev $newrev - cache_set latest_new $newrev - cache_set latest_old $rev - done || exit $? - latest_new=$(cache_get latest_new) - if [ -z "$latest_new" ]; then - die "No new revisions were found" - fi - - if [ -n "$rejoin" ]; then - debug "Merging split branch into HEAD..." - latest_old=$(cache_get latest_old) - git merge -s ours \ - -m "$(rejoin_msg $dir $latest_old $latest_new)" \ - $latest_new >&2 || exit $? - fi - if [ -n "$branch" ]; then - if rev_exists "refs/heads/$branch"; then - if ! rev_is_descendant_of_branch $latest_new $branch; then - die "Branch '$branch' is not an ancestor of commit '$latest_new'." - fi - action='Updated' - else - action='Created' - fi - git update-ref -m 'subtree split' "refs/heads/$branch" $latest_new || exit $? - say "$action branch '$branch'" - fi - echo $latest_new - exit 0 -} - -cmd_merge() -{ - revs=$(git rev-parse $default --revs-only "$@") || exit $? - ensure_clean - - set -- $revs - if [ $# -ne 1 ]; then - die "You must provide exactly one revision. Got: '$revs'" - fi - rev="$1" - - if [ -n "$squash" ]; then - first_split="$(find_latest_squash "$dir")" - if [ -z "$first_split" ]; then - die "Can't squash-merge: '$dir' was never added." - fi - set $first_split - old=$1 - sub=$2 - if [ "$sub" = "$rev" ]; then - say "Subtree is already at commit $rev." - exit 0 - fi - new=$(new_squash_commit "$old" "$sub" "$rev") || exit $? - debug "New squash commit: $new" - rev="$new" - fi - - version=$(git version) - if [ "$version" \< "git version 1.7" ]; then - if [ -n "$message" ]; then - git merge -s subtree --message="$message" $rev - else - git merge -s subtree $rev - fi - else - if [ -n "$message" ]; then - git merge -Xsubtree="$prefix" --message="$message" $rev - else - git merge -Xsubtree="$prefix" $rev - fi - fi -} - -cmd_pull() -{ - ensure_clean - git fetch "$@" || exit $? - revs=FETCH_HEAD - set -- $revs - cmd_merge "$@" -} - -cmd_push() -{ - if [ $# -ne 2 ]; then - die "You must provide <repository> <refspec>" - fi - if [ -e "$dir" ]; then - repository=$1 - refspec=$2 - echo "git push using: " $repository $refspec - localrev=$(git subtree split --prefix="$prefix") || die - git push $repository $localrev:refs/heads/$refspec - else - die "'$dir' must already exist. Try 'git subtree add'." - fi -} - -"cmd_$command" "$@" diff --git a/git-subtree-push b/git-subtree-push deleted file mode 100755 index 41ffe25..0000000 --- a/git-subtree-push +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Push changes in a subtree to a remote. -# - -# Parameters -BASENAME="`basename $0`" -REMOTE="$1" -FOLDER="$2" - -# Syntax -if [ -z "$2" ]; then - echo "usage: $BASENAME <gitremote> <folder>" - exit 1 -fi - -# Check remote -if ! git remote | grep -qe "^$REMOTE"; then - echo "fatal: no such remote $REMOTE" - exit -fi - -# Fetch the remote -git fetch $REMOTE master - -# Process -if [ ! -d "$FOLDER" ]; then - echo "fatal: folder $FOLDER does not exist" - exit 1 -else - # Update a subtree - git subtree push --prefix=$FOLDER $REMOTE master -fi diff --git a/git-subtree-update b/git-subtree-update deleted file mode 100755 index af45ed6..0000000 --- a/git-subtree-update +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Update a subtree. -# - -# Parameters -BASENAME="`basename $0`" -REMOTE="$1" -FOLDER="$2" - -# Syntax -if [ -z "$2" ]; then - echo "usage: $BASENAME <gitremote> <folder>" - exit 1 -fi - -# Check remote -if ! git remote | grep -qe "^$REMOTE"; then - echo "fatal: no such remote $REMOTE" - exit -fi - -# Fetch the remote -git fetch $REMOTE master - -# Process -if [ ! -d "$FOLDER" ]; then - # Add a subtree - git subtree add --prefix $FOLDER $REMOTE master --squash -else - # Update a subtree - git subtree pull --prefix $FOLDER $REMOTE master --squash -fi @@ -1,6 +0,0 @@ -# -# Simple wrapper around gitk -# - -git diff &> /dev/null -gitk --all $* & diff --git a/gitlog-to-changelog b/gitlog-to-changelog deleted file mode 100755 index d287083..0000000 --- a/gitlog-to-changelog +++ /dev/null @@ -1,433 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' - & eval 'exec perl -wS "$0" $argv:q' - if 0; -# Convert git log output to ChangeLog format. -# Downloaded from http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog - -my $VERSION = '2012-07-29 06:11'; # UTC -# The definition above must lie within the first 8 lines in order -# for the Emacs time-stamp write hook (at end) to update it. -# If you change this file with Emacs, please let the write hook -# do its job. Otherwise, update this string manually. - -# Copyright (C) 2008-2013 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Written by Jim Meyering - -use strict; -use warnings; -use Getopt::Long; -use POSIX qw(strftime); - -(my $ME = $0) =~ s|.*/||; - -# use File::Coda; # http://meyering.net/code/Coda/ -END { - defined fileno STDOUT or return; - close STDOUT and return; - warn "$ME: failed to close standard output: $!\n"; - $? ||= 1; -} - -sub usage ($) -{ - my ($exit_code) = @_; - my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); - if ($exit_code != 0) - { - print $STREAM "Try '$ME --help' for more information.\n"; - } - else - { - print $STREAM <<EOF; -Usage: $ME [OPTIONS] [ARGS] - -Convert git log output to ChangeLog format. If present, any ARGS -are passed to "git log". To avoid ARGS being parsed as options to -$ME, they may be preceded by '--'. - -OPTIONS: - - --amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that - makes a change to SHA1's commit log text or metadata. - --append-dot append a dot to the first line of each commit message if - there is no other punctuation or blank at the end. - --no-cluster never cluster commit messages under the same date/author - header; the default is to cluster adjacent commit messages - if their headers are the same and neither commit message - contains multiple paragraphs. - --srcdir=DIR the root of the source tree, from which the .git/ - directory can be derived. - --since=DATE convert only the logs since DATE; - the default is to convert all log entries. - --format=FMT set format string for commit subject and body; - see 'man git-log' for the list of format metacharacters; - the default is '%s%n%b%n' - --strip-tab remove one additional leading TAB from commit message lines. - --strip-cherry-pick remove data inserted by "git cherry-pick"; - this includes the "cherry picked from commit ..." line, - and the possible final "Conflicts:" paragraph. - --help display this help and exit - --version output version information and exit - -EXAMPLE: - - $ME --since=2008-01-01 > ChangeLog - $ME -- -n 5 foo > last-5-commits-to-branch-foo - -SPECIAL SYNTAX: - -The following types of strings are interpreted specially when they appear -at the beginning of a log message line. They are not copied to the output. - - Copyright-paperwork-exempt: Yes - Append the "(tiny change)" notation to the usual "date name email" - ChangeLog header to mark a change that does not require a copyright - assignment. - Co-authored-by: Joe User <user\@example.com> - List the specified name and email address on a second - ChangeLog header, denoting a co-author. - Signed-off-by: Joe User <user\@example.com> - These lines are simply elided. - -In a FILE specified via --amend, comment lines (starting with "#") are ignored. -FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on -a line) referring to a commit in the current project, and CODE refers to one -or more consecutive lines of Perl code. Pairs must be separated by one or -more blank line. - -Here is sample input for use with --amend=FILE, from coreutils: - -3a169f4c5d9159283548178668d2fae6fced3030 -# fix typo in title: -s/all tile types/all file types/ - -1379ed974f1fa39b12e2ffab18b3f7a607082202 -# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself. -# Change the author to be Paul. Note the escaped "@": -s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>, - -EOF - } - exit $exit_code; -} - -# If the string $S is a well-behaved file name, simply return it. -# If it contains white space, quotes, etc., quote it, and return the new string. -sub shell_quote($) -{ - my ($s) = @_; - if ($s =~ m![^\w+/.,-]!) - { - # Convert each single quote to '\'' - $s =~ s/\'/\'\\\'\'/g; - # Then single quote the string. - $s = "'$s'"; - } - return $s; -} - -sub quoted_cmd(@) -{ - return join (' ', map {shell_quote $_} @_); -} - -# Parse file F. -# Comment lines (starting with "#") are ignored. -# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 -# (alone on a line) referring to a commit in the current project, and -# CODE refers to one or more consecutive lines of Perl code. -# Pairs must be separated by one or more blank line. -sub parse_amend_file($) -{ - my ($f) = @_; - - open F, '<', $f - or die "$ME: $f: failed to open for reading: $!\n"; - - my $fail; - my $h = {}; - my $in_code = 0; - my $sha; - while (defined (my $line = <F>)) - { - $line =~ /^\#/ - and next; - chomp $line; - $line eq '' - and $in_code = 0, next; - - if (!$in_code) - { - $line =~ /^([0-9a-fA-F]{40})$/ - or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"), - $fail = 1, next; - $sha = lc $1; - $in_code = 1; - exists $h->{$sha} - and (warn "$ME: $f:$.: duplicate SHA1\n"), - $fail = 1, next; - } - else - { - $h->{$sha} ||= ''; - $h->{$sha} .= "$line\n"; - } - } - close F; - - $fail - and exit 1; - - return $h; -} - -# git_dir_option $SRCDIR -# -# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR -# is undef). Return as a list (0 or 1 element). -sub git_dir_option($) -{ - my ($srcdir) = @_; - my @res = (); - if (defined $srcdir) - { - my $qdir = shell_quote $srcdir; - my $cmd = "cd $qdir && git rev-parse --show-toplevel"; - my $qcmd = shell_quote $cmd; - my $git_dir = qx($cmd); - defined $git_dir - or die "$ME: cannot run $qcmd: $!\n"; - $? == 0 - or die "$ME: $qcmd had unexpected exit code or signal ($?)\n"; - chomp $git_dir; - push @res, "--git-dir=$git_dir/.git"; - } - @res; -} - -{ - my $since_date; - my $format_string = '%s%n%b%n'; - my $amend_file; - my $append_dot = 0; - my $cluster = 1; - my $strip_tab = 0; - my $strip_cherry_pick = 0; - my $srcdir; - GetOptions - ( - help => sub { usage 0 }, - version => sub { print "$ME version $VERSION\n"; exit }, - 'since=s' => \$since_date, - 'format=s' => \$format_string, - 'amend=s' => \$amend_file, - 'append-dot' => \$append_dot, - 'cluster!' => \$cluster, - 'strip-tab' => \$strip_tab, - 'strip-cherry-pick' => \$strip_cherry_pick, - 'srcdir=s' => \$srcdir, - ) or usage 1; - - defined $since_date - and unshift @ARGV, "--since=$since_date"; - - # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/) - # that makes a correction in the log or attribution of that commit. - my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {}; - - my @cmd = ('git', - git_dir_option $srcdir, - qw(log --log-size), - '--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV); - open PIPE, '-|', @cmd - or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n" - . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); - - my $prev_multi_paragraph; - my $prev_date_line = ''; - my @prev_coauthors = (); - while (1) - { - defined (my $in = <PIPE>) - or last; - $in =~ /^log size (\d+)$/ - or die "$ME:$.: Invalid line (expected log size):\n$in"; - my $log_nbytes = $1; - - my $log; - my $n_read = read PIPE, $log, $log_nbytes; - $n_read == $log_nbytes - or die "$ME:$.: unexpected EOF\n"; - - # Extract leading hash. - my ($sha, $rest) = split ':', $log, 2; - defined $sha - or die "$ME:$.: malformed log entry\n"; - $sha =~ /^[0-9a-fA-F]{40}$/ - or die "$ME:$.: invalid SHA1: $sha\n"; - - # If this commit's log requires any transformation, do it now. - my $code = $amend_code->{$sha}; - if (defined $code) - { - eval 'use Safe'; - my $s = new Safe; - # Put the unpreprocessed entry into "$_". - $_ = $rest; - - # Let $code operate on it, safely. - my $r = $s->reval("$code") - or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n"; - - # Note that we've used this entry. - delete $amend_code->{$sha}; - - # Update $rest upon success. - $rest = $_; - } - - # Remove lines inserted by "git cherry-pick". - if ($strip_cherry_pick) - { - $rest =~ s/^\s*Conflicts:\n.*//sm; - $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; - } - - my @line = split "\n", $rest; - my $author_line = shift @line; - defined $author_line - or die "$ME:$.: unexpected EOF\n"; - $author_line =~ /^(\d+) (.*>)$/ - or die "$ME:$.: Invalid line " - . "(expected date/author/email):\n$author_line\n"; - - # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog - # `(tiny change)' annotation. - my $tiny = (grep (/^Copyright-paperwork-exempt:\s+[Yy]es$/, @line) - ? ' (tiny change)' : ''); - - my $date_line = sprintf "%s %s$tiny\n", - strftime ("%F", localtime ($1)), $2; - - my @coauthors = grep /^Co-authored-by:.*$/, @line; - # Omit meta-data lines we've already interpreted. - @line = grep !/^(?:Signed-off-by:[ ].*>$ - |Co-authored-by:[ ] - |Copyright-paperwork-exempt:[ ] - )/x, @line; - - # Remove leading and trailing blank lines. - if (@line) - { - while ($line[0] =~ /^\s*$/) { shift @line; } - while ($line[$#line] =~ /^\s*$/) { pop @line; } - } - - # Record whether there are two or more paragraphs. - my $multi_paragraph = grep /^\s*$/, @line; - - # Format 'Co-authored-by: A U Thor <email@example.com>' lines in - # standard multi-author ChangeLog format. - for (@coauthors) - { - s/^Co-authored-by:\s*/\t /; - s/\s*</ </; - - /<.*?@.*\..*>/ - or warn "$ME: warning: missing email address for " - . substr ($_, 5) . "\n"; - } - - # If clustering of commit messages has been disabled, if this header - # would be different from the previous date/name/email/coauthors header, - # or if this or the previous entry consists of two or more paragraphs, - # then print the header. - if ( ! $cluster - || $date_line ne $prev_date_line - || "@coauthors" ne "@prev_coauthors" - || $multi_paragraph - || $prev_multi_paragraph) - { - $prev_date_line eq '' - or print "\n"; - print $date_line; - @coauthors - and print join ("\n", @coauthors), "\n"; - } - $prev_date_line = $date_line; - @prev_coauthors = @coauthors; - $prev_multi_paragraph = $multi_paragraph; - - # If there were any lines - if (@line == 0) - { - warn "$ME: warning: empty commit message:\n $date_line\n"; - } - else - { - if ($append_dot) - { - # If the first line of the message has enough room, then - if (length $line[0] < 72) - { - # append a dot if there is no other punctuation or blank - # at the end. - $line[0] =~ /[[:punct:]\s]$/ - or $line[0] .= '.'; - } - } - - # Remove one additional leading TAB from each line. - $strip_tab - and map { s/^\t// } @line; - - # Prefix each non-empty line with a TAB. - @line = map { length $_ ? "\t$_" : '' } @line; - - print "\n", join ("\n", @line), "\n"; - } - - defined ($in = <PIPE>) - or last; - $in ne "\n" - and die "$ME:$.: unexpected line:\n$in"; - } - - close PIPE - or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n"; - # FIXME-someday: include $PROCESS_STATUS in the diagnostic - - # Complain about any unused entry in the --amend=F specified file. - my $fail = 0; - foreach my $sha (keys %$amend_code) - { - warn "$ME:$amend_file: unused entry: $sha\n"; - $fail = 1; - } - - exit $fail; -} - -# Local Variables: -# mode: perl -# indent-tabs-mode: nil -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "my $VERSION = '" -# time-stamp-format: "%:y-%02m-%02d %02H:%02M" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "'; # UTC" -# End: diff --git a/gpg-agent-eval b/gpg-agent-eval deleted file mode 100755 index fab7334..0000000 --- a/gpg-agent-eval +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Initialize the gpg-agent -# - -# GPG Agent -GPG_TTY=`tty` -export GPG_TTY - -function gpg_agent_eval_run { - if test -f $HOME/.gpg-agent-info && \ - kill -0 `cut -d: -f 2 $HOME/.gpg-agent-info` 2>/dev/null; then - GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info` - export GPG_AGENT_INFO - else - eval `gpg-agent --daemon` - echo $GPG_AGENT_INFO >$HOME/.gpg-agent-info - fi -} - -gpg_agent_eval_run diff --git a/ical2rem b/ical2rem deleted file mode 100755 index aab07d5..0000000 --- a/ical2rem +++ /dev/null @@ -1,279 +0,0 @@ -#!/usr/bin/perl -w -# -# ical2rem.pl - -# Reads iCal files and outputs remind-compatible files. Tested ONLY with -# calendar files created by Mozilla Calendar/Sunbird. Use at your own risk. -# Copyright (c) 2005, 2007, Justin B. Alcorn - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# -# version 0.5.2 2007-03-23 -# - BUG: leadtime for recurring events had a max of 4 instead of DEFAULT_LEAD_TIME -# - remove project-lead-time, since Category was a non-standard attribute -# - NOTE: There is a bug in iCal::Parser v1.14 that causes multiple calendars to -# fail if a calendar with recurring events is followed by a calendar with no -# recurring events. This has been reported to the iCal::Parser author. -# version 0.5.1 2007-03-21 -# - BUG: Handle multiple calendars on STDIN -# - add --heading option for priority on section headers -# version 0.5 2007-03-21 -# - Add more help options -# - --project-lead-time option -# - Supress printing of heading if there are no todos to print -# version 0.4 -# - Version 0.4 changes all written or inspired by, and thanks to Mark Stosberg -# - Change to GetOptions -# - Change to pipe -# - Add --label, --help options -# - Add Help Text -# - Change to subroutines -# - Efficiency and Cleanup -# version 0.3 -# - Convert to GPL (Thanks to Mark Stosberg) -# - Add usage -# version 0.2 -# - add command line switches -# - add debug code -# - add SCHED _sfun keyword -# - fix typos -# version 0.1 - ALPHA CODE. - -=head1 SYNOPSIS - - cat /path/to/file*.ics | ical2rem.pl > ~/.ical2rem - - All options have reasonable defaults: - --label Calendar name (Default: Calendar) - --lead-time Advance days to start reminders (Default: 3) - --todos, --no-todos Process Todos? (Default: Yes) - --heading Define a priority for static entries - --help Usage - --man Complete man page - -Expects an ICAL stream on STDIN. Converts it to the format -used by the C<remind> script and prints it to STDOUT. - -=head2 --label - - ical2rem.pl --label "Bob's Calendar" - -The syntax generated includes a label for the calendar parsed. -By default this is "Calendar". You can customize this with -the "--label" option. - -=head2 --lead-time - - ical2rem.pl --lead-time 3 - -How may days in advance to start getting reminders about the events. Defaults to 3. - -=head2 --no-todos - - ical2rem.pl --no-todos - -If you don't care about the ToDos the calendar, this will surpress -printing of the ToDo heading, as well as skipping ToDo processing. - -=head2 --heading - - ical2rem.pl --heading "PRIORITY 9999" - -Set an option on static messages output. Using priorities can made the static messages look different from -the calendar entries. See the file defs.rem from the remind distribution for more information. - -=cut - -use strict; -use iCal::Parser; -use DateTime; -use Getopt::Long 2.24 qw':config auto_help'; -use Pod::Usage; -use Data::Dumper; -use vars '$VERSION'; -$VERSION = "0.5.2"; - -# Declare how many days in advance to remind -my $DEFAULT_LEAD_TIME = 3; -my $PROCESS_TODOS = 1; -my $HEADING = ""; -my $help; -my $man; - -my $label = 'Calendar'; -GetOptions ( - "label=s" => \$label, - "lead-time=i" => \$DEFAULT_LEAD_TIME, - "todos!" => \$PROCESS_TODOS, - "heading=s" => \$HEADING, - "help|?" => \$help, - "man" => \$man -); -pod2usage(1) if $help; -pod2usage(-verbose => 2) if $man; - -my $month = ['None','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - -my @calendars; -my $in; - -while (<>) { - $in .= $_; - if (/END:VCALENDAR/) { - push(@calendars,$in); - $in = ""; - } -} -my $parser = iCal::Parser->new(); -my $hash = $parser->parse_strings(@calendars); - -############################################################## -# -# Subroutines -# -############################################################# -# -# _process_todos() -# expects 'todos' hashref from iCal::Parser is input -# returns String to output -sub _process_todos { - my $todos = shift; - - my ($todo, @newtodos, $leadtime); - my $output = ""; - - $output .= 'REM '.$HEADING.' MSG '.$label.' ToDos:%"%"%'."\n"; - -# For sorting, make sure everything's got something -# To sort on. - my $now = DateTime->now; - for $todo (@{$todos}) { - # remove completed items - if ($todo->{'STATUS'} && $todo->{'STATUS'} eq 'COMPLETED') { - next; - } elsif ($todo->{'DUE'}) { - # All we need is a due date, everything else is sugar - $todo->{'SORT'} = $todo->{'DUE'}->clone; - } elsif ($todo->{'DTSTART'}) { - # for sorting, sort on start date if there's no due date - $todo->{'SORT'} = $todo->{'DTSTART'}->clone; - } else { - # if there's no due or start date, just make it now. - $todo->{'SORT'} = $now; - } - push(@newtodos,$todo); - } - if (! (scalar @newtodos)) { - return ""; - } -# Now sort on the new Due dates and print them out. - for $todo (sort { DateTime->compare($a->{'SORT'}, $b->{'SORT'}) } @newtodos) { - my $due = $todo->{'SORT'}->clone(); - my $priority = ""; - if (defined($todo->{'PRIORITY'})) { - if ($todo->{'PRIORITY'} == 1) { - $priority = "PRIORITY 1000"; - } elsif ($todo->{'PRIORITY'} == 3) { - $priority = "PRIORITY 7500"; - } - } - if (defined($todo->{'DTSTART'}) && defined($todo->{'DUE'})) { - # Lead time is duration of task + lead time - my $diff = ($todo->{'DUE'}->delta_days($todo->{'DTSTART'})->days())+$DEFAULT_LEAD_TIME; - $leadtime = "+".$diff; - } else { - $leadtime = "+".$DEFAULT_LEAD_TIME; - } - $output .= "REM ".$due->month_abbr." ".$due->day." ".$due->year." $leadtime $priority MSG \%a $todo->{'SUMMARY'}\%\"\%\"\%\n"; - } - $output .= 'REM '.$HEADING.' MSG %"%"%'."\n"; - return $output; -} - - -####################################################################### -# -# Main Program -# -###################################################################### - -print _process_todos($hash->{'todos'}) if $PROCESS_TODOS; - -my ($leadtime, $yearkey, $monkey, $daykey,$uid,%eventsbyuid); -print 'REM '.$HEADING.' MSG '.$label.' Events:%"%"%'."\n"; -my $events = $hash->{'events'}; -foreach $yearkey (sort keys %{$events} ) { - my $yearevents = $events->{$yearkey}; - foreach $monkey (sort {$a <=> $b} keys %{$yearevents}){ - my $monevents = $yearevents->{$monkey}; - foreach $daykey (sort {$a <=> $b} keys %{$monevents} ) { - my $dayevents = $monevents->{$daykey}; - foreach $uid (sort { - DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'}) - } keys %{$dayevents}) { - my $event = $dayevents->{$uid}; - if ($eventsbyuid{$uid}) { - my $curreventday = $event->{'DTSTART'}->clone; - $curreventday->truncate( to => 'day' ); - $eventsbyuid{$uid}{$curreventday->epoch()} =1; - for (my $i = 0;$i < $DEFAULT_LEAD_TIME && !defined($event->{'LEADTIME'});$i++) { - if ($eventsbyuid{$uid}{$curreventday->subtract( days => $i+1 )->epoch() }) { - $event->{'LEADTIME'} = $i; - } - } - } else { - $eventsbyuid{$uid} = $event; - my $curreventday = $event->{'DTSTART'}->clone; - $curreventday->truncate( to => 'day' ); - $eventsbyuid{$uid}{$curreventday->epoch()} =1; - } - - } - } - } -} -foreach $yearkey (sort keys %{$events} ) { - my $yearevents = $events->{$yearkey}; - foreach $monkey (sort {$a <=> $b} keys %{$yearevents}){ - my $monevents = $yearevents->{$monkey}; - foreach $daykey (sort {$a <=> $b} keys %{$monevents} ) { - my $dayevents = $monevents->{$daykey}; - foreach $uid (sort { - DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'}) - } keys %{$dayevents}) { - my $event = $dayevents->{$uid}; - if (exists($event->{'LEADTIME'})) { - $leadtime = "+".$event->{'LEADTIME'}; - } else { - $leadtime = "+".$DEFAULT_LEAD_TIME; - } - my $start = $event->{'DTSTART'}; - print "REM ".$start->month_abbr." ".$start->day." ".$start->year." $leadtime "; - if ($start->hour > 0) { - print " AT "; - print $start->strftime("%H:%M"); - print " SCHED _sfun MSG %a %2 "; - } else { - print " MSG %a "; - } - print "%\"$event->{'SUMMARY'}"; - print " at $event->{'LOCATION'}" if $event->{'LOCATION'}; - print "\%\"%\n"; - } - } - } -} -exit 0; -#:vim set ft=perl ts=4 sts=4 expandtab : diff --git a/image2ascii b/image2ascii deleted file mode 100755 index 729cb4d..0000000 --- a/image2ascii +++ /dev/null @@ -1,76 +0,0 @@ -#! /bin/sh -# -# $ Id: image2ascii,v 1.6 2002/12/01 12:36:56 roland Exp roland $ -# -# Convert any image to an ASCII-graphic using ImageMagick -# -########################################################################## -# -# Copyright (C) 1997-2002 Roland Rosenfeld <roland@spinnaker.de> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -########################################################################## - -CONVERT=convert # The ImageMagick convert binary -PBMTOASCII=pbmtoascii # The NetPBM pbmtoascii binary - -umask 077 - -tmpdir=${TMPDIR-/tmp}/image2ascii.$$ -mkdir $tmpdir || exit 1 -trap "rm -rf $tmpdir; exit" 0 1 2 3 15 - -TMPFILE=$tmpdir/image - -usage="Usage: $0 [option] [imagefile] - - -help display this help text - -geometry 132x50 define the size of the ascii image" - - -# set default geometry to display width: -geometry=`stty size </dev/tty | awk '{print $2 "x" $1}'` - -# test if stty did not output a useful value: -case "$geometry" in - 0x0 ) geometry=80x24 ;; - "" ) geometry=80x24 ;; -esac - -case $# in - 0 ) cat > $TMPFILE ;; - 1 ) case "$1" in - -* ) echo "$usage"; exit 0 ;; - * ) cat "$1" > $TMPFILE ;; - esac ;; - 2 ) case "$1" in - -geometry ) geometry=$2 - cat > $TMPFILE ;; - * ) echo "$usage"; exit 0 ;; - esac ;; - 3 ) case "$1" in - -geometry ) geometry=$2 - cat $3 > $TMPFILE ;; - * ) echo "$usage"; exit 0 ;; - esac ;; - * ) echo "$usage"; exit 0 ;; -esac - -# multiply x with 2 and y with 4 (pbmtoascii divides by 2x4) -geometry=`echo $geometry | awk -Fx '{print 2*$1 "x" 4*$2}'` - -$CONVERT -geometry $geometry $TMPFILE $TMPFILE.pbm -$PBMTOASCII -2x4 < $TMPFILE.pbm diff --git a/imgconv b/imgconv deleted file mode 100755 index 396a786..0000000 --- a/imgconv +++ /dev/null @@ -1,262 +0,0 @@ -#!/bin/bash - -# little script to generate image galleries for use with original. -# uses imagemagick's convert -# (c) 2005 boris de laage <bdelaage@free.fr> -# based on imgconv by Jakub Steiner -# -#The 'help' section sucks, as my english does. - - -#default options -dir=./web-gallery -zip=0 -rotate=0 -mq=0 -hq=0 -interactive=0 -verbose=echo - -#info.txt stuff -gal_auth="" -gal_name="" -gal_desc="" -gal_date="" -gal_user="" -gal_pass="" - -# convert options -convertor=`which convert` -jhead=`which jhead` -extra_ops="-strip" - -# This script -name=`basename $0` - -# getopt stuff -shortopts="a:hHin:d:D:Mqo:Zr" -longopts="author:quiet,help,interactive,name:,date:,description:,\ -mq,hq,output:,archive,rotate" - - - -function echo_help { -cat <<EOF -Usage : $1 [OPTIONS]... [FILE]... -Convert FILEs - - -o, --output DIR make gallery in DIR - -M, --mq include 1024x768 images (MQ) - -H, --hq include original images (HQ) - -Z, --archive make archives - -i, --interactive edit gallery informations interactively - -a, --author NAME set author's name - -n, --name NAME set gallery's name - -d, --date DATE set date to DATE - -D, --description DESC description - -r, --rotate automatically rotate image based on EXIF - -q, --quiet don't say anything - -h, --help display this help and exit - -FILEs must be JPG, JPEG or PNG. if DIR is not given, the -gallery will be created in $dir. - -EOF - -} - -good_file() { - local ftype - - ftype=`file -b "$1" | cut -d " " -f 1` - - if [ "$ftype" == "JPG" ] || [ "$ftype" == "JPEG" ] || [ "$ftype" == "PNG" ] - then - return 0 - else - return 1 - fi - -} - - -# If we don't have ImageMagick, cry & exit -if [ -z $convertor ]; then - echo "convert not found... Please install ImageMagick." - exit 1 -fi - - -# Parse options -TEMP=`getopt -o $shortopts --long $longopts -n $name -- "$@"` -[ $? != 0 ] && exit 1 - -eval set -- "$TEMP" -while true; do - case "$1" in - -h|--help) - echo_help $name ; exit 0 ;; - - -i|--interactive) - interactive=1 ; shift ;; - - -n|--name) - gal_name=$2 ; shift 2 ;; - - -d|--date) - gal_date=$2 ; shift 2 ;; - - -D|--description) - gal_desc=$2 ; shift 2 ;; - - -a|--author) - gal_auth=$2 ; shift 2 ;; - - -o|--output) - dir=$2 ; shift 2 ;; - - -Z|--zip) - zip=1 ; shift ;; - - -r|--rotate) - rotate=1 ; shift ;; - - -q|--quiet) - verbose=false ; shift ;; - - -M|--mq) - mq=1 ; shift ;; - - -H|--hq) - hq=1 ; shift ;; - - --) - shift ; break ;; - - *) - echo "OOops.. getopt error !" ; echo $@ ; exit 1 ;; - esac -done - - - -# If we don't have JHead and we want to auto-rotate images, cry & exit -if [ $rotate -gt 0 ] && [ -z $jhead ]; then - echo "jhead not found... Please install JHead." - exit 1 -fi - - - -# If no input files are given, display usage & exit -if [ $# == 0 ]; then - cat <<EOF -Usage: $name [-hMHZ] [-o directory] file... - $name -o Gallery *.jpg -Try \`$name --help' for more information. -EOF - exit 1 -fi - -# make dirs -mkdir -p $dir/thumbs -mkdir -p $dir/lq -mkdir -p $dir/comments -chmod o+w $dir/comments -[ $mq -gt 0 ] && mkdir -p $dir/mq -[ $hq -gt 0 ] && mkdir -p $dir/hq -[ $zip -gt 0 ] && mkdir -p $dir/zip - -# Protect info.txt, even if we don't make it. -echo "<Files info.txt>" > $dir/.htaccess -echo " deny from all" >> $dir/.htaccess -echo "</Files>" >> $dir/.htaccess - - -$verbose "Generating O.R.I.G.I.N.A.L gallery in $dir" - -files=$(echo $@ | sed 's/ /\n/g' | sort) - -#files=$@ - -i=1 -for imagefile in $files; do - - good_file "$imagefile" - if [ $? != 0 ]; then - $verbose "$imagefile is not a JPG, JPEG or PNG file, skipped" - continue - fi - - $verbose -n "converting $imagefile " - - $verbose -n "." - $convertor -geometry 120x120 -modulate 100,140,100 -unsharp 1x20 \ - -quality 60 $extra_opts "$imagefile" $dir/thumbs/img-$i.jpg - - $verbose -n "." - $convertor -geometry 640x480 -modulate 100,130,100 -unsharp 1x5 \ - -quality 90 "$imagefile" $dir/lq/img-$i.jpg - - if [ $mq -gt 0 ]; then - $verbose -n "." - $convertor -geometry 1024x768 -modulate 100,130,100 -unsharp 1x5 \ - -quality 80 "$imagefile" $dir/mq/img-$i.jpg - fi - - if [ $hq -gt 0 ] ; then - $verbose -n "." - cp "$imagefile" $dir/hq/img-$i.jpg - fi - - # template for comment - echo "<span>Photo $i</span>
" > $dir/comments/$i.txt - - - i=`expr $i + 1` - $verbose " done" -done - -# auto-rotate stuff -if [ $rotate -gt 0 ]; then - $verbose "rotating" - jhead -autorot $dir/thumbs/*.jpg - jhead -autorot $dir/lq/*.jpg - [ $mq ] && jhead -autorot $dir/mq/*.jpg - [ $hq ] && jhead -autorot $dir/hq/*.jpg -fi - -#zip stuff -if [ $zip -gt 0 ]; then - $verbose "archiving" - [ $mq ] && zip -R $dir/zip/mq.zip $dir/mq/*.jpg - [ $hq ] && zip -R $dir/zip/hq.zip $dir/hq/*.jpg -fi - -#info.txt -protect=n -if [ $interactive == 1 ]; then - echo -n "Gallery name [$gal_name]: " - read gal_name - echo -n "Description: " - read gal_desc - echo -n "Author [$gal_auth]: " - read gal_auth - echo -n "Date [$gal_date]: " - read gal_date - echo -n "Resctrict access ? [y/N]: " - read protect - if [ "$protect" == "y" ] || [ "$protect" == "Y" ]; then - echo -n "restricted user [$gal_user]: " - read gal_user - echo -n "restricted password [$gal_pass]: " - read gal_pass - fi -fi - -[ "$gal_name" != "" ] && echo "name|$gal_name" >> $dir/info.txt -[ "$gal_auth" != "" ] && echo "author|$gal_auth" >> $dir/info.txt -[ "$gal_date" != "" ] && echo "date|$gal_date" >> $dir/info.txt -[ "$gal_desc" != "" ] && echo "description|$gal_desc" >> $dir/info.txt -[ "$gal_user" != "" ] && echo "restricted_user|$gal_user" >> $dir/info.txt -[ "$gal_pass" != "" ] && echo "restricted_password|$gal_pass" >> $dir/info.txt diff --git a/irssi-tor b/irssi-tor deleted file mode 100755 index 4130387..0000000 --- a/irssi-tor +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -# Simple irssi Tor wrapper -# - -torify irssi --home=~/.irssi-tor/ @@ -1,25 +0,0 @@ -#! /bin/bash -# -# Get keyboard led state. -# See https://bbs.archlinux.org/viewtopic.php?id=68511 -# - -ledstate="`xset q 2>/dev/null | grep LED`" -ledstate="`echo $ledstate | sed s/[^1-9]//g`" -case "$ledstate" in - '1') - echo "[CapsLock] " - ;; - '2') - # Right now we're not interested on NumLock status - #echo "[NumLock]" - echo "" - ;; - '3') - # Right now we're not interested on NumLock status - #echo "[CapsLock][NumLock]" - echo "[CapsLock] " - ;; - *) - echo "" -esac @@ -1,67 +0,0 @@ -#!/bin/sh -# -# See http://www.thinkwiki.org/wiki/Battery -# http://www.thinkwiki.org/wiki/Tp_smapi -# - -function usage() { - echo "Usage: ${0} [--help | option]" - echo "Options are:" - echo " show show current charge thresholds." - echo " limit start charging at 30% and stop at 85%." - echo " normal start charging at 96% and stop at 100%." - exit ${1} -} - -# validate command line options -if [[ (${#} -eq 1 \ - && "${1}" != "--help" \ - && "${1}" != "normal" \ - && "${1}" != "limit" \ - && ${1} != "show") ]]; then - usage 1 -fi - -# show help -if [ "${1}" == "--help" ]; then - usage 0 -fi - -# get action -action="show" -if [ "${1}" != "" ]; then - action=${1} -fi - -# battery interface location -BAT="/sys/devices/platform/smapi/BAT0" - -function show_thresholds() { - echo -n "Low threshold: " - cat $BAT/start_charge_thresh - echo -n "High threshold: " - cat $BAT/stop_charge_thresh -} - -function set_thresholds() { - START_THRESH=${1} - STOP_THRESH=${2} - sudo sh -c "echo ${START_THRESH} > $BAT/start_charge_thresh" - sudo sh -c "echo ${STOP_THRESH} > $BAT/stop_charge_thresh" -} - -# do your thang -sudo modprobe tp_smapi - -THRESHOLDS="" -if [ "${action}" == "normal" ]; then - THRESHOLDS="96 100" -elif [ "${action}" == "limit" ]; then - THRESHOLDS="30 85" -fi - -if [ ! -z "${THRESHOLDS}" ]; then - set_thresholds ${THRESHOLDS} -fi - -show_thresholds @@ -1,25 +0,0 @@ -#!/bin/bash -# -# Locally sign an OpenPGP key. -# - -# Parameters -BASENAME="`basename $0`" -NAME="$1" -set -e - -# Syntax check -if [ -z "$NAME" ]; then - echo "usage: $BASENAME <key>" - exit 1 -fi - -# Optional reason -read -e -p 'Optional lsignreason notation: ' REASON - -# Local signature -if [ ! -z "$REASON" ]; then - gpg --lsign --ask-cert-expire "$NAME" -else - gpg --lsign --cert-notation "lsigreason@notations.openpgp.fifthhorseman.net=${REASON}" --ask-cert-expire "$NAME" -fi diff --git a/migrate-scripts b/migrate-scripts new file mode 100644 index 0000000..d368ca2 --- /dev/null +++ b/migrate-scripts @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Mas repo creator! +# +# This script was used to migrate lots of scripts to specific repositories. + +# New repositories +REPOS="bash-prompt downloaders git-subtree playlister sedscripts ssl-wrapper start-streaming termplex timelog unisyncer utils-battery utils-calendar utils-cdrecord utils-chroot utils-git utils-gpg utils-image utils-mail utils-spreadsheet utils-ssh utils-tor utils-x11 vbox" + +# First stage +for repo in $REPOS; do + cd ~/apps/$repo + touch {README,TODO}.md + git init + git add . + git config user.name "USER" + git config user.email "MAIL" + git remote add DEST1 gitolite@DEST1:$repo.git + git remote add DEST2 gitolite@DEST2:$repo.git + git commit -m "Initial import" + git push DEST1 master + git push DEST2 master + + # Remote all + echo '[remote "all"]' >> .git/config + echo ' url = gitolite@DEST1:$repo.git' >> .git/config + echo ' url = gitolite@DEST2:$repo.git' >> .git/config + + cd ~/apps + mkdir -p tmp + mv $repo tmp/ + git submodule add git://git.sarava.org/$repo $repo + + rm -rf $repo + mv tmp/$repo . + rm -rf .git/modules/$repo +done + +# Teardown +rmdir tmp diff --git a/misc/email/checkmail b/misc/email/checkmail deleted file mode 100755 index 078f111..0000000 --- a/misc/email/checkmail +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -# Simple mail counter -# Inspired by http://www.vivaolinux.com.br/dicas/verDica.php?codigo=2432 -# - -# Fetch and compute -FETCH=`fetchmail -c` -TOTAL=`echo $FETCH | awk '{ print $1 }'` -SEEN=`echo $FETCH | awk '{ print $3 }' | sed -e 's/(//'` -NEW=`echo "$TOTAL - $SEEN" | bc` - -# Display response -echo $NEW/$TOTAL diff --git a/misc/email/eml2mbox/eml2mbox.rb b/misc/email/eml2mbox/eml2mbox.rb deleted file mode 100755 index 1fc7bca..0000000 --- a/misc/email/eml2mbox/eml2mbox.rb +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/ruby -#============================================================================================# -# eml2mbox.rb v0.08 # -# Last updated: Jan 23, 2004 # -# # -# Converts a bunch of eml files into one mbox file. # -# # -# Usage: [ruby] eml2mbx.rb [-c] [-l] [-s] [-yz] [emlpath [trgtmbx]] # -# Switches: # -# -c Remove CRs (^M) appearing at end of lines (Unix) # -# -l Remove LFs appearing at beggining of lines (old Mac) - not tested # -# -s Don't use standard mbox postmark formatting (for From_ line) # -# This will force the use of original From and Date found in mail headers. # -# Not recommended, unless you really have problems importing emls. # -# -yz Use this to force the order of the year and timezone in date in the From_ # -# line from the default [timezone][year] to [year][timezone]. # -# emlpath - Path of dir with eml files. Defaults to the current dir if not specified # -# trgtmbx - Name of the target mbox file. Defaults to "archive.mbox" in 'emlpath' # -# # -# Ruby homepage: http://www.ruby-lang.org/en/ # -# Unix mailbox format: http://www.broobles.com/eml2mbox/mbox.html # -# This script : http://www.broobles.com/eml2mbox # -# # -#============================================================================================# -# Licence: # -# # -# This script is free software; you can redistribute it and/or modify it under the terms of # -# the GNU Lesser General Public License as published by the Free Software Foundation; # -# either version 2.1 of the License, or (at your option) any later version. # -# # -# You should have received a copy of the GNU Lesser General Public License along with this # -# script; if not, please visit http://www.gnu.org/copyleft/gpl.html for more information. # -#============================================================================================# - -require "parsedate" - -include ParseDate - -#=======================================================# -# Class that encapsulates the processing file in memory # -#=======================================================# - -class FileInMemory - - ZoneOffset = { - # Standard zones by RFC 2822 - 'UTC' => '0000', - 'UT' => '0000', 'GMT' => '0000', - 'EST' => '-0500', 'EDT' => '-0400', - 'CST' => '-0600', 'CDT' => '-0500', - 'MST' => '-0700', 'MDT' => '-0600', - 'PST' => '-0800', 'PDT' => '-0700', - } - - def initialize() - @lines = Array.new - @counter = 1 # keep the 0 position for the From_ line - @from = nil # from part of the From_ line - @date = nil # date part of the From_ line - end - - def addLine(line) - # If the line is a 'false' From line, add a '>' to its beggining - line = line.sub(/From/, '>From') if line =~ /^From/ and @from!=nil - - # If the line is the first valid From line, save it (without the line break) - if line =~ /^From:\s.*@/ and @from==nil - @from = line.sub(/From:/,'From') - @from = @from.chop # Remove line break(s) - @from = standardizeFrom(@from) unless $switches["noStandardFromLine"] - end - - # Get the date - if $switches["noStandardFromLine"] - # Don't parse the content of the Date header - @date = line.sub(/Date:\s/,'') if line =~ /^Date:\s/ and @date==nil - else - if line =~ /^Date:\s/ and @date==nil - # Parse content of the Date header and convert to the mbox standard for the From_ line - @date = line.sub(/Date:\s/,'') - year, month, day, hour, minute, second, timezone, wday = parsedate(@date) - # Need to convert the timezone from a string to a 4 digit offset - unless timezone =~ /[+|-]\d*/ - timezone=ZoneOffset[timezone] - end - time = Time.gm(year,month,day,hour,minute,second) - @date = formMboxDate(time,timezone) - end - end - - # Now add the line to the array - line = fixLineEndings(line) - @lines[@counter]=line - @counter+=1 - end - - # Forms the first line (from + date) and returns all the lines - # Returns all the lines in the file - def getProcessedLines() - if @from != nil - # Add from and date to the first line - if @date==nil - puts "WARN: Failed to extract date. Will use current time in the From_ line" - @date=formMboxDate(Time.now,nil) - end - @lines[0] = @from + " " + @date - - @lines[0] = fixLineEndings(@lines[0]) - @lines[@counter] = "" - return @lines - end - # else don't return anything - end - - # Fixes CR/LFs - def fixLineEndings(line) - line = removeCR(line) if $switches["removeCRs"]; - line = removeLF(line) if $switches["removeLFs"]; - return line - end - - # emls usually have CR+LF (DOS) line endings, Unix uses LF as a line break, - # so there's a hanging CR at the end of the line when viewed on Unix. - # This method will remove the next to the last character from a line - def removeCR(line) - line = line[0..-3]+line[-1..-1] if line[-2]==0xD - return line - end - - # Similar to the above. This one is for Macs that use CR as a line break. - # So, remove the last char - def removeLF(line) - line = line[0..-2] if line[-1]==0xA - return line - end - -end - -#================# -# Helper methods # -#================# - -# Converts: 'From "some one <aa@aa.aa>" <aa@aa.aa>' -> 'From aa@aa.aa' -def standardizeFrom(fromLine) - # Get indexes of last "<" and ">" in line - openIndex = fromLine.rindex('<') - closeIndex = fromLine.rindex('>') - if openIndex!=nil and closeIndex!=nil - fromLine = fromLine[0..4]+fromLine[openIndex+1..closeIndex-1] - end - # else leave as it is - it is either already well formed or is invalid - return fromLine -end - -# Returns a mbox postmark formatted date. -# If timezone is unknown, it is skipped. -# mbox date format used is described here: -# http://www.broobles.com/eml2mbox/mbox.html -def formMboxDate(time,timezone) - if timezone==nil - return time.strftime("%a %b %d %H:%M:%S %Y") - else - if $switches["zoneYearOrder"] - return time.strftime("%a %b %d %H:%M:%S "+timezone.to_s+" %Y") - else - return time.strftime("%a %b %d %H:%M:%S %Y "+timezone.to_s) - end - end -end - - -# Extracts all switches from the command line and returns -# a hashmap with valid switch names as keys and booleans as values -# Moves real params to the beggining of the ARGV array -def extractSwitches() - switches = Hash.new(false) # All switches (values) default to false - i=0 - while (ARGV[i]=~ /^-/) # while arguments are switches - if ARGV[i]=="-c" - switches["removeCRs"] = true - puts "\nWill fix lines ending with a CR" - elsif ARGV[i]=="-l" - switches["removeLFs"] = true - puts "\nWill fix lines beggining with a LF" - elsif ARGV[i]=="-s" - switches["noStandardFromLine"] = true - puts "\nWill use From and Date from mail headers in From_ line" - elsif ARGV[i]=="-yz" - switches["zoneYearOrder"] = true - puts "\nTimezone will be placed before the year in From_ line" - else - puts "\nUnknown switch: "+ARGV[i]+". Ignoring." - end - i = i+1 - end - # Move real arguments to the beggining of the array - ARGV[0] = ARGV[i] - ARGV[1] = ARGV[i+1] - return switches -end - -#===============# -# Main # -#===============# - - $switches = extractSwitches() - - # Extract specified directory with emls and the target archive (if any) - emlDir = "." # default if not specified - emlDir = ARGV[0] if ARGV[0]!=nil - mboxArchive = emlDir+"/archive.mbox" # default if not specified - mboxArchive = ARGV[1] if ARGV[1] != nil - - # Show specified settings - puts "\nSpecified dir : "+emlDir - puts "Specified file: "+mboxArchive+"\n" - - # Check that the dir exists - if FileTest.directory?(emlDir) - Dir.chdir(emlDir) - else - puts "\n["+emlDir+"] is not a directory (might not exist). Please specify a valid dir" - exit(0) - end - - # Check if destination file exists. If yes allow user to select an option. - canceled = false - if FileTest.exist?(mboxArchive) - print "\nFile ["+mboxArchive+"] exists! Please select: [A]ppend [O]verwrite [C]ancel (default) " - sel = STDIN.gets.chomp - if sel == 'A' or sel == 'a' - aFile = File.new(mboxArchive, "a"); - elsif sel == 'O' or sel == 'o' - aFile = File.new(mboxArchive, "w"); - else - canceled = true - end - else - # File doesn't exist, open for writing - aFile = File.new(mboxArchive, "w"); - end - - if not canceled - puts - files = Dir["*.eml"] - if files.size == 0 - puts "No *.eml files in this directory. mbox file not created." - aFile.close - File.delete(mboxArchive) - exit(0) - end - # For each .eml file in the specified directory do the following - files.each() do |x| - puts "Processing file: "+x - thisFile = FileInMemory.new() - File.open(x).each {|item| thisFile.addLine(item) } - lines = thisFile.getProcessedLines - if lines == nil - puts "WARN: File ["+x+"] doesn't seem to have a regular From: line. Not included in mbox" - else - lines.each {|line| aFile.puts line} - end - end - aFile.close - end diff --git a/misc/email/eml2mbox/licence.txt b/misc/email/eml2mbox/licence.txt deleted file mode 100644 index 3b20440..0000000 --- a/misc/email/eml2mbox/licence.txt +++ /dev/null @@ -1,458 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/misc/email/estripa-emails.c b/misc/email/estripa-emails.c deleted file mode 100755 index 66c5473..0000000 --- a/misc/email/estripa-emails.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyleft 2003: - * - * Esse software distribudo atravs da licena URUBU: - * voc s pode fazer um nmero de cpias cuja paridade - * seja a mesma do dia do ms que voc se encontra; - * modificaes so permitidas em qualquer dia da semana; - * - * estripa.c - * rhatto@riseup.net - * - */ - -#include <stdio.h> - -main(int argc, char *argv[]) { - - FILE *fp1, *fp2; - char letra; - short flag = 0; - - if(argc != 3) { fprintf(stderr, "sintaxe: estripa <origem> <destino>\n"); return 0; } - - fp1 = fopen(argv[1], "rb"); - fp2 = fopen(argv[2], "wb"); - - if(fp1 == (FILE *)0 || fp2 == (FILE *)0) { - - fprintf(stderr, "erro ao abrir arquivo\n"); - exit(1); - - } - - while((letra = getc(fp1)) != EOF) { - - if(letra == '<') { flag = 1; } - else if(flag && (letra == '>')) { flag = 0; fprintf(fp2, ", "); } - - if(flag && (letra != '<')) { putc(letra, fp2); } - - } - - fprintf(fp2, "\n"); - - fclose(fp1); - fclose(fp2); - - return 0; - -} diff --git a/misc/email/vcard-filter b/misc/email/vcard-filter deleted file mode 100755 index 363aa07..0000000 --- a/misc/email/vcard-filter +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/perl -Tw - -# mutt.vcard.filter - vcard filter for use with the mutt autoview facility -# Copyright (C) 1997,1998,1999 David A Pearson -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the license, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# This little perl script is a simple filter for text/x-vcard -# attachments. I'm pretty sure I've *not* included everything -# possible in here, but it "works for me". Feel free to improve -# in any way you see fit. -# -# Here is how I use it. In my ~/.mutt_mailcap (use your filename of -# choice) I have the following entry: -# -# text/x-vcard; mutt.vcard.filter; copiousoutput -# -# All you then need to do is add a line like: -# -# auto_view text/x-vcard -# -# to your ~/.muttrc (use your filename of choice). -# -# All comments/flames/feedback can be directed to: -# -# davep@davep.org -# -# http://www.davep.org/mutt/ -# - -use strict; - -my $in_card = 0; -my @address = (); -my @contacts = (); -my @additional = (); -my @notes = (); -my $name = ""; -my $title = ""; -my $org = ""; -my $found_note = 0; -my $len; -my $i; -my $addr_line; -my $contact_line; - -while ( <> ) -{ - if ( $in_card ) - { - if ( /^fn:\s*(.*)$/i ) - { - $name = $1; - } - elsif ( /^n:\s*(.*);\s*(.*)$/i ) - { - @additional = ( "", "Additional information:", "" ) if $#additional == -1; - - @additional = ( @additional, "Last Name:\t$1", "First Name:\t$2" ); - } - elsif ( /^title:\s*(.*)$/i ) - { - $title = $1; - } - elsif ( /^org:\s*(.*)$/i ) - { - $org = $1; - } - elsif ( /^adr:\s*(.*)$/i ) - { - my $addr = $1; - - $addr =~ s/;+/;/g; - - @address = split( /;/, $addr ); - } - elsif ( /^email;\s*(.*?):\s*(.*)$/i || /^tel;\s*(.*?):\s*(.*)$/i ) - { - my $type = $1; - my $value = $2; - - @contacts = ( @contacts, uc( substr( $type, 0, 1 ) ) . - substr( $type, 1 ) . ": $value" ); - } - elsif ( /^note:\s*(.*)$/i ) - { - @notes = ( "" ) if $#notes == -1; - @notes = ( @notes, $1 ); - - $found_note = 1; - } - elsif ( /^=.{2}=$/ && $found_note ) - { - my $line = <>; - - chomp( $line ); - - @notes = ( "" ) if $#notes == -1; - @notes = ( @notes, $line ); - } - elsif ( /^end:\s*vcard$/i ) - { - $in_card = 0; - } - } - else - { - $in_card = /^begin:\s*vcard\s*$/i; - } -} - -@address = ( $org, @address ) if $org; -@address = ( $title, @address ) if $title; -@address = ( $name, @address ) if $name; - -format STDOUT = -@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$addr_line, $contact_line -. - -$len = $#address > $#contacts ? $#address : $#contacts; - -print "" . ( "=" x 76 ) . "\n"; - -for ( $i = 0; $i <= $len; $i++ ) -{ - $addr_line = $i <= $#address ? $address[ $i ] : ""; - $contact_line = $i <= $#contacts ? $contacts[ $i ] : ""; - write; -} - -for ( $i = 0; $i <= $#notes; $i++ ) -{ - print "$notes[ $i ]\n"; -} - -for ( $i = 0; $i <= $#additional; $i++ ) -{ - print "$additional[ $i ]\n"; -} - -print "" . ( "=" x 76 ) . "\n"; diff --git a/misc/parse-remind b/misc/parse-remind deleted file mode 100755 index bdd9f23..0000000 --- a/misc/parse-remind +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl -# -# This script is designed to have an email piped to it eg. from mutt. -# It will split apart all the text/calendar attachments and enter them into -# the 'remind' calendar. -# - -use strict; -use warnings; - -use MIME::Parser; - -my $CONVERT = '~/.mutt/ical2rem.pl'; -my $REMINDERS = '~/remind/mutt.rem'; - -################################################################################ - -my $parser = new MIME::Parser; -$parser->output_under('/tmp'); -my $entity = $parser->parse(\*STDIN); - -my @parts = $entity->parts(); -my $count = 0; - -foreach my $part (@parts) { - if ($part->head->mime_type eq 'text/calendar') { - my $body = $part->bodyhandle; - my $cmd = $CONVERT.' '.$body->path.' >> '.$REMINDERS; - print STDERR `$cmd`; - last if ($? != 0); - $count++; - } -} - -$parser->filer->purge; -if ($count == 0) { - print STDERR "No calendar entries found."; - exit(1); -} - -exit(0); diff --git a/misc/sed/entities.sed b/misc/sed/entities.sed deleted file mode 100644 index b2b4929..0000000 --- a/misc/sed/entities.sed +++ /dev/null @@ -1,24 +0,0 @@ -s//\á/g -s//\ã/g -s//\â/g -s//\à/g -s//\é/g -s//\ê/g -s//\í/g -s//\ó/g -s//\õ/g -s//\ô/g -s//\ú/g -s//\ç/g -s//\Á/g -s//\Ã/g -s//\Â/g -s//\É/g -s//\Ê/g -s//\Í/g -s//\Ó/g -s//\Õ/g -s//\Ô/g -s//\Ú/g -s//\Ç/g -s//\ñ/g diff --git a/misc/sed/justify.sed b/misc/sed/justify.sed deleted file mode 100755 index 0a2e5af..0000000 --- a/misc/sed/justify.sed +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sed -f -# justify.sed - aurlio marinho jargas <verde (a) aurelio net> -# -# it gets a text already wrapped on the desired number of columns -# and add extra white spaces, from left to right, word by word, -# to justify all the lines. there is a maximum of 5 spaces to be -# inserted between the words. if this limit is reached, the line -# is not justified (come on, more than 5 is horrible). empty -# lines are ignored. btw, this comments were justified with this -# script &:) -# -# 20000715 1st release -# 20000722 code cleaned - -# cleaning extra spaces of the line -s/ \+/ /g -s/^ // -s/ $// - -# we'll only justify lines with less than 65 chars -/^.\{65\}/b - -# backup of the 'stripped' line -h - -# spaces -> pattern -# convert series of spaces to a internal pattern `n -:s2p -s/ /`5/g -s/ /`4/g -s/ /`3/g -s/ /`2/g -s/ /`1/g -t 1space -b - -# pattern -> spaces -# restore the spaces converted to the internal pattern `n -:p2s -s/`5/ /g -s/`4/ /g -s/`3/ /g -s/`2/ /g -s/`1/ /g -t check -b - -# check if we've reached our right limit -# if not, continue adding spaces -:check -/^.\{65\}/!b s2p -b - -# here's the "magic": -# add 1 space to the first and minor internal pattern found. -# this way, the extra spaces are always added from left to right, -# always balanced, one by one. -# right after the substitution, we'll restore the spaces and -# test if our limit was reached. -:1space -s/`1/`2/ ; t p2s -s/`2/`3/ ; t p2s -s/`3/`4/ ; t p2s -s/`4/`5/ ; t p2s - -# we don't want to justify with more than 5 added spaces between -# words, so let's restore the original line -/`5/x diff --git a/misc/sed/mail-iso2txt.sed b/misc/sed/mail-iso2txt.sed deleted file mode 100644 index d3bf429..0000000 --- a/misc/sed/mail-iso2txt.sed +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sed -f -# mail-iso2txt.sed - 20000906 <verde (a) aurelio net> -# convert the email encoded chars =xx to the right hexa char -# -# ps.: needs GNU sed >= 3.02.80 because the s//\xnn/ notation - -s|=09|\x09|g -s|=20|\x20|g -s|=B7|\xb7|g -s|=BA|\xba|g -s|=C1|\xc1|g -s|=C2|\xc2|g -s|=C3|\xc3|g -s|=C4|\xc4|g -s|=C5|\xc5|g -s|=C6|\xc6|g -s|=C7|\xc7|g -s|=C8|\xc8|g -s|=C9|\xc9|g -s|=CA|\xca|g -s|=CB|\xcb|g -s|=CC|\xcc|g -s|=CD|\xcd|g -s|=CE|\xce|g -s|=CF|\xcf|g -s|=D7|\xd7|g -s|=E1|\xe1|g -s|=E2|\xe2|g -s|=E3|\xe3|g -s|=E4|\xe4|g -s|=E5|\xe5|g -s|=E6|\xe6|g -s|=E7|\xe7|g -s|=E8|\xe8|g -s|=E9|\xe9|g -s|=EA|\xea|g -s|=EB|\xeb|g -s|=EC|\xec|g -s|=ED|\xed|g -s|=EE|\xee|g -s|=EF|\xef|g -s|=F1|\xf1|g -s|=F2|\xf2|g -s|=F3|\xf3|g -s|=F4|\xf4|g -s|=F5|\xf5|g -s|=F6|\xf6|g -s|=F7|\xf7|g -s|=F8|\xf8|g -s|=F9|\xf9|g -s|=FA|\xfa|g -s|=FB|\xfb|g -s|=FC|\xfc|g -s|=$||g - diff --git a/misc/sed/mini-html2latex.sed b/misc/sed/mini-html2latex.sed deleted file mode 100644 index 03fd2d5..0000000 --- a/misc/sed/mini-html2latex.sed +++ /dev/null @@ -1,9 +0,0 @@ -s/<strong>/\\section{/g -s/<\/strong>/}/g -s/<i>/\\emph{/g -s/<\/i>/}/g -s/<a href=\"/\\link{/g -s/\">/}{/g -s/<\/a>/}/g -s/<pre>/\\begin{verbatim}/g -s/<\/pre>/\\end{verbatim}/g diff --git a/misc/sed/syndication.sed b/misc/sed/syndication.sed deleted file mode 100644 index 4b6b195..0000000 --- a/misc/sed/syndication.sed +++ /dev/null @@ -1,27 +0,0 @@ -s/Â/\Â/g -s/â/\â/g -s/ã/\ã/g -s/é/\é/g -s/ô/\ô/g -s/á/\á/g -s/Í/\Í/g -s/í/\í/g -s/ç/\ç/g -s/õ/\õ/g -s/ê/\ê/g -s/Ç/\Ç/g -s/Ã/\Ã/g -s/ó/\ó/g -s/ú/\ú/g -s/Ê/\Ê/g -s/É/\É/g -s/Á/\Á/g -s/Ú/\Ú/g -s//\á/g -s//\é/g -s/&aacute;/\á/g -s/&ecirc;/\ê/g -s/À/\À/g -s/–/\-/g -s/è/\è/g -s/Õ/\Õ/g diff --git a/misc/sed/twiki-to-tiki.sed b/misc/sed/twiki-to-tiki.sed deleted file mode 100755 index d0fe2f5..0000000 --- a/misc/sed/twiki-to-tiki.sed +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sed -f -# -# twiki-to-tiki.sed: formatting conversion -# feedback: rhatto@riseup.net -# - -s/^ \*/\*/ -s/---+++/\!\!\!/ -s/---++/\!\!\!/ -s/---+/\!/ -s/\*\([A-Za-z0-9]*\)\*/__\1__/g -s/<verbatim>/~pp\~/g -s/<\/verbatim>/~\/pp\~/g -s/%TOC%/{maketoc}/ diff --git a/misc/sed/unicode-zoado.sed b/misc/sed/unicode-zoado.sed deleted file mode 100644 index c372a71..0000000 --- a/misc/sed/unicode-zoado.sed +++ /dev/null @@ -1,11 +0,0 @@ -s/á/\á/g -s//\í/g -s/ó/\ó/g -s/ç/\ç/g -s/õ/\õ/g -s/ã/\ã/g -s/â/\â/g -s/é/\é/g -s/ê/\ê/g -s/ó/\ó/g -s/â/\â/g diff --git a/misc/sed/wrap-forced.sed b/misc/sed/wrap-forced.sed deleted file mode 100755 index e7f2cc9..0000000 --- a/misc/sed/wrap-forced.sed +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sed -f -# wrap-forced.sed - wrap lines at column n -# -# acts like fmt, but ignores the 'word' context, -# wrapping the line exactly at the specified column -# -# pt_BR comments: -# funciona como o fmt, mas ignora o contexto de 'palavra' -# quebrando a linha exatamente na coluna especificada -# -# c1: na primeira linha do texto... -# c2: lao para colocar todas as linhas em 1 linha apenas -# c3: isto para eliminar espaos em branco repetidos -# voc pode coment-lo se no quiser alter-los -# c4: dica: tire o espao da 2 parte do comando s para -# apagar todos os espaos (parece arte ascii &:) ) -# c5: aqui quem quebra a linha na coluna especificada -# mude o 25 para o nmero que voc quiser -# o gnu-sed >= 3.02.80 necessrio por causa do \n -# -# 20000726 <verde (a) aurelio net> - -#c1: at the first line of the text... -1{ - - #c2: loop to put all the lines of the text at one single line - :a - $!N - s/\n// - ta - - #c3: - # this is to squeeze blanks - # you can comment it if you want blanks untouched - #c4: - # tip: take off the space at replacement part to have a result with - # NO spaces at all (looks like ascii art &:) ) - s/[[:blank:]]\+/ /g - - #c5: - # here is the guy who breaks the line at the specified column - # just change the 25 whatever column you like - # gnu-sed >= 3.02.80 required because the \n - s/.\{50\}/&\n/g -} - diff --git a/misc/sed/yahoogroups-kill-sig.sed b/misc/sed/yahoogroups-kill-sig.sed deleted file mode 100644 index f7eb8c9..0000000 --- a/misc/sed/yahoogroups-kill-sig.sed +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/sed -f -# yahoogroups-kill-sig.sed by Aurelio Marinho Jargas -# -# Erases the Yahoo! Groups e-mail signature ad -# -# CHANGELOG: -# 20000??? v0.1 First one -# 20000725 v0.2 Now it has BEGIN/END marks, it's easier! -# 20000906 v0.3 Marks changed -# 20001107 v0.3.1 Contrib: Schlemer HTML killer -# ----- eGroups has changed to Yahoo! Groups ----- -# 20010206 v0.4 Contrib: Morcego's s/egroups/yahoo/s fix -# 20010716 v0.5 Marks changed again -# 20030428 v0.6 Policy Terms and Unsubscribe killers included -# 20030506 v0.6.1 One-char fix on the Policy killer, added SAMPLE DATA -# -# DESCRIPTION: -# Yahoogroups.com puts advertises on every sent message to the free groups. -# This file is a sed filter to erase it. It handles quoted '> ' ads also. -# If you do use procmail to filter e-mail messages, use this sed to -# automaticaly remove the Ads for every message you receive. -# -# HOW TO USE: -# Save this file on the disk and put at the begin of your ~/.procmailrc: -# :0 fhw -# * Delivered-To:.*@yahoogroups.com -# | sed -f /path/to/yahoogroups-kill-sig.sed -# -# If preferred, make this file executable (chmod +x), put it in your PATH and: -# :0 fhw -# * Delivered-To:.*@yahoogroups.com -# | yahoogroups-kill-sig.sed -# -# -# SAMPLE DATA FILE: -# You can use this sample data file to test these rules "by hand", -# before including them on the procmail file. -# Save the following fake e-mail message on a 'data.txt' file -# (remove the leading # chars!) and run: -# -# prompt$ sed -f yahoogroups-kill-sig.sed data.txt -# -# All the Ads and Yahoo! messages should be removed. -# -#---------------------------8<--------------------------- -#From: foo@foo.com -#To: foo@foo.com -#Subject: test me -# -#Here's the message body. -#And now, the evil sig. -# -#------------------------ Yahoo! Groups Sponsor ---------------------~--> -#Secure your servers with 128-bit SSL encryption! Grab your copy of -#VeriSign's FREE Guide "Securing Your Web Site for Business." Get it now! -#http://www.verisign.com/cgi-bin/go.cgi?a=n094442340008000 -#http://us.click.yahoo.com/6lIgYB/IWxCAA/yigFAA/dkFolB/TM -#---------------------------------------------------------------------~-> -# -#Your use of Yahoo! Groups is subject to -#http://docs.yahoo.com/info/terms/ -# -#To unsubscribe from this group, send an email to: -#foo-unsubscribe@yahoogroups.com -#--------------------------->8--------------------------- - - - -#------------------------------------------------------------------------- - - -# +----+ -# | Ad | -# +----+ -# -# Ad details: * a line w/ 24 hifens, 'Yahoo...Sponsor', 21 hifens and '~-->' -# * lines with yahoogroups propaganda -# * a line with 69 hifens, and '~->' at the end -# Ad Sample: -# ------------------------ Yahoo! Groups Sponsor ---------------------~--> -# Secure your servers with 128-bit SSL encryption! Grab your copy of -# VeriSign's FREE Guide "Securing Your Web Site for Business." Get it now! -# http://www.verisign.com/cgi-bin/go.cgi?a=n094442340008000 -# http://us.click.yahoo.com/6lIgYB/IWxCAA/yigFAA/dkFolB/TM -# ---------------------------------------------------------------------~-> -# -# Ad Killer: -/^\(> \)*-\{24\} Yahoo! Groups Sponsor -\{21\}~-->$/,/^\(> \)*-\{69\}~->$/d - - -#------------------------------------------------------------------------- - - -# +--------+ -# | Policy | -# +--------+ -# -# You can also remove the Policy Terms message. -# -# Policy Details: A one line message, sometimes broken into two, -# which appears at the very end of the message. -# Policy Sample: -# Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ -# -# Policy Killer: -/^\(> \)*Your use of Yahoo! Groups is subject to *$/N -/^\(> \)*Your use of Yahoo! Groups is subject to/d - - -#------------------------------------------------------------------------- - - -# +-------------+ -# | Unsubscribe | -# +-------------+ -# -# This one is to remove the *default* unsubscribe footer. -# -# Unsubscribe Details: A one line message, sometimes broken into two, -# which appears before the Ads. -# Unsubscribe Sample: -# To unsubscribe from this group, send an email to: -# foo-unsubscribe@yahoogroups.com -# -# Unsubscribe Killer: -/^\(> \)*To unsubscribe from this group, send an email to: *$/N -/^\(> \)*To unsubscribe from this group, send an email to:/d - - -#------------------------------------------------------------------------- - - -# +---------+ -# | Ad HTML | -# +---------+ -# -# For those who receive the Yahoo! messages in HTML (argh!), you may use -# this one also, because the HTML signature is way different. -# -# Ad Details: * an HTML comment with bar-star-star-bar,text,bar-star-star-bar -# * lines with egroups propaganda -# * an HTML comment with bar-star-star-bar,text,bar-star-star-bar -# Ad Sample: -# <!-- |**|begin egp html banner|**| --> -# -# <hr> -# <!-- |@|begin eGroups banner|@| runid: 8193 crid: 4101 --> -# <a target=3D"_blank" -# href=3D"http://click.egroups.com/1/8193/8/_/134812/_/9= -# 66089206/"><center> -# <img width=3D"468" height=3D"60" -# border=3D"0" -# alt=3D"" -# src=3D"http://adimg.egroups.com/img/8193/8/_/134812/_/966089206/468x60_ma= -# ze12k.gif"></center><center><font color=3D"black"></font></center></a> -# <!-- |@|end eGroups banner|@| --> -# <hr> -# -# <!-- |**|end egp html banner|**| --> -# -# Ad Killer: -#/^\(> \)*<!-- |\*\*|begin egp html banner|\*\*| -->$/,/^\(> \)*<!-- |\*\*|end egp html banner|\*\*| -->$/d - - - - - - -#------------------------------------------------------------------------- -# +-------------+ -# | OLD KILLERS | -# +-------------+ -#------------------------------------------------------------------------- -# -# +---------+ -# | Ad v0.4 | -# +---------+ -# -# Ad details: * a line w/ 24 hifens, 'Yahoo!...Sponsor', 21 hifens and '~-~>' -# * lines with yahoogroups propaganda -# * a line with 69 hifens, and '_->' at the end -# Ad Sample: -# ------------------------ Yahoo! Groups Sponsor ---------------------~-~> -# eGroups is now Yahoo! Groups -# Click here for more details -# http://click.egroups.com/1/11231/1/_/161736/_/980877852/ -# ---------------------------------------------------------------------_-> -# -# Ad Killer: -#/^\(> \)*-\{24\} Yahoo! Groups Sponsor -\{21\}~-~>$/,/^\(> \)*-\{69\}_->$/d' -# -#------------------------------------------------------------------------- -# -# +---------+ -# | Ad v0.3 | -# +---------+ -# -# Ad details: * a line w/ 26 hifens, 'eGroups Sponsor', 25 hifens and '~-~>' -# * lines with egroups propaganda -# * a line with 69 hifens, and '_->' at the end -# -# Ad Sample: -# -------------------------- eGroups Sponsor -------------------------~-~> -# GET A NEXTCARD VISA, in 30 seconds! Get rates -# of 2.9% Intro or 9.9% Ongoing APR* and no annual fee! -# Apply NOW! -# http://click.egroups.com/1/7872/14/_/_/_/967638075/ -# ---------------------------------------------------------------------_-> -# -# Ad Killer: -#/^\(> \)*-\{26\} eGroups Sponsor -\{25\}~-~>$/,/^\(> \)*-\{69\}_->$/d -# -#------------------------------------------------------------------------- -# -# +---------+ -# | Ad v0.2 | -# +---------+ -# -# Ad details: * a line with 68 hifens, an '<e|' and another hifen -# * lines with egroups propaganda -# * a line with 68 hifens, an '|e>' and another hifen -# Ad Sample: -# --------------------------------------------------------------------<e|- -# Huge Shoe Selection at Zappos.com -# (small sizes also available) -# http://click.egroups.com/1/7062/5/_/193628/_/964577029/ -# --------------------------------------------------------------------|e>- -# -# Ad Killer: -#/^\(> \)*-\{68\}<e|-$/,/^\(> \)*-\{68\}|e>-$/d -# -#------------------------------------------------------------------------- -# -# +---------+ -# | Ad v0.1 | -# +---------+ -# -# Ad Details: * a line with exactly 72 hifens before and after -# * any number of lines between -# * a line with 'http://click.egroups.com' -# Ad Sample: -# ------------------------------------------------------------------------ -# $60 in FREE Long Distance! Click Here to join beMANY! today. -# http://click.egroups.com/1/4126/10/_/_/_/958599956/ -# ------------------------------------------------------------------------ -# -# Ad Killer: -#/^\(> \)*-\{72\}$/{N;:l;/-\{72\}$/bs;N;bl;:s;s%^.*\n\(> \)*http://click\.egroups\.com.*%%;} diff --git a/mutt-notmuch-tag b/mutt-notmuch-tag deleted file mode 100755 index 9b80a19..0000000 --- a/mutt-notmuch-tag +++ /dev/null @@ -1,21 +0,0 @@ -# mutt-notmuch-tag.sh -# Simple and crude script to tag multiple messagess in mutt using notmuch. -# See http://upsilon.cc/~zack/blog/posts/2011/01/how_to_use_Notmuch_with_Mutt/ - -grep "Message-ID" - > temp.txt -sed -e 's|Message-ID:.*<\(.*\)>.*|id:\1|' temp.txt > temp1.txt -sed '{:q;N;s/\n/ OR /g;t q}' temp1.txt > temp2.txt - -## When vi opens up list the tagging commands, e.g. +tag1 -tag2 -vi tags.txt - -TAGS=`cat tags.txt` -SEARCHEXPR=`cat temp2.txt` - -## For debugging -echo "notmuch tag $TAGS -- $SEARCHEXPR" >> temp2.txt - -## Now apply the tags -notmuch tag $TAGS -- $SEARCHEXPR - -# End of mutt-notmuch-tag.sh diff --git a/philter.py b/philter.py deleted file mode 100755 index 38229aa..0000000 --- a/philter.py +++ /dev/null @@ -1,83 +0,0 @@ -#! /usr/bin/python -# -# Email filter -# -# This is a slighted channged version of Philter available at -# http://philter.sourceforge.net written by Prabhakar V. Chaganti and -# distributed under GPLv2. -# -# Minor changes by rhatto at riseup.net. -# - -import ConfigParser, os, rfc822, re, string, posixpath - - -class Philter: - def __init__(self,match,header,destination,maildir): - self.re = re.compile(match) - self.header = header - self.destination = destination - self.maildir = maildir - - - def __str__(self): - return ("philter : \n \t match: %s \n\t header: %s \n\t destination: %s \n\t maildir: %s" % - (self.re,self.header,self.destination,self.maildir)) - - - -class PhilterDriver: - __propFile = open(string.join((posixpath.expanduser('~'),'/.config/scripts/philterrc'),'')) - __newDir = '/new' - - def createPhilters(self): - sections = PhilterDriver.__config.sections() - sections.sort() - philters=[] - maildir = PhilterDriver.__config.get('DEFAULT','maildir') - for section in sections: - philters.append(Philter((PhilterDriver.__config.get(section,'match')), - string.split(PhilterDriver.__config.get(section,'header'),','), - PhilterDriver.__config.get(section,'destination'), - string.join((maildir,'/',PhilterDriver.__config.get(section,'destination'),'/new'),''))) - return philters - - - def parseConfig(self): - PhilterDriver.__config = ConfigParser.ConfigParser() - PhilterDriver.__config.readfp(PhilterDriver.__propFile) - - - def philterMaildir(self, philters): - inbox = string.join([PhilterDriver.__config.get('DEFAULT','maildir'), - "/",PhilterDriver.__config.get('DEFAULT','inbox'), - PhilterDriver.__newDir],"") - newMessages = os.listdir(inbox) - maildir = PhilterDriver.__config.get('DEFAULT','maildir') - found = 0 - for newMessage in newMessages: - msg = rfc822.Message(open(string.join([inbox,"/",newMessage],""))) - for philter in philters: - for hdr in philter.header: - if msg.getheader(hdr): - if philter.re.search(string.lower(msg.getheader(hdr))): - os.rename(string.join((maildir,'INBOX/new/',newMessage),''), - string.join((philter.maildir,'/',newMessage),'')) - found = 1 - break - - if found: - found = 0 - break - - - def main(self): - driver = PhilterDriver() - driver.parseConfig() - philters = driver.createPhilters() - driver.philterMaildir(philters) - - - -if __name__ == '__main__': - PhilterDriver().main() diff --git a/philter.sh b/philter.sh deleted file mode 100755 index f260a96..0000000 --- a/philter.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# -# Maildir simple filter -# Feedback: rhatto at riseup.net | gpl -# - -PREFILTER="$HOME/apps/scripts/philter.py" -BASE="$HOME/mail/" -MAILBOXES="$BASE/Sync/" -INBOXES="" -#TRASHCAN="$BASE/INBOX.Trash/cur" -TRASHCAN="$BASE/INBOX.Trash/new" -SUBJECT="yes" # wheter to filter subject -DEL="no" # delete the message -BOGOFILTER="yes" -FILTER="***SPAM***" - -# Load configuration -if [ -e "$HOME/.config/scripts/philter" ]; then - source $HOME/.config/scripts/philter -fi - -for account in $INBOXES; do - - NEWBOX="$MAILBOXES/$account/INBOX/new" - - if [ -x $PREFILTER ]; then - $PREFILTER - fi - - cont="0" - cd $NEWBOX - - for file in `ls -1`; do - if grep -m 1 -e "X-Bogosity" "$file" | grep -q "Spam"; then - mv "$file" "$TRASHCAN" - if [[ "$DEL" == "yes" ]]; then - rm "$TRASHCAN/$file" - fi - ((cont++)) - elif [[ "$BOGOFILTER" == "yes" ]]; then - # bogofilter - if cat $file | bogofilter -u -e -p | grep -q -e "^X-Bogosity: Spam, tests=bogofilter"; then - mv "$file" "$TRASHCAN" - if [[ "$DEL" == "yes" ]]; then - rm "$TRASHCAN/$file" - fi - ((cont++)) - fi - fi - done - - if [ ! -z "$SUBJECT" ]; then - for file in `ls -1`; do - if grep -m 1 "$FILTER" "$file" | grep -q "Subject"; then - mv "$file" "$TRASHCAN" - if [[ "$DEL" == "yes" ]]; then - rm "$TRASHCAN/$file" - fi - ((cont++)) - fi - done - fi - - echo "Total: $cont filtered messages for account $account." - -done diff --git a/playlist-copy b/playlist-copy deleted file mode 120000 index a766a62..0000000 --- a/playlist-copy +++ /dev/null @@ -1 +0,0 @@ -playlist-get
\ No newline at end of file diff --git a/playlist-drop b/playlist-drop deleted file mode 120000 index a766a62..0000000 --- a/playlist-drop +++ /dev/null @@ -1 +0,0 @@ -playlist-get
\ No newline at end of file diff --git a/playlist-get b/playlist-get deleted file mode 100755 index 170f6be..0000000 --- a/playlist-get +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# Get playlist files using git-annex. -# - -# Parameters -BASENAME="`basename $0`" -PLAYLIST="$1" -DEST="$2" -MEDIA="/var/cache/media/noise" -PLAYLISTS="$MEDIA/playlists" -APP="git annex" - -# Basic syntax -if [ -z "$PLAYLIST" ]; then - echo "Usage: $BASENAME <playlist> [dest]" - - if [ -d "$PLAYLISTS" ]; then - echo "" - echo "Available playlists: " - ls $PLAYLISTS - fi - - exit 1 -elif [ ! -f "$PLAYLISTS/$PLAYLIST.m3u" ]; then - echo "No such playlist $PLAYLISTS/$PLAYLIST.m3u" - exit 1 -fi - -# Set action -if [ "$BASENAME" == "playlist-drop" ]; then - action="drop" -elif [ "$BASENAME" == "playlist-copy" ]; then - if [ -z "$DEST" ]; then - echo "No destination specified" - exit 1 - elif [ -d "$DEST" ]; then - APP="cp -Lv" - action="" - - # Force absolute path - DEST="`cd $DEST && pwd`" - else - DEST="--to $DEST" - action="copy" - fi -else - action="get" -fi - -echo "Getting files from $PLAYLISTS/$PLAYLIST.m3u..." -cd $MEDIA - -# Process -cat $PLAYLISTS/$PLAYLIST.m3u | while read file; do - if [ -z "$action" ] && [ "$APP" == "cp -Lv" ]; then - prefix="/$(dirname "$file")" - mkdir -p "$DEST$prefix" - $APP $action "$file" "$DEST$prefix" - elif [ "$action" == "get" ]; then - $APP $action "$file" - else - $APP $action "$file" $DEST - fi -done diff --git a/playlist-ls b/playlist-ls deleted file mode 100755 index 1894ae6..0000000 --- a/playlist-ls +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Get files for playlist using git-annex and mpd -# - -# Parameters -BASENAME="`basename $0`" -PLAYLIST="$1" -MEDIA="/var/cache/media/noise" -PLAYLISTS="$MEDIA/playlists" - -if [ -z "$PLAYLIST" ]; then - ls -C $PLAYLISTS -elif [ -f "$PLAYLISTS/$PLAYLIST.m3u" ]; then - cat "$PLAYLISTS/$PLAYLIST.m3u" -fi @@ -1,50 +0,0 @@ -#!/bin/bash -# -# Fancy bash prompt. -# See http://www.debian-administration.org/article/Fancy_Bash_Prompts -# - -function command_prompt() { - exit_status="$?" - # colors - COLOR_RED="\[\033[31m\]" - COLOR_GREEN="\[\033[32m\]" - COLOR_YELLOW="\[\033[33m\]" - COLOR_BLUE="\[\033[34m\]" - COLOR_MAGENTA="\[\033[35m\]" - COLOR_CYAN="\[\033[36m\]" - - COLOR_RED_BOLD="\[\033[31;1m\]" - COLOR_GREEN_BOLD="\[\033[32;1m\]" - COLOR_YELLOW_BOLD="\[\033[33;1m\]" - COLOR_BLUE_BOLD="\[\033[34;1m\]" - COLOR_MAGENTA_BOLD="\[\033[35;1m\]" - COLOR_CYAN_BOLD="\[\033[36;1m\]" - - COLOR_NONE="\[\033[0m\]" - BOLD="\[\033[1m\]" - - if [ "$exit_status" == "0" ]; then - status_color="${COLOR_GREEN}" - else - status_color="${COLOR_RED_BOLD}" - fi - - # Without git completion - #PS1="(${status_color}${exit_status}${COLOR_NONE}) [${COLOR_RED}\D{%Y%m%d %H:%M:%S}${COLOR_NONE}] ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_GREEN}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w${COLOR_NONE} \\$ " - - # Red green theme with git completion - #PS1="(${status_color}${exit_status}${COLOR_NONE}) [${COLOR_RED}\D{%Y%m%d %H:%M:%S}${COLOR_NONE}] ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_GREEN}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w$(__git_ps1 " (%s)")${COLOR_NONE} \\$ " - #PS2="${BOLD}>${OFF} " - - # Yellow blue theme with git completion - PS1="${status_color}${exit_status}${COLOR_NONE} ${COLOR_CYAN}\D{%Y%m%d %H:%M:%S}${COLOR_NONE} ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_YELLOW}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w$(__git_ps1 " (%s)")${COLOR_NONE} \\$ " - PS2="${BOLD}>${OFF} " -} - -# Older systems doesn't source git completion by default -if ! type __git_ps1 &> /dev/null && [ -e "/etc/bash_completion.d/git" ]; then - source /etc/bash_completion.d/git -fi - -PROMPT_COMMAND="command_prompt" diff --git a/rem2ics b/rem2ics deleted file mode 100755 index f4c7c05..0000000 --- a/rem2ics +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/awk -f -# rem2ics by Anthony J. Chivetta <achivetta@gmail.com> -# from http://www.roaringpenguin.com/wiki/index.php/Rem2ics -# version 0.1 - 2006-06-09 -# version 0.2 - 2010-10-27 (one-line patch by Shane Kerr <shane@time-travellers.org>) -# Converts output of remind -s to iCalendar -# usage: remind -s | rem2ics -# -# THE FOLLOWING CODE IS RELEASED INTO THE PUBLIC DOMAIN -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE -BEGIN { -print "BEGIN:VCALENDAR" -print "VERSION:2.0" -} -{ -gsub("/","",$1) -print "BEGIN:VEVENT" -if ($5 != "*"){ -printf("DTSTART:%dT%02d%02d00\n",$1,$5/60,$5%60) -printf("DTEND:%dT%02d%02d00\n",$1,($5+$4)/60,($5+$4)%60) -print "SUMMARY:" substr($0,match($0,$7)) -} else { -printf("DTSTART:%d\n",$1) -print "SUMMARY:" substr($0,match($0,$6)) -} -print "END:VEVENT" -} -END {print "END:VCALENDAR"} @@ -1,73 +0,0 @@ -#!/usr/bin/gawk -f -# -# sc2csv ver. 0.1 (2001/12/4) -# Copyright (C) 2001 SIGEHUZI Tomoo (tomoo@s.email.ne.jp) - -function pos(s, n, a) { - sub(/[0-9]*$/, " &", s); - n = split(s, a); - if (n != 2) return 1; - J = a[2]; - s = a[1]; - n = split(s, a, ""); - if (n < 1) return 1; - I = 0; - for (i = 1; i <= n; i++) { - if (a[i] !~ /^[A-Z]$/) return 1; - I = I * 26 + v[a[i]]; - } - if (I > N[J]) N[J] = I; - return 0; -} - - -function invalid_line() { - print "Invalid line:", $0 > "/dev/stderr"; - exit(1); -} - - -BEGIN { - nap = split("ABCDEFGHIJKLMNOPQRSTUVWXYZ", ap, ""); - for (i = 1; i <= nap; i++) v[ap[i]] = i - 1; -} - - -/^\#/ {next;} - - -/^goto / {next;} - - -{ - if (NF == 0) next; - if ($1 ~ /^fmt$/) next; - if (pos($2) || $3 != "=") invalid_line(); - val = $0; - sub(/^[^=]*= /, "", val); - if ($1 == "let") { - if (val ~ /^@dts\([0-9]*,[0-9]*,[0-9]*\)$/) { - split(substr(val, 6, length(val) - 6), date, ","); - a[I,J] = sprintf("%d/%d/%d", date[1], date[2], date[3]); - } - else a[I,J] = val; - } - else if ($1 ~ /^(left|right)string$/) { - if (val ~ /^".*"$/) { - s = substr(val, 2, length(val) - 2); - gsub(/\\t/, "\t", s); - gsub(/\\n/, "\n", s); - gsub(/\\"/, "\"\"", s); - a[I,J] = (s ~ /[,"\n\t]/) ? sprintf("\"%s\"", s) : s; - } - else a[I,J] = val; # Much left to be done. - } - else invalid_line(); -} - -END { - for (j = 0; j <= J; j++) { - for (i = 0; i < N[j]; i++) printf("%s,", a[i,j]); - print a[i,j]; - } -} @@ -1,54 +0,0 @@ -#!/bin/bash -# -# Simple autossh and screen wrapper. -# - -# Parameters -BASENAME="`basename $0`" -DEST="$1" -COMMAND="$2" - -# Set screen title -# http://stackoverflow.com/questions/899609/gnu-screen-run-script-that-sends-commands-to-the-screen-session-it-is-being-run -function screen_title { - if [ -n "$STY" ]; then - screen -X title $1 - fi -} - -# Syntax check -if [ -z "$DEST" ]; then - exit 1 -fi - -# Set default screen title -screen_title $DEST - -# Dispatcher -if [ "$BASENAME" == "shells" ]; then - # Remote screen shell using autossh - if [ "$COMMAND" == "root" ]; then - autossh $DEST -t -- sudo screen -x - else - autossh $DEST -t -- screen -x $COMMAND - fi -else - if [ -z "$COMMAND" ] && screen -ls $DEST | grep -q "There is a screen on"; then - # Local existing screen shell - wscreen $DEST - elif [ -z "$COMMAND" ] && [ "$DEST" == "root" ]; then - # Local root shell - screen_title root - sudo screen -x - elif [ "$DEST" == "local" ]; then - # Local screen shell - screen_title $COMMAND - wscreen $COMMAND - else - # Remote shell using autossh - autossh $DEST -t -- $COMMAND - fi -fi - -# Restore screen title -screen_title terminal @@ -1 +0,0 @@ -shell
\ No newline at end of file @@ -1,14 +0,0 @@ -#!/bin/bash -# -# Chroot wrapper -# - -# Load configuration -if [ -e "$HOME/.config/scripts/chroot" ]; then - source $HOME/.config/scripts/chroot -fi - -xhost local:$CHROOT_USER -sudo su $CHROOT_USER -c "schroot -d /home/$CHROOT_USER -c squeeze -p skype" & -sleep 1 -xhost - diff --git a/ssh-agent-eval b/ssh-agent-eval deleted file mode 100755 index 2edf711..0000000 --- a/ssh-agent-eval +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# Initializes the ssh-agent -# - -# SSH Agent -#SSHAGENT=/usr/bin/ssh-agent -#SSHAGENTARGS="-s" -# -#function ssh_agent_eval_run { -# eval `$SSHAGENT $SSHAGENTARGS` &> /dev/null -# trap "ps $SSH_AGENT_PID &> /dev/null && kill $SSH_AGENT_PID" 0 -#} -# -#if [ "$1" == "-f" ]; then -# echo "Starting a new ssh-agent..." -# ssh_agent_eval_run -#elif [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then -# ssh_agent_eval_run -#fi - -# See http://mah.everybody.org/docs/ssh - -SSH_ENV="$HOME/.ssh/environment" - -function start_agent { - echo "Initialising new SSH agent..." - /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" - echo succeeded - chmod 600 "${SSH_ENV}" - . "${SSH_ENV}" > /dev/null - /usr/bin/ssh-add; - /usr/bin/monkeysphere subkey-to-ssh-agent -} - -# Source SSH settings, if applicable - -if [ -f "${SSH_ENV}" ]; then - . "${SSH_ENV}" > /dev/null - #ps ${SSH_AGENT_PID} doesn't work under cywgin - ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { - start_agent; - } -else - start_agent; -fi @@ -1,49 +0,0 @@ -#!/bin/bash -# -# SSL wrapper scripts -# -# This code is licensed under a Creative Commons License. -# http://creativecommons.org/licenses/by-nc-sa/3.0/ -# - -# -# show usage -# -function usage { - echo "SSL wrapper scripts" - echo "Based on http://www.madboa.com/geek/openssl/" -} - -# -# usage: retrieve-cert.sh remote.host.name [port] -# -function retrieve { - REMHOST=$1 - REMPORT=${2:-443} - - echo |\ - openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |\ - sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' -} - -# -# usage: fingerprint cert -# -function fingerprint { - openssl x509 -noout -in $1 -fingerprint - openssl x509 -noout -in $1 -fingerprint -md5 -} - -# Parse option -COMMAND="$1" -shift - -if [ "$COMMAND" == "retrieve" ]; then - retrieve $* -elif [ "$COMMAND" == "verify" ]; then - openssl verify $* -elif [ "$COMMAND" == "fingerprint" ] || [ "$COMMAND" == "finger" ]; then - fingerprint $* -else - usage -fi diff --git a/start-streaming b/start-streaming deleted file mode 100755 index e6acd07..0000000 --- a/start-streaming +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# GStreamer command line wrapper -# -# Thanks to rafael at riseup.net and the following documents: -# -# http://current.workingdirectory.net/posts/2010/video4linux-and-audio/ -# http://mcs.hackitectura.net/tiki-index.php?page=live+stream+with+gstreamer -# https://en.wikibooks.org/wiki/Puredyne/Stream_Audio_and_Video#Gstreamer -# http://wm161.net/2011/03/02/anchorman/ -# -# Needed packages: v4l-utils gstreamer-tools -# -# Example config: -# -# SERVER="icecast.example.org" -# PORT="8000" -# PASS="hackme" -# MOUNT="mount.ogv" -# NAME="Stream" -# DESC="Description" -# GENRE="Genre" -# URL="http://example.org" - -# Parameters -DATE="`date +%Y%m%d%H%M%S`" -BASE="~/.config/start-streaming" -CONFIG="$1" - -# Parsing -if [ -z "$CONFIG" ]; then - echo "usage: `basename $0` <config>" - exit 1 -fi - -mkdir -p $BASE - -if [ ! -f "$BASE/$CONFIG.conf" ]; then - echo "error: no $BASE/$CONFIG.conf found" - exit 1 -fi - -source $BASE/$CONFIG.conf - -#v4l2-ctl --set-input 1 - -# Video source: screen -gst-launch ximagesrc ! queue ! textoverlay text="$DESC" font-desc="50px" ! queue ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=320,height=240 ! theoraenc bitrate=100 ! queue ! oggmux name=mux alsasrc ! queue ! audioconvert ! vorbisenc bitrate=48000 ! queue ! mux. mux. ! tee name=tt ! queue ! filesink location=$DATE-$MOUNT tt. ! queue ! shout2send ip=$SERVER port=$PORT password=$PASS mount=/$MOUNT streamname="$NAME" description="$DESC" genre="$GENRE" url=$URL - -# Video source: camera -#gst-launch v4l2src ! queue ! textoverlay text="$DESC" font-desc="50px" ! queue ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=320,height=240 ! theoraenc bitrate=100 ! queue ! oggmux name=mux alsasrc ! queue ! audioconvert ! vorbisenc bitrate=48000 ! queue ! mux. mux. ! tee name=tt ! queue ! filesink location=$DATE-$MOUNT tt. ! queue ! shout2send ip=$SERVER port=$PORT password=$PASS mount=/$MOUNT streamname="$NAME" description="$DESC" genre="$GENRE" url=$URL - -# norm=NTSC does not work on debian squeeze -#gst-launch v4l2src norm=NTSC ! queue ! textoverlay text="$DESC" font-desc="50px" ! queue ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=320,height=240 ! theoraenc bitrate=100 ! queue ! oggmux name=mux alsasrc ! queue ! audioconvert ! vorbisenc bitrate=48000 ! queue ! mux. mux. ! tee name=tt ! queue ! filesink location=$MOUNT tt. ! queue ! shout2send ip=$SERVER port=$PORT password=$PASS mount=/$MOUNT streamname="$NAME" description="$DESC" genre="$GENRE" url=$URL diff --git a/sync-all b/sync-all deleted file mode 120000 index e737e41..0000000 --- a/sync-all +++ /dev/null @@ -1 +0,0 @@ -sync-code
\ No newline at end of file diff --git a/sync-code b/sync-code deleted file mode 100755 index 1d1ccc9..0000000 --- a/sync-code +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# sync code or home folder across systems -# - -BASENAME="`basename $0`" -DEST="$1" -UNISON="unison" - -# Use the following config if you need to sync with legacy systems -UNISON="unison-2.32.52" - -function sync_code_run { - local config="$1" - - if [ -z "$config" ]; then - return - fi - - if [ -f "$HOME/.unison/$config.prf" ]; then - echo "Starting sync using $config..." - $UNISON $config - else - echo "Skipping absent profile $config." - return - fi -} - -if [ ! -z "$DEST" ]; then - profiles="" - - if [ "$BASENAME" == "sync-code" ] || [ "$BASENAME" == "sync-all" ]; then - profiles="$profiles $DEST-code" - fi - - if [ "$BASENAME" == "sync-irssi" ] || [ "$BASENAME" == "sync-all" ]; then - profiles="$profiles $DEST-irssi" - fi - - if [ "$BASENAME" == "sync-irssi-tor" ] || [ "$BASENAME" == "sync-all" ]; then - profiles="$profiles $DEST-irssi-tor" - fi - - if [ "$BASENAME" == "sync-home" ] || [ "$BASENAME" == "sync-all" ]; then - profiles="$profiles $DEST-home" - fi - - for profile in $profiles; do - sync_code_run $profile - done -fi diff --git a/sync-home b/sync-home deleted file mode 120000 index e737e41..0000000 --- a/sync-home +++ /dev/null @@ -1 +0,0 @@ -sync-code
\ No newline at end of file diff --git a/sync-irssi b/sync-irssi deleted file mode 120000 index e737e41..0000000 --- a/sync-irssi +++ /dev/null @@ -1 +0,0 @@ -sync-code
\ No newline at end of file diff --git a/sync-irssi-tor b/sync-irssi-tor deleted file mode 120000 index e737e41..0000000 --- a/sync-irssi-tor +++ /dev/null @@ -1 +0,0 @@ -sync-code
\ No newline at end of file diff --git a/tails-dl b/tails-dl deleted file mode 100755 index 685e3b3..0000000 --- a/tails-dl +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# Download the Tails -# - -# Parameters -BASENAME="`basename $0`" -DL="$HOME/data/apps/distros/tails/" -VERSION="$1" -BASE_URL="http://dl.amnesia.boum.org/tails/stable/tails-i386-$VERSION" -CWD="`pwd`" - -# Syntax check -if [ -z "$VERSION" ]; then - echo "usage: $BASENAME <version>" - echo "example: $BASENAME 0.22" - exit 1 -fi - -# Set file names -FILE="tails-i386-$VERSION.iso" -HYBRID="tails-i386-$VERSION.hybrid.iso" -SIGN="$FILE.sig" - -# Download package -if [ ! -e "$DL/$FILE" ]; then - wget -c $BASE_URL/$FILE -O $DL/$FILE || exit 1 -fi - -# Download signature -if [ ! -e "$DL/$SIGN" ]; then - wget -c $BASE_URL/$SIGN -O $DL/$SIGN || exit 1 -fi - -# Check signature -gpg --verify $DL/$SIGN $DL/$FILE || exit 1 - -# Symlink and hybrid version -cd $DL -ln -sf $FILE tails-i386-latest.iso -ln -sf $SIGN tails-i386-latest.iso.sig -cp $FILE $HYBRID -ln -sf $HYBRID tails-i386-latest.hybrid.iso -isohybrid $HYBRID -cd $CWD diff --git a/terminal b/terminal deleted file mode 100755 index e76974a..0000000 --- a/terminal +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# Terminal emulator wrapper -# - -source ~/.geometry || exit 1 - -if [ -z "$TITLE" ]; then - if [ ! -z "$1" ]; then - TITLE="$1" - else - TITLE="terminal" - fi -fi - -if [ "$TERM" == "rxvt" ]; then - if [ ! -z "$1" ]; then - rxvt-unicode -bg black +sb -fg white -fn $FONT -g $GEOMETRY -title $TITLE \ - -e bash -rcfile $HOME/.terminal -c "$*" - else - rxvt-unicode -bg black +sb -fg white -fn $FONT -g $GEOMETRY -title $TITLE \ - -e bash -rcfile $HOME/.terminal - fi -elif [ "$TERM" == "Eterm" ]; then - if [ ! -z "$1" ]; then - Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white -F $FONT --borderless no \ - --buttonbar 0 -g $GEOMETRY -n$TITLE -e bash -rcfile $HOME/.terminal -c "$*" - else - Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white -F $FONT --borderless no \ - --buttonbar 0 -g $GEOMETRY -n$TITLE -e bash -rcfile $HOME/.terminal - fi -elif [ "$TERM" == "xterm" ]; then - if [ ! -z "$1" ]; then - xterm -u8 -fn $FONT -geometry $GEOMETRY -title $TITLE -e bash -c "$*" - else - xterm -u8 -fn $FONT -geometry $GEOMETRY -title $TITLE -e bash - fi -fi diff --git a/timelog b/timelog deleted file mode 100755 index 289c298..0000000 --- a/timelog +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# Worklog wrapper -# -# Alternatives to current worklog backend: -# -# https://github.com/snaptortoise/worklog -# https://github.com/tormaroe/worklog -# https://github.com/winged/worklog - -BASE="$HOME/file" -CODEBASE="$HOME/code" -GROUP="$1" -ACTION="$2" -BASENAME="`basename $0`" - -if [ -z "$GROUP" ]; then - echo "Usage: $BASENAME <group> [edit]" - exit 1 -fi - -if [ -z "$EDITOR" ]; then - EDITOR="vi" -fi - -if [ -d "$CODEBASE/$GROUP" ] && [ ! -d "$BASE/$GROUP" ]; then - BASE="$CODEBASE" -fi - -mkdir -p $BASE/$GROUP/worklog - -if [ ! -e "$BASE/$GROUP/worklog/projects" ]; then - cat > $BASE/$GROUP/worklog/projects <<EOF -# Worklog project file -# note that projects appear in Worklog in REVERSE order - -#H:Hosting -#I:Infrastructure -#O:Organization -EOF - - echo "First run, you should edit your project list..." - $EDITOR $BASE/$GROUP/worklog/projects - ( cd $BASE/$GROUP/worklog && worklog ) -elif [ "$ACTION" == "edit" ]; then - $EDITOR $BASE/$GROUP/worklog/projects -else - ( cd $BASE/$GROUP/worklog && worklog ) -fi diff --git a/tor-browser b/tor-browser deleted file mode 100755 index 0267d2b..0000000 --- a/tor-browser +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Wrapper for the Tor Software Bundle -# - -ARCH="`uname -m`" - -if [ "$ARCH" == "i386" ]; then - ARCH="linux32" -elif [ "$ARCH" == "i686" ]; then - ARCH="linux32" -elif [ "$ARCH" == "x86_64" ]; then - ARCH="linux64" -fi - -$HOME/apps/tor-browser/$ARCH/start-tor-browser &> $HOME/apps/tor-browser/$ARCH/Data/Browser/tor-browser.log & diff --git a/tor-browser-dl b/tor-browser-dl deleted file mode 100755 index 5609841..0000000 --- a/tor-browser-dl +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# Download the Tor Browser Bundle. -# - -# Parameters -BASENAME="`basename $0`" -APPS="$HOME/apps" -APP_BASE="$APPS/tor-browser" -TEMP="$TMP/tor-browser" -DL="$HOME/data/apps/distros/tor/" -VERSION="$1" -ARCH="$2" -LANG="$3" -BASE_URL="https://www.torproject.org/dist/torbrowser/$VERSION" - -# Syntax check -if [ -z "$VERSION" ]; then - echo "usage: $BASENAME <version> [arch] [lang]" - echo "example: $BASENAME 2.3.25-14-dev linux64 en-US" - exit 1 -fi - -# Set arch -if [ -z "$ARCH" ]; then - ARCH="linux64" -fi - -# Set lang -if [ -z "$LANG" ]; then - LANG="en-US" -fi - -# Set file names -FILE="tor-browser-$ARCH-$VERSION"_"$LANG.tar.xz" -SIGN="$FILE.asc" - -# Check existing installation -if [ -d "$APP_BASE/$ARCH-$VERSION" ]; then - echo "TBB version $VERSION for $ARCH already installed" - exit 1 -fi - -# Temp folder -mkdir -p $TEMP - -# Download package -if [ ! -e "$DL/$FILE" ]; then - wget -c $BASE_URL/$FILE -O $DL/$FILE || exit 1 -fi - -# Download signature -if [ ! -e "$DL/$SIGN" ]; then - wget -c $BASE_URL/$SIGN -O $DL/$SIGN || exit 1 -fi - -# Check signature -gpg --verify $DL/$SIGN $DL/$FILE || exit 1 - -# Unpack -( cd $TEMP && tar xf $DL/$FILE ) || exit 1 - -# Move and symlink -mv $TEMP/tor-browser_$LANG $APP_BASE/$ARCH-$VERSION -rm -rf $APP_BASE/$ARCH && \ -( cd $APP_BASE && ln -sf $ARCH-$VERSION $ARCH ) - -# Cleanup -rm -rf $TEMP -echo "Please check and cleanup old versions at $APP_BASE" diff --git a/ttyttertor b/ttyttertor deleted file mode 100755 index 3943f82..0000000 --- a/ttyttertor +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -# Simple TTYtter wrapper -# - -PERL_RL=Gnu usewithtor ttytter @@ -1,39 +0,0 @@ -#!/bin/bash -# -# Simple wrapper around VBoxManage. -# - -# Parameters -BASENAME="`basename $0`" -COMMAND="$1" -VM="$2" - -# Usage -function usage { - echo "usage: $BASENAME <command> [vm]" - exit 1 -} - -# Build options -if [ ! -z "$VM" ]; then - if [ "$COMMAND" == "up" ]; then - OPTIONS="" - COMMAND="startvm" - elif [ "$COMMAND" == "down" ]; then - OPTIONS="savestate" - COMMAND="controlvm" - elif [ "$COMMAND" == "halt" ]; then - OPTIONS="poweroff" - COMMAND="controlvm" - else - usage - fi -elif [ "$COMMAND" == "status" ]; then - OPTIONS="runningvms" - COMMAND="list" -else - usage -fi - -# Dispatch -VBoxManage $COMMAND $VM $OPTIONS diff --git a/wav2dao b/wav2dao deleted file mode 100755 index 910aed6..0000000 --- a/wav2dao +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl - -use strict 'subs'; -use strict 'refs'; - -@dev = ('--device', '/dev/pg0:0,0'); - -sub help { - print "Syntax: $0 [-H] [options] audiofiles\n"; - print <<"EOF" ; -Use cdrdao on the wav audio file arguments, making an appropriate toc file. --d cdrw Use cdrw as the CDRW device (default: $dev[1]). --o file Output the toc file on this file - do not use a temporary file. --p Perform a 'print-size' cdrdao command. --i Perform a 'toc-info' cdrdao command. --c Perform a 'show-toc' cdrdao command. --t Perform a 'read-test' cdrdao command. --w Write the CD in DAO mode (default, if no other action is specified). --s Simulate writing only ('simulate' instead of 'write' command). --j Do not eject the CD after writing it. --n Print the cdrdao commands, instead of executing them. -EOF -} - -require 'getopts.pl'; -&Getopts('o:pictwsjnH'); -if ($opt_H) { &help ; exit } -$dev[1] = $opt_d if $opt_d; -$opt_w = 1 unless $opt_p || $opt_i || $opt_c || $opt_t || $opt_w || $opt_s || $opt_o ne ""; - -die "Usage: $0 [options] audiofiles" unless @ARGV; - -$fname = $opt_o ne "" ? $opt_o : "/tmp/toc$$"; -open(F, "> $fname") || die "open($fname): $!, stopped"; -print F "CD_DA\n"; - -foreach (@ARGV) { - print F "\nTRACK AUDIO\nNO COPY\n"; -# print F "NO PRE_EMPHASIS\nTWO_CHANNEL_AUDIO\n"; - print F "FILE \"$_\" 0\n"; -# print F "START 00:02:00\n" if $no++; -} -close F; - -if ($opt_p) { - if ($opt_n) { print "cdrdao print-size $fname\n" } - else { system 'cdrdao', 'print-size', $fname} -} - -if ($opt_i) { - if ($opt_n) { print "cdrdao toc-info $fname\n" } - else { system 'cdrdao', 'toc-info', $fname} -} - -if ($opt_c) { - if ($opt_n) { print "cdrdao show-toc $fname\n" } - else { system 'cdrdao', 'show-toc', $fname} -} -if ($opt_t) { - if ($opt_n) { print "cdrdao read-test $fname\n" } - else { system 'cdrdao', 'read-test', $fname} -} - -if ($opt_w || $opt_s) { - unshift @dev, $opt_s ? 'simulate' : 'write'; - push @dev, '--eject' unless $opt_s || $opt_j; - push @dev, $fname; - if ($opt_n) { print "cdrdao @dev\n" } else { system 'cdrdao', @dev } -} -unlink $fname unless $opt_o ne ""; -__END__ diff --git a/wscreen b/wscreen deleted file mode 100755 index f4a1f4c..0000000 --- a/wscreen +++ /dev/null @@ -1,39 +0,0 @@ -# -# Workscreen: screen session wrapper -# -# Alternative: -# http://byobu.co -# http://packages.debian.org/stable/byobu -# - -# Default options. -opts="-c /etc/screenrc" - -# Remove dead screens. -screen -wipe &> /dev/null - -# Session selection. -if [ ! -z "$1" ]; then - if screen -ls $1 | grep -q "There is a screen on"; then - #echo "There's already a screen called $1" - #exit 1 - screen -x $1 - exit $? - else - session="-S $1" - fi - - if [ "$1" == "main" ]; then - opts="" - elif [ "$1" == "root" ]; then - sudo screen -x - exit - elif [ -f "$HOME/.screen/$1" ]; then - opts="-c $HOME/.screen/$1" - elif [ -f "$HOME/.screen/base" ]; then - opts="-c $HOME/.screen/base" - fi -fi - -# Start session. -screen $opts $session @@ -1,57 +0,0 @@ -#!/bin/bash -# -# Conky wrapper -# - -# Start multiple conky instances -function xconky_start { - # Default one - conky & - - # Weather - if [ -e "$HOME/.brweather.conf" ]; then - # Give time for networking - sleep 60 - - # Load weather data first - weather &> /dev/null - - # Clear cache - brweather --clean-cache - - # Weather - conky -c ~/.conky/weather/conkyrc & - fi -} - -# Battery level if on laptop -function xconky_battery { - if laptop-detect; then - echo '${color grey}${color grey}Power: ${battery} ${battery_bar 6}' - fi -} - -# Show home usage -function xconky_fs_home { - echo "~/ \$color\${fs_free $HOME}/\${fs_size $HOME} \${fs_bar 6 $HOME}" -} - -# Refresh all instances -function xconky_refresh { - # Clear cache - brweather --clean-cache - - # Send HUP - killall -USR1 conky -} - -# Parse -if [ -z "$1" ] || [ "$1" == "start" ]; then - xconky_start -elif [ "$1" == "battery" ]; then - xconky_battery -elif [ "$1" = "fs_home" ]; then - xconky_fs_home -elif [ "$1" = "refresh" ]; then - xconky_refresh -fi diff --git a/xhibernate b/xhibernate deleted file mode 100755 index de26f1e..0000000 --- a/xhibernate +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -# Hibernate computer -# - -xlock -sleep 2 -sudo s2disk @@ -1,6 +0,0 @@ -#!/bin/bash -# -# Lock the screen using xscreensaver -# - -xscreensaver-command --lock @@ -1,6 +0,0 @@ -# -# Simple wrapper around mutt -# - -xtitle mail -mutt diff --git a/xsuspend b/xsuspend deleted file mode 100755 index e1ecd71..0000000 --- a/xsuspend +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -# Activate software suspend -# - -xlock -sleep 2 -sudo pm-suspend @@ -1,10 +0,0 @@ -#!/bin/bash -# -# Start wicd if on laptop boxes. -# - -if laptop-detect; then - if which wicd-gtk &> /dev/null; then - wicd-gtk --tray - fi -fi @@ -1,13 +0,0 @@ -#!/bin/bash -# -# Start calendar application. -# - -# Set title. -xtitle calendar - -# For some reason, we have to sleep a while, otherwise wyrd won't start. -sleep 0.01 - -# Start wyrd. -wyrd |