Last active
December 21, 2015 13:28
-
-
Save pandemicsyn/6312518 to your computer and use it in GitHub Desktop.
Reverse all the prompts!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in a file called ~/.reverseit.py: | |
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
from sys import stdin, stdout | |
pchars = u"abcdefghijklmnopqrstuvwxyz,.?!'()[]{}" | |
fchars = u"ɐqɔpǝɟƃɥıɾʞlɯuodbɹsʇnʌʍxʎz'˙¿¡,)(][}{" | |
flipper = dict(zip(pchars, fchars)) | |
def flip(s): | |
charList = [ flipper.get(x, x) for x in s.lower() ] | |
charList.reverse() | |
return "".join(charList).strip('\n') | |
stdout.write(flip(stdin.read()).encode('utf8')) | |
in le bashrc: | |
function exitstatus { | |
EXITSTATUS="$?" | |
BOLD="\[\033[1m\]" | |
GREEN="\[\033[1;32m\]" | |
RED="\[\033[1;31m\]" | |
OFF="\[\033[m\]" | |
if [ "$EXITSTATUS" -eq "0" ] | |
then | |
PS1="${GREEN}\u@\h:\w${OFF}$(__git_ps1)$(check_virt_env)\$ " | |
echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}";echo -ne "\007" | |
else | |
TMP="${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}" | |
RPS1=`echo $TMP | python ~/.reverseit.py` | |
PS1="(╯°□°)╯ ${RED}$RPS1${OFF}$(__git_ps1)\$ " | |
fi | |
PS2="${BOLD}>${OFF} " | |
} | |
PROMPT_COMMAND=exitstatus |
heh typo, should read: PS1="(╯°□°)╯ ${RED}$RPS1${OFF}$(__git_ps1)$ "
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result: