Skip to content

Instantly share code, notes, and snippets.

View nfitzen's full-sized avatar

Nathaniel Fitzenrider nfitzen

  • United States
View GitHub Profile
@nfitzen
nfitzen / lastlife_rules.md
Last active October 28, 2021 04:41
The rules of Last Life (S2) transcribed for later use.

Last Life

A game played by a bunch of MCYTs. I wanted to draft up a written specification for the game so that I can implement it myself.

See, for example, Grian. (His videos should have links to all the other members.

@nfitzen
nfitzen / cpddate.sh
Last active October 21, 2021 01:18
A Bash function that transforms a date string into Discord's Unix time format, and copies it. Requires xclip.
#!/usr/bin/env bash
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2021 nfitzen <https://github.com/nfitzen>
# A Bash function that transforms a date string into Discord's Unix time format, and copies it.
# Requires xclip. Place in ~/.bash_aliases or any other Bash source.
function cpddate () {
if [ $# -eq 0 ]; then
>&2 echo "Not enough arguments provided."
@nfitzen
nfitzen / SEEDRAND
Last active September 30, 2021 10:16
A simple means to seed a TI-84 randomizer based on the date and time. Written in SourceCoder3 format: <https://www.cemetech.net/sc/>.
"SPDX-License-Identifier: CC0-1.0
"SPDX-FileCopyrightText: 2021 Nathaniel Fitzenrider <HTTPS://GITHUB.COM/NFITZEN>
Input "UTC Offset:",O
O:prgmTIUTIME:Ans->T
Input "Arbitrary const:",K
If K>=|-1 and K<=1:Then
T->R
Else
1|E10*fPart(TK/1|E10->R
@nfitzen
nfitzen / get_metadata.py
Last active November 1, 2021 04:01
Gets anime metadata from AniList for basic offline viewing.
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# MIT License
#
# Copyright (C) 2021 nfitzen <https://github.com/nfitzen>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
@nfitzen
nfitzen / s2d
Last active November 19, 2021 03:28
Converts a snowflake ID into a timestamp
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# MIT License
#
# Copyright (C) 2015-2021 Rapptz and the discord.py contributors
# Copyright (C) 2021 nfitzen <https://github.com/nfitzen>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
@nfitzen
nfitzen / frozen.py
Last active December 22, 2021 23:40
A Python decorator that makes a class immutable after initialization.
# SPDX-License-Identifier: MIT
# SPDX-FileNotice: The Expat/MIT variant is the one without the "next paragraph" parenthetical but with the "MIT License" header.
# Copyright (C) 2021 nfitzen <https://github.com/nfitzen>
# Note that this code is very basic and likely buggy, as with everything I
# write. Specifically, the help message is a bit weird and slightly inaccurate.
import functools
from typing import Any
@nfitzen
nfitzen / disable_history.py
Last active June 22, 2022 21:47
Disables saving Python interpreter history to a file. Put in your pythonrc and set your PYTHONSTARTUP env variable to point to it.
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2022 nfitzen <https://github.com/nfitzen>
# god, this is such a hack
# why, python
# likely works in CPython 3.7 and up... for now
# fix bpo-20886 pls
def __PYTHONSTARTUP_historyremove():