Skip to content

Instantly share code, notes, and snippets.

View blakeNaccarato's full-sized avatar

Blake Naccarato blakeNaccarato

View GitHub Profile
@blakeNaccarato
blakeNaccarato / Sync-Py.ps1
Last active March 19, 2024 04:28
Cross-platform PowerShell script (tested on Windows, Ubuntu, MacOS) to sync a Python environment with `uv`, example for `requirements.txt`, `pyproject.toml` is similar.
<#.SYNOPSIS
Sync Python dependencies.#>
Param(
# Python version.
[string]$Version = '3.11'
)
$REQUIREMENTS = 'requirements.txt'
function Sync-Py {
@blakeNaccarato
blakeNaccarato / $process-ctherm-tci-data.md
Last active March 19, 2024 04:09
Process data exported from the C-Therm TCi thermal conductivity analyzer.

Process data exported from the C-Therm TCi thermal conductivity analyzer.

Usage

If you already have Python 3.11 and the Python launcher installed on Windows/Linux/MacOS, you may run process_data.py with pipx by first downloading it (or copy/pasting its contents into a locally-saved script) and running e.g.

py -3.11 -m pipx run process_data.py
@blakeNaccarato
blakeNaccarato / Matlab and Python notes.md
Last active January 22, 2024 19:09
Notes on actually calling Python from within Matlab, Matlab from within VSCode Jupyter notebooks, and version control of Matlab project folders with Git.

Matlab and Python notes

Notes on actually calling Python from within Matlab, Matlab from within VSCode Jupyter notebooks, and version control of Matlab project folders with Git. These are hastily scribbled notes, not transformed into anything cohesive quite yet.

@blakeNaccarato
blakeNaccarato / $trello_json_markdown.md
Last active January 13, 2024 01:08
Convert a single-card Trello JSON export to Markdown.

make_markdown.py

Convert a single-card Trello JSON export to Markdown.

Usage

Download this Gist, install the $PYTHON_VERSION seen in setup.ps1, and run setup.ps1 if you have cross-platform PowerShell installed, or equivalently in a terminal of your choice:

  • If, for example, $PYTHON_VERSION is 3.11, run py -3.11 -m venv .venv in Windows or on UNIX-like/MacOS systems with the Python Launcher installed.
  • Activate the virtual environment with .venv/scripts/activate on Windows or .venv/bin/activate on UNIX-like/MacOS systems.
@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
@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 / $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 / 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 / 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 / $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