Skip to content

Instantly share code, notes, and snippets.

Daniel Noguchi dnng

Block or report user

Report or block dnng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import argparse
import logging
VERSION = '3.0'
parser = argparse.ArgumentParser(description='Luttify your messages')
parser.add_argument('message', metavar='message', type=str,
help='add a Lutti to be Luttified')
parser.add_argument('-up', '--uppercase', action='store_true',
default=False, dest='uppercase',
help='outputs Lutti\'s message as it should be')
dnng /
Created Oct 13, 2017
Fix file encoding when file has unicode code points written as strings (eg: "a string with u00e1 or \u00d1 code point as string in it")
from re import compile, findall, split
with open('original_file', 'r') as of:
with open('fixed_file', 'w') as ff:
for line in of:
# looks for substrings that are either 'u00fo' or '\u00fo'
pattern = compile(r'\\?u00..')
code_points = findall(pattern, line)
pieces = split(pattern, line)
res = ''
You can’t perform that action at this time.