/python

Python assorted code: small experiments, scripts and snippets

Primary LanguagePythonThe UnlicenseUnlicense

Python Assorted code

Miscellaneous Python code snippets and experiments.

Running

make shell

And then from inside the Python 3.7 container install and run whatever you want.

Note: Only basic python 3.7, pytest and flake8 are installed.

Miscellaneous

  • \bluesky-purge: Script to delete your BlueSky posts older than X days (5 with sample config). Best setup as a cron job to run hourly or daily.

  • \double-linked-list: A Python implementation of a double linked list, with sorting, reversing, item flipping and inserting at specific position (by data).

  • \imports: A tiny reminder of how Python imports work in their common variants: import from file in same folder, from sub-folder, and from sibling folder.

  • \list_search.py: Old search prototype for a command-line provided string in all txt files of folder where script is launched. Sample text files format:

0   /media/kartones/pre1/test 1/blablabla
123 /media/kartones/pre1/test 1/blablabla2
0   /media/kartones/pre1/test 1
0   /media/kartones/pre1/test 2/blablabla
0   /media/kartones/pre1/test.1/blablabla
  • \markov-model: An implementation of a simple Markov model (a Markov Chain) for generating variants of sentences based on a text.
  • \mastodon-purge: Script to delete your Mastodon toots older than X days (5 with sample config). Best setup as a cron job to run hourly or daily.
  • \pelican\plugins: Some plugins I've built for the Pelican static site generator tool.
  • \pelican\blogengine_to_pelican.py: Tool to migrate from BlogEngine.Net to Pelican (posts and pages).
  • \pelican\publisher: Tool to allow post-processing of Pelican builds and optionally upload a post via FTP.
  • \shopping-cart-with-discounts: Tiny implementation of a shopping cart with an extensible discounts system.
  • \trello-backup: (No longer works) Script to export your Trello boards as json files, plus all attachments. One folder per board with data inside.
  • \twitter-purge: Script to delete your Twitter tweets older than X days (5 with sample config). Best setup as a cron job to run hourly or daily.
  • \weather-email: (No longer works) Small script that fetches Madrid's current weather info and sends it via email. Perfect to be setup as a cron job at 7AM to remind me daily of the weather before I head out for work.
  • \youtube-summarizer: Run with an argument specifying either a Youtube URL or a Youtube video id, and it will fetch the video transcript and generate a short summary (via ChatGPT).

Games & Gaming Related

Barnsley Fern fractal

  • \game-of-life-kata: A coding kata. Inside-out TDD approach + PyGame "visualizer":

sample game of life run

  • \fire-effect.py: Python/Pygame implementation of Doom PSX fire effect:

Doom PSX fire effect in pygame

  • \flappy-kirby: Pygame Zero Flappy Bird game clone (with some classic graphics):

Flappy Kirby screenshot

  • \imdb-random-name: Obtain a random movie name, using IMDB datasets. Includes a fetch script that retrieves and prepares the latest data.

  • \pic-to-png: Exporter from Oper Soft's old MS-DOS games .PIC files to .PNG images. More info at this blogpost & part 2:

Mutan Zone main screen Abadia del Crimen main screen Corsarios main screen (EGA) side-out TDD approach, building only the minimal needed functionality.

  • \transarctica-battles: A prototype of re-imagining of the battles section of the MS-DOS and AMIGA game Transarctica. Also an experiment with Pygame to learn about screen resizing. Totally WIP.

Transarctica Battles screenshot