From 4b88b73bd65cf8efe54d18cca02a871df7e77b61 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 12 Nov 2010 22:47:55 +0100 Subject: [PATCH 01/16] bin/calc: Add. A simple wrapper for python providing fast access to calculator functions. --- bin/calc | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 bin/calc diff --git a/bin/calc b/bin/calc new file mode 100755 index 0000000..a71e783 --- /dev/null +++ b/bin/calc @@ -0,0 +1,11 @@ +#!/bin/sh + +python -i -c 'from math import *; + +def ld(x): + return log(x)/log(2) + +def binom(n,k): + return reduce(lambda a,b: a*(n-b)/(b+1),xrange(k),1) + +print "Welcome to the ultimate calculator."' -- 2.44.2 From 003732b24ad7c6562550ae781a9ec01a29a31b0f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 12 Nov 2010 22:51:20 +0100 Subject: [PATCH 02/16] shell/env: First add ~/.shell/bin to PATH. So scripts in ~/.bin or ~/bin overrule it. --- shell/env | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/env b/shell/env index 15d8f45..d478b17 100644 --- a/shell/env +++ b/shell/env @@ -10,15 +10,15 @@ LANG=en_US.UTF-8 export LANG # Add ~/bin and ~/.bin and ~/.shell/bin to PATH if available. +if [ -d ~/.shell/bin ]; then + PATH=~/.shell/bin:$PATH +fi if [ -d ~/bin ]; then PATH=~/bin:$PATH fi if [ -d ~/.bin ]; then PATH=~/.bin:$PATH fi -if [ -d ~/.shell/bin ]; then - PATH=~/.shell/bin:$PATH -fi # Use Vim as editor. EDITOR=vim -- 2.44.2 From c2c4969faef805530a3283f9afdd47eb1d1829f9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 12 Nov 2010 22:54:01 +0100 Subject: [PATCH 03/16] bin/pdftotext-: Add. Wrapper for pdftotext writing to stdout. Necessary for gitattributes which passes the file as last parameter. --- bin/pdftotext- | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 bin/pdftotext- diff --git a/bin/pdftotext- b/bin/pdftotext- new file mode 100755 index 0000000..8606356 --- /dev/null +++ b/bin/pdftotext- @@ -0,0 +1,3 @@ +#!/bin/sh + +pdftotext "$@" - -- 2.44.2 From 3ed42ce079f19783a6b89f214603f8f4b5bc62a2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 20 Nov 2010 09:57:58 +0100 Subject: [PATCH 04/16] bin/updated-git.sh: Add. Syncs git repository with all remotes. --- bin/update-git.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 bin/update-git.sh diff --git a/bin/update-git.sh b/bin/update-git.sh new file mode 100755 index 0000000..83080b9 --- /dev/null +++ b/bin/update-git.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# Push current commits to all remotes and fetch from all remotes. Then display +# unmerged commits and changes in the repositories. +# +# If an argument is given cd to this directory before running the commands. +# +# Very useful to sync multiple remotes. + + +if [ x$1 != x ]; then + echo $1 + cd "$1" +fi + +# Get all remote changes. +git remote update 2>&1 | grep -v Fetching +# Push all local changes to remote(s). +for remote in `git remote`; do + git push $remote 2>&1 | grep -v 'Everything up-to-date' +done +# Show unmerged changes. +git branch -rv --color --no-merged +# Show uncommitted changes. +if `echo "$1" | grep '\.git\$' > /dev/null`; then + cd .. +fi +git status | grep 'Changes to be committed:' > /dev/null \ + && echo '-> modified (staged)' +git status | grep 'Changed but not updated:' > /dev/null \ + && echo '-> modified' +git status | grep 'Untracked files:' > /dev/null \ + && echo '-> modified (untracked)' + +echo -- 2.44.2 From 28f049c8e93c4a4f262bfebad4d8f61acc67b7f2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 20 Nov 2010 10:01:57 +0100 Subject: [PATCH 05/16] bin/update-git.sh: Rename to git-update.sh. --- bin/{update-git.sh => git-update.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bin/{update-git.sh => git-update.sh} (100%) diff --git a/bin/update-git.sh b/bin/git-update.sh similarity index 100% rename from bin/update-git.sh rename to bin/git-update.sh -- 2.44.2 From 4091679bbc1ed03620e31006399e78608c66586b Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 20 Nov 2010 10:03:35 +0100 Subject: [PATCH 06/16] bin/git-update-all.sh: Runs git-update.sh recursively. --- bin/git-update-all.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/git-update-all.sh diff --git a/bin/git-update-all.sh b/bin/git-update-all.sh new file mode 100755 index 0000000..b2ae8f8 --- /dev/null +++ b/bin/git-update-all.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Run git-update.sh for all git repositories in this directory. + + +find . -name .git -type d -exec git-update.sh {} \; | less -- 2.44.2 From be2c42a1aedc84e0e510b8b0296bcebc587a4816 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 20 Nov 2010 16:15:28 +0100 Subject: [PATCH 07/16] bin/git-update.sh: Also push tags to remotes. --- bin/git-update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/git-update.sh b/bin/git-update.sh index 83080b9..e9c0aba 100755 --- a/bin/git-update.sh +++ b/bin/git-update.sh @@ -18,6 +18,7 @@ git remote update 2>&1 | grep -v Fetching # Push all local changes to remote(s). for remote in `git remote`; do git push $remote 2>&1 | grep -v 'Everything up-to-date' + git push --tags $remote 2>&1 | grep -v 'Everything up-to-date' done # Show unmerged changes. git branch -rv --color --no-merged -- 2.44.2 From e125db3d72be558ad43bf73e600f4a949c07ffe7 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 25 Nov 2010 18:30:24 +0100 Subject: [PATCH 08/16] zsh/env: Setup lesspipe. --- zsh/env | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zsh/env b/zsh/env index 81df0bd..2eced63 100644 --- a/zsh/env +++ b/zsh/env @@ -22,6 +22,12 @@ export LESS_TERMCAP_us=$'\e[04;1;33m' export LESS_TERMCAP_ue=$'\e[0m' +# Setup lesspipe to view multiple file-types (like .gz, .zip, etc.) with less. +# Useful in combination with the "p" alias. Taken from Debian's default bash +# files. Thanks. +[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)" + + source_config ~/.zsh/env.local source_debug ". ~/.zsh/env (done)" -- 2.44.2 From 687223b44895de723bb403d66dfca87b2f778f5c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 30 Nov 2010 10:09:48 +0100 Subject: [PATCH 09/16] bin/git-update.sh: Add --local option. --- bin/git-update.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/git-update.sh b/bin/git-update.sh index 83080b9..3fea2d6 100755 --- a/bin/git-update.sh +++ b/bin/git-update.sh @@ -3,22 +3,32 @@ # Push current commits to all remotes and fetch from all remotes. Then display # unmerged commits and changes in the repositories. # +# If --local is given as option, no fetching/pushing is performed. +# # If an argument is given cd to this directory before running the commands. # # Very useful to sync multiple remotes. +LOCAL= +if [ x$1 = x--local ];then + LOCAL=1 + shift +fi + if [ x$1 != x ]; then echo $1 cd "$1" fi -# Get all remote changes. -git remote update 2>&1 | grep -v Fetching -# Push all local changes to remote(s). -for remote in `git remote`; do - git push $remote 2>&1 | grep -v 'Everything up-to-date' -done +if [ x$LOCAL = x ]; then + # Get all remote changes. + git remote update 2>&1 | grep -v Fetching + # Push all local changes to remote(s). + for remote in `git remote`; do + git push $remote 2>&1 | grep -v 'Everything up-to-date' + done +fi # Show unmerged changes. git branch -rv --color --no-merged # Show uncommitted changes. -- 2.44.2 From 189b0e98a4ad0f1aafb061a2e3322e333c352102 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 30 Nov 2010 10:10:54 +0100 Subject: [PATCH 10/16] bin/git-update-all.sh: Pass arguments to git-update.sh. --- bin/git-update-all.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/git-update-all.sh b/bin/git-update-all.sh index b2ae8f8..45ef0fa 100755 --- a/bin/git-update-all.sh +++ b/bin/git-update-all.sh @@ -1,6 +1,8 @@ #!/bin/sh # Run git-update.sh for all git repositories in this directory. +# +# All arguments are passed to git-update.sh. -find . -name .git -type d -exec git-update.sh {} \; | less +find . -name .git -type d -exec git-update.sh "$@" {} \; | less -- 2.44.2 From f0603be5c23e9cb2f1e32b0fdcac15848943ff93 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 3 Dec 2010 12:39:16 +0100 Subject: [PATCH 11/16] bin/valgrind{,-ptr}.sh: Add. Useful options for valgrind. --- bin/valgrind-ptr.sh | 3 +++ bin/valgrind.sh | 3 +++ 2 files changed, 6 insertions(+) create mode 100755 bin/valgrind-ptr.sh create mode 100755 bin/valgrind.sh diff --git a/bin/valgrind-ptr.sh b/bin/valgrind-ptr.sh new file mode 100755 index 0000000..965a587 --- /dev/null +++ b/bin/valgrind-ptr.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +valgrind --tool=exp-ptrcheck --error-exitcode=1 "$@" diff --git a/bin/valgrind.sh b/bin/valgrind.sh new file mode 100755 index 0000000..dd8038a --- /dev/null +++ b/bin/valgrind.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 "$@" -- 2.44.2 From 8eb880d47c738a822a9e9df12140369f4c79dc44 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 10 Dec 2010 11:07:33 +0100 Subject: [PATCH 12/16] inputrc: jj exits insert mode. Remove "set keymap vi" because it causes problems with the jj mapping. --- inputrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inputrc b/inputrc index b18da70..1b24fd2 100644 --- a/inputrc +++ b/inputrc @@ -7,4 +7,9 @@ set show-all-if-unmodified on # Activate Vi editing mode. set editing-mode vi -set keymap vi + + +# KEY BINDINGS + +# Also use jj to exit insert mode. +"jj": vi-movement-mode -- 2.44.2 From 648929874799d5c3db6ba5a7cfab874ca9b0306f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 10 Dec 2010 11:09:05 +0100 Subject: [PATCH 13/16] inputrc: Add Ctrl-P/N as replacements for arrow keys. --- inputrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inputrc b/inputrc index 1b24fd2..fbb452f 100644 --- a/inputrc +++ b/inputrc @@ -13,3 +13,6 @@ set editing-mode vi # Also use jj to exit insert mode. "jj": vi-movement-mode + +"\C-p": previous-history +"\C-n": next-history -- 2.44.2 From 7ff47f8d37cdf3c51ad9b345ef1b58f9173e34eb Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 26 Dec 2010 21:29:43 +0100 Subject: [PATCH 14/16] inputrc: Always tab complete all items. No matter how many there are. --- inputrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inputrc b/inputrc index fbb452f..ab48ee6 100644 --- a/inputrc +++ b/inputrc @@ -5,6 +5,11 @@ set show-all-if-ambiguous on set show-all-if-unmodified on +# Always complete all items no matter how many there are. +set completion-query-items -1 +# And make sure we use a pager for completions (this is also the default). +set page-completions on + # Activate Vi editing mode. set editing-mode vi -- 2.44.2 From 68ad4e859eb3c85db2bb6b33555605f9dc74a007 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 26 Dec 2010 21:32:38 +0100 Subject: [PATCH 15/16] inputrc: Display file type when completing (/, @, etc.). --- inputrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inputrc b/inputrc index ab48ee6..daa4dec 100644 --- a/inputrc +++ b/inputrc @@ -10,6 +10,9 @@ set completion-query-items -1 # And make sure we use a pager for completions (this is also the default). set page-completions on +# Add character to files denoting the type when completing file names. +set visible-stats on + # Activate Vi editing mode. set editing-mode vi -- 2.44.2 From b55123f8c0716f99f7bfa1882cc693c795a88c92 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 1 Jan 2011 00:10:09 +0100 Subject: [PATCH 16/16] lesskey: Add ^P/^N for line-edit to replace the arrow keys. --- lesskey | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lesskey b/lesskey index 47cb71e..dceb312 100644 --- a/lesskey +++ b/lesskey @@ -10,6 +10,13 @@ h left-scroll l right-scroll +#line-edit + +# Vim-like up/down to replace the arrow keys. +^P up +^N down + + #env # Set options for less. -- 2.44.2