Created
March 17, 2014 19:42
-
-
Save tylerball/9606764 to your computer and use it in GitHub Desktop.
upside down text textexpander snippet, use like: (╯°□°)╯︵ %snippet:;updn%
This file contains 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
#!/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