For those times when you want to avoid using the mouse to improve your desktop layout. | Continue reading
Breaking the rules to satisfy continuous integration. | Continue reading
My key note and the first return to the homeland of Lithuania in over 100 years. | Continue reading
When you want to link to content on a web page but it doesn't have CSS selectors, append this to the URL: #:~:text=TEXT_TO_FIND Here's some reference examples: https://daniel.feldroy.com/posts/2023-02-programming-languages-ive-learned#:~:text=python https://daniel.feldroy.com/pos … | Continue reading
To my surprise writing decorators for classes is easier than for functions. Here's how to do it in annotated fashion with an unnecessary decorator that doesn't accept any additional arguments. # Write a callable that accepts a cls as an argument def tools(cls): # Write function … | Continue reading
Another year in orbit around a star. Recap for 2023 We moved to London Truly enjoyed being the husband of Audrey Roy Greenfeld Embraced the delights being the father to Uma Roy Greenfeld in her fourth year in the universe I trained more in Brazilian Jiu-Jitsu (BJJ) I tried HEMA a … | Continue reading
Typically I try to avoid changing older commits in a pull request. My reasoning has a tiny bit to do with preserving history and lots to do with being resistant to trying new things. Finally I got around to looking this up today, it is easy to do. WARNING: Do this on branches of … | Continue reading
Necessary because installing things into your base python causes false positives, true negatives, and other head bangers. Set this environment variable, preferably in your rc file: # ~/.zshrc export PIP_REQUIRE_VIRTUALENV=true Now if I try to use pip outside a virtualenv: dj-note … | Continue reading
A summary of the past year as I finish my third year working for Kraken Tech, an Octopus Energy Group subsidiary. Note: As I write this I'm recovering from a sprained shoulder I received in a bicycle accident that makes it hard to type. I'm mostly using voice-to-text, so the text … | Continue reading
Minimal CSS frameworks do not use classes, rather modifying the look of HTML components. That means that any CSS classes added are easier to discover and read. I'm someone who struggles with CSS and the custom CSS of this site combined with complex non-obvious HTML (example being … | Continue reading
Something I periodically do and need to document here where I can find it fast. To reset the most recent commit: git reset HEAD~ This reverts the commit. Then you can commit individual or groups of files in multiple commits What if your commit isn't the most recent one? Use an in … | Continue reading
Using Watchdog to monitor changes to a directory so we can alter what we serve out as HTTP. Each segment is the evolution towards getting it to work. Serving HTTP from a directory I've done this for ages: python -m http.server 8000 -d /path/to/files Using http.server in a functio … | Continue reading
I got tired of manually correcting and prettifying YAML only to run into periodic instances where my cleanup broke configurations. Alas, yamllint only tells you what's wrong. I would rather have an easy-to-use CLI tool that does all the work for me. Thanks to David Winterbottom f … | Continue reading
For saving WIP commits to a remote repo. Just add --no-verify to whatever you are doing: git commit -am "Fun code noodling" --no-verify git commit --amend | Continue reading
I wish I knew this earlier, but I know it now thanks to Cody Antunez. Here it is: import sys def test_myoutput(capsys): # or use "capfd" for fd-level # Write some text print("hello") sys.stderr.write("world\n") # Capture the text captured = capsys.readouterr() # Test … | Continue reading
We're going to be here for a while, so I thought I'd let everyone know. Where are you living? In central London, not far from Oxford Circus. We had looked at living more on the periphery, but the cost of rent was the same or barely cheaper - not enough to cover the cost of commut … | Continue reading
For building CLI, there's so much that rich provides that I can't imagine not using it. Here's adding a moving bar that updates: from time import sleep from rich.console import Console console = Console() with console.status( "[bold red]Starting...[/bold red]", spinner="bouncin … | Continue reading
Glob is a really handy tool for finding filepaths. It resembles regular expressions but the syntax is different. Finding matches is easy: # finds python files in the current working directory *.py # finds all the nested python files. **/*.py What I didn't know until today is how … | Continue reading
Poetry has its own location for urls in the [tool.poetry.urls] table. Per the Poetry documentation on urls: "In addition to the basic urls (homepage, repository and documentation), you can specify any custom url in the urls section." [tool.poetry.urls] changelog = "https://github … | Continue reading
To inject a breakpoint into a failing pytest run, add --pdb to your pytest command: py.test --pdb This will drop you into a pdb session at the point of failure. You can then inspect the state of the program just like you would if you injected a breakpoint(). | Continue reading
See these links in the image below? I want every PyPI project to have them in the left column. The challenge is the PyPI project URLs spec is defined only in code. Here's my cheatsheet explaining how to configure them. I'll update this as I learn more (suggestions welcome!). Exam … | Continue reading
This weekend we took 4.5-year-old Uma to Paultons Park amusement park near Southhamption, UK. It was her first real amusement park experience, and she had a grand time. The many positives: The park is really well maintained. Everything felt clean and proper, at the Disneyland lev … | Continue reading
I started Brazilian Jiu-Jitsu in early November 2022. Against most other white belts I usually can't be submitted and have landed a few submissions of my own. I'm not big or strong. I use these rules tip by my coaches and fellow players of the sport. Tap early and tap often. Bett … | Continue reading
Bleach is deprecated, here's how to come close to replicating bleach.clean() using the nh3 version of .clean(). import nh3 def clean_string(string): # The arguments below being passed to `nh3.clean()` are # the default values of the `bleach.clean()` function. return nh3.cle … | Continue reading
Losing my fitness As the pandemic went on I struggled with fitness and weight gain issues. I had injured both knees right before we went into quarantine. I'm also much more consistent working out in groups or with a partner than by myself. So I lost muscle mass as I gained weight … | Continue reading
David Muller, the author of Intuitive Python pointed me at this handy snippet of code. Thanks Richard Boyd! import boto3 from botocore.auth import SigV4Auth from botocore.awsrequest import AWSRequest import requests session = boto3.Session() credentials = session.get_credentials( … | Continue reading
Matt Harrison asked in a tweet what my programming history was, so here's a list of the programming languages I've learned. AppleBasic (ancient history) My first computer was an Apple ][+. I learned AppleBasic from a book that came with the computer. I wrote oodles of text-based … | Continue reading
For those times when you write out a long markdown document that you want to convert to a checklist. A future modification will be to link to the original GitHub or Notion headers so that you can click on the checklist item and jump to the original content. Converting Markdown He … | Continue reading
How to make it so projects with Django as a dependency benefit from Sphinx's auto-documentation features. The Problem I want to be able to document open source packages with Sphinx (ex. xocto) and have Sphinx automatically document the Django helpers. This isn't quite the same as … | Continue reading
Resolutions for 2023 Continue to work on saving the planet Since November of 2020 I've been at Octopus Energy using my skills and talent to address climate change. I plan to continue that effort. You can read my thoughts on why I'm so dedicated to our mission here. Continue my fi … | Continue reading