Skip to content

Instantly share code, notes, and snippets.

@tylerball
Created March 17, 2014 19:42
Show Gist options
  • Save tylerball/9606764 to your computer and use it in GitHub Desktop.
Save tylerball/9606764 to your computer and use it in GitHub Desktop.
upside down text textexpander snippet, use like: (╯°□°)╯︵ %snippet:;updn%
#!/usr/bin/python
# vim: set fileencoding=utf-8
# inspired by:
# https://github.com/JKodner/upsdwn/blob/master/upsdwn.py
import sys
import subprocess
clip = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
my_dict = {
"a" : "ɐ", "b" : "q", "c" : "ɔ", "d" : "p", "e" :
"ǝ", "f" : "ɟ", "g" : "ƃ", "h" : "ɥ", "i" : "ı", "j"
: "ɾ", "k" : "ʞ", "l" : "l", "m" : "ɯ", "n" : "u",
"o" : "o", "p" : "d", "q": "b", "r" : "ɹ", "s" : "s", "t" :
"ʇ", "u" : "n", "v" : "ʌ", "w" : "ʍ", "x" : "x", "y"
: "ʎ", "z" : "z"
}
def reverse(v):
x = ""
for i in v[::-1]:
if i.isalpha():
i = i.lower()
try:
i = my_dict[i]
except KeyError:
pass
x = x + i
else:
x = x + i
return x
t = reverse(clip.stdout.read())
sys.stdout.write(t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment