Skip to content

Instantly share code, notes, and snippets.

@kosugi
Created August 10, 2013 02:57
Show Gist options
  • Select an option

  • Save kosugi/6198824 to your computer and use it in GitHub Desktop.

Select an option

Save kosugi/6198824 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
#
# makes a unicode character from keyword as 4-hexadecimal codepoint
# and put it into clipboard.
#
# query MUST be escaped double quotation marks and backslashes.
#
from subprocess import Popen, PIPE
try:
code = int(u"""{query}""", 16)
s = unichr(code)
except Exception, e:
s = str(e)
p = Popen('/usr/bin/pbcopy', stdin=PIPE)
p.communicate(s.encode('UTF-8'))
p.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment