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 / 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.
View disable_history.py
# 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():
@nfitzen
nfitzen / frozen.py
Last active December 22, 2021 23:40
A Python decorator that makes a class immutable after initialization.
View frozen.py
# 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 / s2d
Last active November 19, 2021 03:28
Converts a snowflake ID into a timestamp
View s2d
#!/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 / get_metadata.py
Last active November 1, 2021 04:01
Gets anime metadata from AniList for basic offline viewing.
View get_metadata.py
#!/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 / 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/>.
View SEEDRAND
"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 / 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.
View cpddate.sh
#!/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 / lastlife_rules.md
Last active October 28, 2021 04:41
The rules of Last Life (S2) transcribed for later use.
View lastlife_rules.md

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 / dl_css.bat
Last active June 23, 2023 11:59
Downloads Counter-Strike: Source assets for Garry's Mod from Steam's official servers, for free (gratis). Just place in an empty directory and double click.
View dl_css.bat
:: SPDX-License-Identifier: MIT
:: MIT License
::
:: Copyright (C) 2021-2022 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, distribute, sublicense, and/or sell
:: copies of the Software, and to permit persons to whom the Software is
@nfitzen
nfitzen / anilist.css
Last active October 22, 2021 13:32
Simple AniList CSS for Markdown formatting.
View anilist.css
/* SPDX-License-Identifier: CC0-1.0 */
/* SPDX-FileCopyrightText: 2021 nfitzen <https://anilist.co/nfitzen> */
/* I have zero clue how to select every (4n+k)th element. */
.markdown ol {
list-style-type: decimal;
}
.markdown ol ol {
@nfitzen
nfitzen / hibp-pwd-lookup.py
Last active January 21, 2022 16:59
Looks up passwords on Have I Been Pwned.
View hibp-pwd-lookup.py
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# MIT License
#
# Copyright (C) 2021 Nathaniel Fitzenrider <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,