Skip to content

Instantly share code, notes, and snippets.

@traverseda
Created December 10, 2017 01:19
Show Gist options
  • Save traverseda/7ad0332bdb2107a7789fc79b7ef634a2 to your computer and use it in GitHub Desktop.
Save traverseda/7ad0332bdb2107a7789fc79b7ef634a2 to your computer and use it in GitHub Desktop.
"""
A system for storing your junk. Print a label, stick it on a box.
Write down what's in that box.
Boxes have a url, constisting of inventory://{Namespace}:{glyphString}.
For example, 'inventory://traverseda:red-ox-yellow-sheep' for the 200th-ish box
that I tag.
Things that go in the box should be refered to by an NFC tag, a uuid, or just write
it down. Seriously, just write it down. Don't refer to things that go in the box
using a glyphString.
"""
colors = {
"red": None,
"orange": None,
"yellow": None,
"green": None,
"cyan": None,
"blue": None,
"indigo": None,
"violet": None,
"purple": None,
"magenta": None,
"pink": None,
"brown": None,
"gray": None,
"black": None,
}
symbols = (
"rat", #https://commons.wikimedia.org/wiki/Category:Valid_SVG_created_with_Inkscape:Zodiac_icons
"ox",
"tiger",
"rabbit",
"dragon",
"snake",
"horse",
"sheep",
"monkey",
"rooster",
"dog",
"pig",
)
tokens = []
for color in colors.keys():
for symbol in symbols:
tokens.append((color,symbol))
tokenLen = len(tokens)
def toGlyph(dec):
x = (dec % tokenLen)
digits = tokens
rest = dec // tokenLen
if (rest == 0):
return digits[x]
return toGlyph(rest) + digits[x]
def fromGlyph(glyphString):
glyph = glyphString.split("-")
for i in range(0,200):
print("inventory://traverseda:"+"-".join(toGlyph(i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment