Skip to content

Instantly share code, notes, and snippets.

View timfi's full-sized avatar
⌨️

Tim Fischer timfi

⌨️
View GitHub Profile
@timfi
timfi / starwars.json
Last active April 13, 2022 15:48
Starwars Python Workshop
{"people": {"1": {"name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color": "blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "https://swapi.dev/api/planets/1/", "films": ["1", "2", "3", "6"], "species": [], "vehicles": ["14", "30"], "starships": ["12", "22"], "created": "2014-12-09T13:50:51.644000Z", "edited": "2014-12-20T21:17:56.891000Z", "id": "1"}, "2": {"name": "C-3PO", "height": "167", "mass": "75", "hair_color": "n/a", "skin_color": "gold", "eye_color": "yellow", "birth_year": "112BBY", "gender": "n/a", "homeworld": "https://swapi.dev/api/planets/1/", "films": ["1", "2", "3", "4", "5", "6"], "species": ["2"], "vehicles": [], "starships": [], "created": "2014-12-10T15:10:51.357000Z", "edited": "2014-12-20T21:17:50.309000Z", "id": "2"}, "3": {"name": "R2-D2", "height": "96", "mass": "32", "hair_color": "n/a", "skin_color": "white, blue", "eye_color": "red", "birth_year": "33BBY", "gender": "n/a", "homeworld": "https://swapi.dev/api/pla
@timfi
timfi / README.md
Created July 22, 2020 21:11
A more "pythonic" ECS Implemention.

ECS v2 – Electric Boogaloo

I implemented the ECS-"Pattern" in python before, but at that variant is very optionated when it comes to all things systems, i.e. the "S" in "ECS". This time around I kept it simple and punted all the "filtering" out the user of the module. In turn this version is terser, for better or for worse.

Another sidenote, that I find important enough to actually mention, is that this implementation is actually more or less a cross between my prior version and esper. The later of which influenced the whole lru caching this time around...

@timfi
timfi / CellularAutomata.md
Last active February 23, 2020 19:24
Cellular Automata

Cellular Automata

Whilst being very bored recently I started playing around with simulating cellular automata once again. But to challenge myself a bit more than usual I set three specific limitations that made this a bit harder than I was used to:

  1. The simulation functions should be able to handle n-dimensional rules and states.
  2. The rules should be given as integers.
  3. The state should be represented as an integer, making use of the fact that the whole state consists of a n-dimensional array of booleans that can be flattened.
@timfi
timfi / elementary.py
Created February 20, 2020 22:17
Elementary Cellular Automata
"""elementary.py
Summary
-------
This module implements 1D cellular automata, i.e. elementary cellular automata [1],
using rules formatted in Wolfram code [2].
Parameters
----------
rule : int, positive