Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pandemicsyn
Last active December 21, 2015 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandemicsyn/6312518 to your computer and use it in GitHub Desktop.
Save pandemicsyn/6312518 to your computer and use it in GitHub Desktop.
Reverse all the prompts!
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
@pandemicsyn
Copy link
Author

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