Skip to content

Instantly share code, notes, and snippets.

@koepnick
koepnick / README.md
Last active August 20, 2024 16:10
Commonly Used Poetry Configurations (in pyproject.toml)

This is simply a dump of the various pyproject.toml entries that I commonly use.

Libraries Referenced

Static Checking: MyPy

Code Complexity: Wily

@koepnick
koepnick / README.md
Last active August 7, 2024 16:30
Examples of Python Testing

These can be used as pre-commit tests or as part of a broader testing strategy.

While I consider these examples to be sane, there are a plethora of additional options available. I'm still using the pytest library. But this should still work when using the unittest module now part of the standard library.

I've also kept these reasonably quiet and only checking for the most egregious problems.

The assumption is that we're using Poetry as a builder.

Additionally, the output from these tests will be saved as a JUnit XML file for future parsing.

@koepnick
koepnick / README.md
Last active July 18, 2024 22:07
Simple monitoring script using inotify

I wanted to be able to call a simple script from the console or Neovim that would supply an executable and an arbitrary number of files.

Using inotify, each file is monitored for changes; calling the executable when one is detected. The executable is implicitly watched.

This is a very quick and dirty solution. It uses eval and doesn't perform any sanity checking. Nor does it check to see if watches are already in place. Use at your own risk.

In my own setup, I have a '~/.local/scripts/' directory which is on my $PATH. I have the script here named 'monitor'

Usage: $> monitor ./something_neat.py ./some_config.yaml ./pyproject.toml /var/tmp/something.png

pprintex Pretty print but for objects
objexplore What is says on the tin
tracers Trace when class attributes change
pdb++ (pdbpp) Yet another pdb replacement
bracelogger Brace style string formatting in logs
version: '3.7'
services:
sonarr:
container_name: sonarr
image: linuxserver/sonarr:3.0.6.1265-ls121
restart: "no"
ports:
- "8989:8989"
environment:
- TZ=America/Denver
tab-item.active {
height: 39px !important;
background-color: #444444;
}
tab-item.active .label-content {
font-weight: bold;
font-size: 14px;
}
tab-item.active tab-twisty,
tab-item.active .label-content,
@koepnick
koepnick / bitmasking
Last active January 31, 2021 01:23
attiny85_interrupt_bitmasking_example.cpp
// Hopefully this will make some amount of sense.
// PCIE in the ATTiny85 headers simply expands to 5, but pretend for a moment
// that it is an unknown constant
GIMSK |= (PCIE << 6); /* <-- Use this! It's confusing as hell, especially given that the OR operator
acts more like addition in that:
00100010 | [34]
10000010 [130]
________
@koepnick
koepnick / demo.py
Last active January 15, 2021 22:26
Connecting to a remote S3 endpoint
"""
This is useful for applications such as Google's Colab which
have simple methods of connecting to each user's invdivdiual
cloud storage, but the speed and latency are terrible.
With this, you can use a much snappier service such as Wasabi
to host large files for machine learning consumption
Regular users: `pip install --user s3fs`
Virtualenv users: `pip install s3fs`
@koepnick
koepnick / demo.ipynb
Created January 1, 2021 21:44
Connecting Colab to an external storage provider
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@koepnick
koepnick / some.advancedsite.com.conf
Created April 29, 2020 06:38
NGINX Boilerplate - Django/JS Frontend
# A fully working dev example
# This assumes that:
# A (in my case Vue) JS dev server is listening on port :8080 and is in charge of all look and feel loveliness
# it also assumes that a Django dev server is running on port :8000 and has the sole purpose of being an API server
# The websockets stanza can be omitted if it isn't applicable
# Any documents in /static will be served...well statically
# `manage.py collectstatic` *should* copy the Django static files here so long as: