From 4377a3a49416c524718fe3960aa8224122cacf92 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Tue, 24 Apr 2012 16:30:37 +0200 Subject: [PATCH] bashrc, zshrc: Add functions mkcd and gribble-gpg-everify mkcd: Create the specified directory/-ies and change to the first one. gribble-gpg-everify: Decrypt encrypted Bitcoin OTC from gribble and print everify command --- bashrc | 27 ++++++++++++++++++++++----- zshrc | 25 +++++++++++++++++++++---- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/bashrc b/bashrc index 53c7ed46..6ad9fc61 100644 --- a/bashrc +++ b/bashrc @@ -73,7 +73,7 @@ fi unset color_prompt force_color_prompt # Red colour for root, thanks nyuszika7h :D -# check if we're root +# Check if we're root if [[ $EUID == 0 ]]; then PS1='\033[1;31m\u@\h:\w\$\033[0m ' else @@ -408,10 +408,27 @@ fi } # Given by nyuszika7h. Shortens GitHub URLs with git.io -gitio () { - curl -s -i http://git.io -F "url=$1" | grep - --color=never -P '^Location: ' | awk '{ print $2 }' - } +function gitio() { + curl -s -i http://git.io -F "url=$1" | grep --color=never -P '^Location: ' | awk '{ print $2 }' +} + +function mkcd() { + if [[ $# -gt 1 ]]; then + echo 'Warning: All directories will be created, but will change to first specified directory.' 1>&2 + fi + mkdir -p "$*" + cd "$1" +} + +function gribble-gpg-everify() { + # Set which command to use for gpg. You + # probably want to use gpg2 here. + local gpg=gpg2 + + read -r -i 'Enter Bitcoin OTC URL: ' REPLY + echo -n ';;everify ' + lynx -hiddenlinks=ignore -dump $REPLY | $gpg --decrypt +} ##### Tmux (example) 4G2W9C ##### diff --git a/zshrc b/zshrc index c6e69b2a..11b630dc 100644 --- a/zshrc +++ b/zshrc @@ -353,10 +353,27 @@ fi } # Given by nyuszika7h. Shortens GitHub URLs with git.io -gitio () { - curl -s -i http://git.io -F "url=$1" | grep - --color=never -P '^Location: ' | awk '{ print $2 }' - } +function gitio() { + curl -s -i http://git.io -F "url=$1" | grep --color=never -P '^Location: ' | awk '{ print $2 }' +} + +function mkcd() { + if [[ $# -gt 1 ]]; then + echo 'Warning: All directories will be created, but will change to first specified directory.' 1>&2 + fi + mkdir -p "$*" + cd "$1" +} + +function gribble-gpg-everify() { + # Set which command to use for gpg. You + # probably want to use gpg2 here. + local gpg=gpg2 + + read -r -i 'Enter Bitcoin OTC URL: ' REPLY + echo -n ';;everify ' + lynx -hiddenlinks=ignore -dump $REPLY | $gpg --decrypt +} ##### Tmux (example) 4G2W9C #####