Skip to content

Instantly share code, notes, and snippets.

View blakeNaccarato's full-sized avatar

Blake Naccarato blakeNaccarato

View GitHub Profile
@blakeNaccarato
blakeNaccarato / fittings.md
Last active January 13, 2024 01:14
Pipe fittings for inspecting pandas pipelines.

fittings.py

Pipe fittings for inspecting pandas pipelines.

@blakeNaccarato
blakeNaccarato / camera.md
Last active January 12, 2024 05:01
Details on how to use the Phantom v4.3 high-speed camera.

Phantom v4.3 High-speed Camera

Details on how to use the Phantom v4.3 high-speed camera.

Specifications

The Phantom v4.3 (specs) features 2100 fps at the full resolution of 800x600. Features a global shutter, auto exposure control, 2GB storage. Our camera has the standard 1" C-mount, so adapters will be needed for other lenses. Phantom is expensive, with used cameras going for $30k. Lower-priced competitors such as Chronos and Edgertronic are more competitively-priced at under ~$15k, while Photron come in the middle somewhere.

Lens considerations

@blakeNaccarato
blakeNaccarato / invoke.md
Last active January 13, 2024 01:14
Invoke Python from PowerShell including pipeline variable input from stdin

Invoke Python from PowerShell

Invoke Python from PowerShell including pipeline variable input from stdin.

A slightly different approach/workaround looks like this. You can pass an array of strings, or, say an array of filenames into the Python script if you dot-source common.ps1 below and hello.py is on your PYTHONPATH or is a module. You could make the -Module parameter more flexible, and expand the example further, but that's the gist of it.

Of course there's no real parallelism here, the Python interpreter fires up and runs with every input piped to it, there's no benefit of setup/teardown e.g. begin{} and end{} clauses in PowerShell's pipeline orchestration mechanisms.

The upside is you don't need to do anything special to your Python module, since all logic is handled on the shell side. The downside is with multiple arguments you're gonna be constructing arrays of arguments on the shell side in order to pipe in. Not sure exactly how that would look, you could probably do some [splatting

@blakeNaccarato
blakeNaccarato / $raw.md
Last active January 12, 2024 05:57
Modification of pycine `raw.py` to be able to read older files. Monkey-patching BlackLevel and WhiteLevel

raw.py

Modification of pycine raw.py to be able to read older files. Monkey-patching BlackLevel and WhiteLevel

@blakeNaccarato
blakeNaccarato / publishing.md
Created April 11, 2023 17:03
Publishing with flit and keyring

Copy/paste may not work as expected in the VSCode integrated terminal when running flit publish and pasting a password/token. You should create a one-time token on PyPi, with entire account scope, then in an external terminal window, run flit publish. There you can paste your token, you may have to do "Ctrl+Shift+V", or "Win+V" and click the token in your clipboard. If this step fails, you have to go to "Credential Manager" and delete the http://upload.pypi.org/legacy credential and try again. When done, be sure to delete the local credential, AND remove the credential from PyPi. You don't need to keep an account-scope credential around forever, just make one when needed and revoke it right after.

@blakeNaccarato
blakeNaccarato / ai-leads.md
Last active January 13, 2024 01:13
Free resources for learning AI

Leads

From Reddit comment by u/mpt977262 regarding the "bogus" course InspiritAI, and better resources for learning artificial intelligence and machine learning (AI/ML) below:

Amazing, free, high-quality ML education is easy to find online; there's in fact too much out there and it's hard to know which ones to stick by. The ones that I have used and can personally attest to are the following:

@blakeNaccarato
blakeNaccarato / $Windows dev machine setup.md
Last active January 12, 2024 20:40
Windows dev machine setup

Windows dev machine setup

It is recommended that you install "Windows Terminal" from the Windows Store to get a more sensible terminal experience. Be sure to visit the "For developers" menu in your Windows machine settings and toggle some important flags:

  • Change settings to show file extensions
  • Change settings to show hidden and system files
  • Change settings to show full path in title bar
  • Choose the default terminal app (I suggest "Windows Terminal")
  • Change execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts.
@blakeNaccarato
blakeNaccarato / $ Change the sheets 'Regularly' with SQLModel and XLWings.md
Last active January 20, 2024 23:40
Two-way interactions between an Excel spreadsheet and a SQLite database exported from the Regularly Android app, enabling synchronization and updating of chores in the app.

Change the sheets 'Regularly' with SQLModel and XLWings

This Gist features two-way interactions between an Excel spreadsheet and a SQLite database exported from the Regularly Android app (APK available from other sources), enabling synchronization and updating of chores in the app. This writeup goes in a few different directions, so feel free to poke around:

  • The usage guide is brief, but links to more details for all skill levels.
  • Jump into changing the sheets for a tour of the kind of end-user code that carefully-prepared SQLModel models facilitate.
  • See behind the scenes in the database model deep dive, powered by SQLModel, with special handling of quirks and gotchas.
  • See the Excel and CSV data models for data model philosophy, and a few cool features:
    • A `Datac
@blakeNaccarato
blakeNaccarato / Initialize-WindowsDev.ps1
Last active January 13, 2024 01:12
One-time setup for Python development on Windows. Installs Python, VSCode, Windows Terminal, PowerShell, and Git.
<#
.SYNOPSIS
One-time setup for Python dev tools on Windows. Installs Python, VSCode, Windows Terminal, PowerShell, and Git.
.DESCRIPTION
Usage:
- Ensure `winget` (Microsoft App Insstaller) is installed from the Windows store or at
https://apps.microsoft.com/store/detail/app-installer/9NBLGGH4NNS1