Skip to content

Instantly share code, notes, and snippets.

@vakenbolt
Created January 31, 2018 02:05
Show Gist options
  • Save vakenbolt/a32f8f461f4f395c3534b5326cad0776 to your computer and use it in GitHub Desktop.
Save vakenbolt/a32f8f461f4f395c3534b5326cad0776 to your computer and use it in GitHub Desktop.
decode - command line string decoder
#! /usr/bin/python
# -*- coding: utf-8 -*-
import sys
from os import isatty
if isatty(sys.stdin.fileno()):
sys.stdout.write("""decode - command line string decoder [version 1.0]
Usage: [stdin...] | decode
To decode a string that has been copied to the clipboard.
pbpaste | decode
To decode content from a file
cat <file_name> | decode
Made with ♥ in Chicago @TheRocketWagon
""")
quit()
else:
for line in sys.stdin:
sys.stdout.write(line.decode('string_escape'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment