Skip to content

Instantly share code, notes, and snippets.

View jhwohlgemuth's full-sized avatar

Jason Wohlgemuth jhwohlgemuth

View GitHub Profile
@jhwohlgemuth
jhwohlgemuth / Format-BookmarkExport.ps1
Created March 23, 2025 02:34
Ingest and transform Firefox bookmarks export JSON file
function Invoke-Shape() {
Param(
[Parameter(Position = 0, ValueFromPipeline = $True)]
[object] $Data,
[Switch] $Recursive
)
Begin {
function Remove-Attribute() {
Param(
[Parameter(Position = 0, ValueFromPipeline = $True)]
@jhwohlgemuth
jhwohlgemuth / viewer.html
Created March 20, 2025 16:07
Standalone file for viewing GeoTIFF in a web browser
<html>
<head>
<title>My first web page</title>
<script src="https://cdn.jsdelivr.net/npm/geotiff/dist-browser/geotiff.js"></script>
<script src="https://cdn.jsdelivr.net/npm/proj4/dist/proj4.js"></script>
<script src="https://cdn.jsdelivr.net/npm/geotiff-geokeys-to-proj4/main-dist-iife.js"></script>
<script src="https://unpkg.com/[email protected]/dist/plotty.min.js"></script>
</head>
<body>
<h1>GeoTIFF in Browser</h1>
#!/usr/bin/env pwsh
[CmdletBinding()]
Param()
function Invoke-FixMetadata() {
<#
.SYNOPSIS
Fix version string issues within conda metadata so "conda env export" works
#>
[CmdletBinding()]
#!/usr/bin/env pwsh
#Requires -Modules Prelude
[CmdletBinding(SupportsShouldProcess = $True)]
Param(
[Parameter(Mandatory = $False, Position = 0)]
[ValidateSet(
'base',
'cml',
'gis',
#!/usr/bin/env pwsh
#Requires -Modules Prelude
[CmdletBinding()]
Param(
[Parameter(Mandatory = $False, Position = 0)]
[String] $Name
)
$Prefix = if ($Name) { "/opt/conda/envs/${Name}" } else { $Env:CONDA_PREFIX }
"==> [INFO] Conda Prefix = ${Prefix}`n" | Write-Verbose
#!/usr/bin/env pwsh
$Packages = "/opt/conda/lib/python3.8/site-packages"
# Issue is with Torch-TensorRT version metadata
$Before = "1.9.0<1.11.0"
$After = "1.9.0,<1.11.0"
# Get path of metadata file with bad version information
$Path = Get-ChildItem -Path $Packages -File -Recurse -Filter METADATA |
Select-String $Before |
Select-Object -Unique Path -ExpandProperty Path
@jhwohlgemuth
jhwohlgemuth / Get-Screenshot.ps1
Created August 22, 2024 23:51
Create screenshot. Save as a file or copy to the clipboard.
function Get-Screenshot {
<#
.SYNOPSIS
Create screenshot. Save as a file or copy to the clipboard.
.DESCRIPTION
Create screenshot of one or all monitors. The screenshot is saved as a BITMAP (bmp) file.
When selecting a monitor, the assumed setup is:
+-----+ +-----+ +-----+ +-----+
@jhwohlgemuth
jhwohlgemuth / install_all_the_things.sh
Created March 9, 2024 20:18
Debian/Ubuntu dependencies for installing all the things
#! /bin/bash
apt-get update
#
# Install development dependencies
#
apt-get install --no-install-recommends -y \
apt-utils \
apt-transport-https \
binutils \
@jhwohlgemuth
jhwohlgemuth / get_nvidia_driver_metadata.py
Created March 2, 2024 02:42
Get NVIDIA CUDA Driver version details from documentation
import re
import numpy as np
import pandas as pd
def parse_cuda_version(val: str):
if isinstance(val, str):
val = re.sub(r"\s+", "", val.lower())
val = re.sub(r"|nvidiacuda|baseimage|withcublas.*|update.*|includes.*|<<|>>", "", val)
else:
val = None
@jhwohlgemuth
jhwohlgemuth / get_cjcs_references.py
Created March 2, 2024 02:22
Script to scrape CJCS Joint Staff publications
import csv
import urllib.request, urllib.error, urllib.parse
from bs4 import BeautifulSoup
root = 'https://www.jcs.mil/Library'
links = {
'instruction': [ f'{root}/CJCS-Instructions/?udt_46626_param_page={page}' for page in range(1, 4) ],
'manual': [ f'{root}/CJCS-Manuals/' for page in range(1, 2) ],
'notice': [ f'{root}/CJCS-Notices/' for page in range(1, 2) ]
}