Skip to content

Instantly share code, notes, and snippets.

@EllieTheYeen
Created February 4, 2024 22:50
Show Gist options
  • Save EllieTheYeen/f3f15a14dc3bbf1ba70d5b7ba3ad5f0e to your computer and use it in GitHub Desktop.
Save EllieTheYeen/f3f15a14dc3bbf1ba70d5b7ba3ad5f0e to your computer and use it in GitHub Desktop.
Just a thing to sort profile pictures for the plot thread to track where it last was
import os
os.chdir(os.path.split(__file__)[0] or ".")
files = os.listdir("pfps")
fates = []
for a in files:
r = os.stat(os.path.join("pfps", a))
fates.append((a, r.st_mtime))
fates.sort(key=lambda x: x[1])
print(fates)
with open("pfplog.txt", "w") as f:
f.write("\n".join(f[0].rsplit(".", 1)[0] for f in fates))
f.write("\n")
bsky = []
twit = []
mast = []
for name, time in fates:
name: str = name.rsplit(".", 1)[0]
if name.startswith("@"):
mast.append(name)
elif name.count(".") > 0:
bsky.append(name)
else:
twit.append(name)
with open("pfplog_nast.txt", "w") as f:
f.write("\n".join(mast))
f.write("\n")
with open("pfplog_bsky.txt", "w") as f:
f.write("\n".join(bsky))
f.write("\n")
with open("pfplog_twit.txt", "w") as f:
f.write("\n".join(twit))
f.write("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment