Skip to content

Instantly share code, notes, and snippets.

@fogonthedowns
Last active August 9, 2025 15:59
Show Gist options
  • Select an option

  • Save fogonthedowns/ed3efd0869cc29a02da00f2e9fb07f5c to your computer and use it in GitHub Desktop.

Select an option

Save fogonthedowns/ed3efd0869cc29a02da00f2e9fb07f5c to your computer and use it in GitHub Desktop.
function chat() {
dig @ch.at "$@" TXT +short | python3 -c '
import sys
def decode_line(line):
line = line.strip("\"")
result = []
i = 0
while i < len(line):
if i <= len(line) - 4 and line[i] == "\\" and line[i+1:i+4].isdigit():
result.append(int(line[i+1:i+4])) # Treat \nnn as decimal
i += 4
else:
result.append(ord(line[i]))
i += 1
try:
return bytes(result).decode("utf-8", errors="replace")
except:
return line
text = sys.stdin.read()
lines = [decode_line(line) for line in text.strip().split("\n")]
print(" ".join(lines).replace("\\\"", "\""))
'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment