Skip to content

Instantly share code, notes, and snippets.

View blakeNaccarato's full-sized avatar

Blake Naccarato blakeNaccarato

View GitHub Profile
@blakeNaccarato
blakeNaccarato / omnivore-acquisition.md
Last active November 8, 2024 14:24
Omnivore acquisition

Omnivore acquisition (2024-10-29T06-47-27)

@blakeNaccarato
blakeNaccarato / test.ipynb
Last active September 25, 2024 22:51
Integer slice selection in `xarray`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blakeNaccarato
blakeNaccarato / $README.md
Last active September 25, 2024 19:08
Isolated script for syncing `.env` with e.g. a `tool.my_tool.env` table in `pyproject.toml`

Isolated script for syncing .env with e.g. a tool.my_tool.env table in pyproject.toml.

Download env.py to your project directory containing a pyproject.toml with a table named tool.dev.env and use uv run this tool in an isolated environment.

uv run env.py

Or you can invoke the script directly from a pinned commit revision of this Gist on Windows,

@blakeNaccarato
blakeNaccarato / fit.py
Created July 26, 2024 16:29
Fitting experimental data to model functions using `scipy.optimize.curve_fit`
"""Get fits and errors."""
from functools import partial
from warnings import catch_warnings
from numpy import array, diagonal, full, inf, isinf, linspace, nan, sqrt, where
from scipy.optimize import OptimizeWarning, curve_fit
from scipy.stats import t
# Docs: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html
@blakeNaccarato
blakeNaccarato / disableCortanaAndWebSearch.reg
Created June 18, 2024 04:27
Disabling Cortana and web search in Windows 11, worked as recently as March 2024
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
"CortanaConsent"=dword:00000000
"AllowSearchToUseLocation"=dword:00000000
"BingSearchEnabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"ConnectedSearchUseWebOverMeteredConnections"=dword:00000000
"AllowCortana"=dword:00000000
@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 August 31, 2024 19:52
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