I've tried & failed to write a commandline program to upload to a codeberg repo via the /contents/ API... I just get a "500" response. And I've failed to find any examples of anyone else doing this. If I could just upload to a public repo without bothering with having a git repo locally that gets me most of what I would want from a gist replacement except possibly embedding. but it just doesn't quite work...
Sweet, I got it working! Now, I can use my codeberg repo "junkdrawer" as a semi-replacement for github gists.
It's not super clear from the API documentation, but for a file that does not exist yet, you have to POST it; for a file that exists, you have to PUT it and include the sha1sum of the file to be replaced.
I've used junk.py to post itself to my junkdrawer: https://codeberg.org/jepler/junkdrawer/src/branch/main/aygdu2e9/junk.py
This script conforms to PEP723 so you can run it with uv run.