Skip to content

Instantly share code, notes, and snippets.

@CaptainZidgel
Created August 12, 2020 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaptainZidgel/d3f7cb099702490d90c44d33f8c24bc2 to your computer and use it in GitHub Desktop.
Save CaptainZidgel/d3f7cb099702490d90c44d33f8c24bc2 to your computer and use it in GitHub Desktop.
Quick and simple collecter of aliases used in logs. Non interactive, requires you to copy/paste values to wherever you're trying to assosciate IDs with permanent Aliases.
import json
import os
from collections import Counter
import sys
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd)
IDs = {}
for file in os.listdir(".logs"):
with open(os.path.join('.logs', file), "r") as f:
l = json.load(f)
for id, name in l['names'].items():
if not id in IDs:
IDs[id] = []
IDs[id].append(name.lower().translate(non_bmp_map))
for ID, names in IDs.items():
print("::::{}::::".format(ID))
print(Counter(names))
print('\n\n\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment