diff options
author | EuAndreh <eu@euandre.org> | 2018-12-22 18:19:29 -0200 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2018-12-22 18:19:29 -0200 |
commit | d4e6648afd61205136c98fdc56cf151eb437a078 (patch) | |
tree | 4503e78d64133edeb8679c57d58ac96d6fef7e9e /bin | |
parent | mrconfig.ini. (diff) | |
download | dotfiles-d4e6648afd61205136c98fdc56cf151eb437a078.tar.gz dotfiles-d4e6648afd61205136c98fdc56cf151eb437a078.tar.xz |
Move external scripts to bin/.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/git-blame-someone-else | 21 | ||||
-rwxr-xr-x | bin/sl | 13 | ||||
-rwxr-xr-x | bin/sleepsort | 20 |
3 files changed, 54 insertions, 0 deletions
diff --git a/bin/git-blame-someone-else b/bin/git-blame-someone-else new file mode 100755 index 0000000..dd71826 --- /dev/null +++ b/bin/git-blame-someone-else @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Taken from https://github.com/jayphelps/git-blame-someone-else/ + +if [ $# -ne 2 ]; then + >&2 echo "Usage: $0 <author> <commit>" + exit 1 +fi + +AUTHOR=$1 +AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*?)\s*<.*>$/ and print $1') +AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1') +COMMIT=$(git rev-parse --short $2) + +{ + GIT_SEQUENCE_EDITOR="sed -i -e 's/^pick $COMMIT/edit $COMMIT/'" git rebase -i $COMMIT~1^^ + GIT_COMMITTER_NAME="$AUTHOR_NAME" GIT_COMMITTER_EMAIL="$AUTHOR_EMAIL" git commit --amend --no-edit --author="$AUTHOR" + # git rebase --continue +} &> /dev/null + +echo "$AUTHOR_NAME is now the author of $COMMIT. You're officially an asshole."; @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Taken from: +# https://gir.st/blog/sl-alt.htm + +# sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3 + +LEN=$(ls "$@" |wc -L) # get the length of the longest line + +ls "$@" | rev | while read -r line +do + printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/' +done
\ No newline at end of file diff --git a/bin/sleepsort b/bin/sleepsort new file mode 100755 index 0000000..ea20fcb --- /dev/null +++ b/bin/sleepsort @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Taken from: +# https://www.quora.com/What-is-the-strangest-sorting-algorithm/answer/Nipun-Ramakrishnan + +function f() { + sleep "$1" + echo "$1" +} + +while [ -n "$1" ] +do + f "$1" & + shift +done + +wait + +# example usage: +# sleepsort 5 3 6 3 6 3 1 4 7 |