Skip to content

Instantly share code, notes, and snippets.

@act-lilly
act-lilly / hf_dataset_extractor.py
Created October 22, 2025 13:51
Simple, flexible python script to extract one or more columns of Hugging Face dataset to CSV. See argparse and examples starting Line 176.
#!/usr/bin/env python3
"""
HuggingFace Dataset Column Extractor
Extracts specified columns from any HuggingFace dataset and saves to CSV.
"""
import requests
import csv
import argparse
import sys
@act-lilly
act-lilly / git_log_timestamp_all_files.sh
Last active January 8, 2025 09:58
Shell script to generate a CSV file of all files (including path) ever added to a repo along with the original file creation timestamp (no dups)
#!/bin/bash
# Ensure the script exits if any command fails
set -e
# Set locale to handle special characters properly
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Configure Git to handle long paths and disable quote paths for better readability
@act-lilly
act-lilly / install_winget.ps1
Last active January 8, 2025 14:51
Install Winget in Windows Sandbox
# See https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
# This script is a slight adjustment to the one below (copied from above link)
<#
$progressPreference = 'silentlyContinue'
Write-Host "Installing WinGet PowerShell module from PSGallery..."
Install-PackageProvider -Name NuGet -Force | Out-Null
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
Repair-WinGetPackageManager
Write-Host "Done."
@act-lilly
act-lilly / notify.ps1
Last active January 3, 2025 23:10
Powershell function to send a Windows UI notification
# Example Usage:
# Send-Notification -Title "Hello World" -Message "This is a test notification."
# Send-Notification -Title "Custom AppId Example" -Message "Using a custom AppId." -AppId "MyCustomAppId"
Function Send-Notification {
param (
[string]$Title,
[string]$Message,
[string]$AppId # Optional, no default value
)
@act-lilly
act-lilly / install_ms_visual_c_plus_plus_redistr.ps1
Last active December 28, 2024 02:10
Install Microsoft Visual C++ Redistributable
### Microsoft Visual C++ Redistributable Installation Script: Install-VCRedist.ps1 ###
# Define download URLs for both x64 and x86 versions
$vcRedistUrls = @{
"x64" = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
"x86" = "https://aka.ms/vs/17/release/vc_redist.x86.exe"
}
# Define directory to store installers temporarily
$installerDir = "C:\Users\WDAGUtilityAccount\Desktop\VCRedistInstallers"
@act-lilly
act-lilly / sandbox_base_install_plus_repo_example.wsb
Created December 27, 2024 18:22
Sample Windows Sandbox WSB file to perform standard tool installs plus repo of interest - e.g. wisupai/e2m
<Configuration>
<VGPU>Enable</VGPU>
<Networking>Enable</Networking>
<LogonCommand>
<Command>powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "
curl.exe -L -o $env:TEMP\Controller.ps1 https://gist.github.com/act-lilly/0651a86eacb4c54af2d9e3c7714bfcb8/raw/7294f1e267ed6c2e4c00ea0625aa2c5d8e32001e/wsb_controller.ps1;
powershell.exe -File $env:TEMP\Controller.ps1;
[System.Environment]::SetEnvironmentVariable('Path', [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'User'), 'Process');
curl.exe -L -o $env:TEMP\e2m.ps1 https://gist.github.com/act-lilly/7cddfc072edf30017465f6bd4df3112a/raw/2e4e0ffb4a68c7ebcc0fc72f705ae5e789ce90f3/install_and_run_e2m.ps1;
powershell.exe -File $env:TEMP\e2m.ps1"</Command>
@act-lilly
act-lilly / install_and_run_e2m.ps1
Last active December 28, 2024 04:26
Install and Run the E2M library and Service
# Install Poetry if not already installed
pip install poetry
pip install git+https://github.com/wisupai/e2m.git --index-url https://pypi.org/simple
# Clone the repository to the user's Desktop
$desktopPath = Join-Path $env:USERPROFILE 'Desktop'
$repoPath = Join-Path $desktopPath 'e2m'
if (Test-Path $repoPath) {
Write-Host "Directory already exists. Removing and recloning..." -ForegroundColor Yellow
@act-lilly
act-lilly / install_python.ps1
Created December 27, 2024 02:46
Install Python in Windows Sandbox
### Python Installation Script: Install-Python.ps1 ###
# Retrieve release version from environment variable or use default
$pythonVersion = if ($env:PYTHON_VERSION) { $env:PYTHON_VERSION } else { "3.12.8" }
# Define download URL
$pythonUrl = "https://www.python.org/ftp/python/$pythonVersion/python-$pythonVersion-amd64.exe"
# Define path for installer
$pythonInstallerPath = "C:\Users\WDAGUtilityAccount\Desktop\PythonInstaller.exe"
@act-lilly
act-lilly / wsb_controller.ps1
Last active December 28, 2024 02:14
Windows Sandbox (wsb) controller gist - uses other gists to perform installs
# Define the list of scripts to download and execute
$scripts = @(
@{
Name = "Install Visual C++ Redistributable"
Url = "https://gist.github.com/act-lilly/bb6bb14083974fb292c1af49d1ef1d4f/raw/185eaa7e7014ca530714e3d911cdb7757c983d8c/install_ms_visual_c_plus_plus_redistr.ps1"
Path = "C:\Users\WDAGUtilityAccount\Desktop\install_visual_c++_redistributable.ps1"
BitPosition = 1 # Binary: 0001
},
@{
Name = "Install Git"
@act-lilly
act-lilly / install_git.ps1
Last active December 27, 2024 01:16
Install Git in Windows Sandbox
### Git Installation Script: Install-Git.ps1 ###
# Retrieve release version from environment variable or use default
$gitVersion = if ($env:GIT_VERSION) { $env:GIT_VERSION } else { "2.48.0" }
# Define download URL
$gitUrl = "https://github.com/git-for-windows/git/releases/download/v$gitVersion-rc0.windows.1/Git-$gitVersion-rc0-64-bit.exe"
# Define path for installer
$gitInstallerPath = "C:\Users\WDAGUtilityAccount\Desktop\GitInstaller.exe"