Skip to content

Instantly share code, notes, and snippets.

View pmolodo's full-sized avatar

Paul Molodowitch pmolodo

  • NVIDIA
  • Los Angeles, CA
View GitHub Profile
@pmolodo
pmolodo / cmake_quoting_test.cmake
Last active February 2, 2020 02:45
cmake_quoting_test
#! /usr/bin/env cmake -P
cmake_minimum_required(VERSION 2.8)
# This results in this output:
# -- ========================
# -- empty_var: ""
# -- -------
# -- Unquoted parsing: print_args()
# -- ARGC: 0
# -- -------
@pmolodo
pmolodo / separate_arguments_test.cmake
Created December 9, 2019 19:52
separate_arguments_test.cmake
set(mylist
"first item"
"second-item"
)
message("mylist: ${mylist}")
# mylist: first item;second-item
separate_arguments(mylist_sep WINDOWS_COMMAND "${mylist}")
message("mylist_sep: ${mylist_sep}")
# mylist_sep: first;item\;second-item
@pmolodo
pmolodo / CMakeLists.txt
Last active January 18, 2020 01:10
Test of separate_arguments
cmake_minimum_required(VERSION 3.12.0)
enable_testing()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(IS_WINDOWS TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(IS_LINUX TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(IS_MACOSX TRUE)
@pmolodo
pmolodo / git_ancestry_path_with_multiple_negations.bash
Created December 11, 2020 22:23
git --ancestry-path behavior with multiple negations
#!/bin/bash
set -e
mkdir ancestry_path_test
cd ancestry_path_test
git init
git checkout -b root
echo "R1" > root_file
@pmolodo
pmolodo / testReparsePoint.ps1
Created March 14, 2024 19:03
Test presence of ReparsePoint file attribute on junctions, and children of junctions
Set-StrictMode -Version 1.0
$THIS_FILE = [System.IO.FileInfo]$MyInvocation.MyCommand.Path
$THIS_DIR = $THIS_FILE.Directory
Write-Host $THIS_DIR
$TEST_ROOT = "${THIS_DIR}\test_root"
@pmolodo
pmolodo / install_stgit.sh
Last active June 6, 2024 18:26
Installing stgit / stg / stackedgit from source (because ubuntu package is way out of date - 0.19)
#!/bin/bash
set -e
set -u
# install rust
if ! which cargo >/dev/null 2>&1 ; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
@pmolodo
pmolodo / uv_install.py
Last active September 23, 2025 19:22
Installs the uv tool in a .uv subdirectory of this folder
#!/usr/bin/env python
# uv_install by Paul Molodowitch is marked CC0 1.0.
# to view a copy of this mark, visit https://creativecommons.org/publicdomain/zero/1.0/
"""Installs the uv tool in a .uv subdirectory of this folder"""
import argparse
import enum
import inspect
@pmolodo
pmolodo / prune_git_branches_on_remote.py
Last active September 23, 2025 19:22
Script to prune branches that are identical to a remote
#!/usr/bin/env python
# prune_git_branches_on_remote by Paul Molodowitch is marked CC0 1.0.
# to view a copy of this mark, visit https://creativecommons.org/publicdomain/zero/1.0/
"""CLI interface to prune git branches from a target repo that match the reference repo."""
import argparse
import subprocess
import sys
@pmolodo
pmolodo / try_decode.py
Last active September 23, 2025 19:21
try_decode() - utility function for attempting to decode an encoded unicode string; useful for printing results in error-handling
# try_decode by Paul Molodowitch is marked CC0 1.0.
# to view a copy of this mark, visit https://creativecommons.org/publicdomain/zero/1.0/
import locale
import sys
_TEST_CODECS: tuple[str, ...] = ()
def get_test_codecs():
global _TEST_CODECS # pylint: disable=global-statement
@pmolodo
pmolodo / better_zipfile.py
Created September 23, 2025 21:13
BetterZipFile - python ZipFile subclass that handles symbolic links and permission bits when extracting
# better_zipfile by Paul Molodowitch is marked CC0 1.0.
# to view a copy of this mark, visit https://creativecommons.org/publicdomain/zero/1.0/
import sys
import zipfile
import stat
import os