Skip to content

Instantly share code, notes, and snippets.

View JonathonReinhart's full-sized avatar

Jonathon Reinhart JonathonReinhart

View GitHub Profile
@JonathonReinhart
JonathonReinhart / ANSI.md
Last active September 17, 2020 19:14 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1b
  • Decimal: 27
#!/usr/bin/env python
import BaseHTTPServer, SimpleHTTPServer
import ssl
import sys
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('--certfile')
ap.add_argument('--keyfile')
ap.add_argument('--port', type=int, default=443)
@JonathonReinhart
JonathonReinhart / hexdump.py
Last active July 23, 2022 00:12 — forked from 7h3rAm/hexdump.py
hexdump implementation in Python
import string
def hexdump(src, length=16, sep='.'):
DISPLAY = string.digits + string.letters + string.punctuation
FILTER = ''.join(((x if x in DISPLAY else '.') for x in map(chr, range(256))))
lines = []
for c in xrange(0, len(src), length):
chars = src[c:c+length]
hex = ' '.join(["%02x" % ord(x) for x in chars])
if len(hex) > 24: