Skip to content

Instantly share code, notes, and snippets.

View benpm's full-sized avatar
🕶️
pushin pixels

Benjamin Mastripolito benpm

🕶️
pushin pixels
View GitHub Profile
@benpm
benpm / install_openssh_windows.ps1
Created October 28, 2025 20:53
Install OpenSSH ssh server on Windows
# from https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell&pivots=windows-11
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*' | ForEach-Object {
@benpm
benpm / CMakePresets.json
Created August 14, 2025 03:12
How to stop CMake from using vcpkg with the Visual Studio generator
{
"version": 4,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "no-vcpkg",
@benpm
benpm / CLAUDE.md
Last active August 14, 2025 04:29
OpenSpace dev config

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

OpenSpace is an open-source interactive data visualization software designed to visualize the known universe. It's a C++ application using OpenGL 3.3+ with a modular architecture, Lua scripting interface, and support for multiple display environments (flat screens, multi-projector, planetariums).

Build System

@benpm
benpm / .wezterm.lua
Last active July 18, 2025 03:41
WezTerm Config
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
local act = wezterm.action
config.keys = {
-- search for the string "hash" matching regardless of case
{
key = 'F3',
action = act.Search { CaseInSensitiveString = 'hash' },
},
@benpm
benpm / readme.md
Created March 24, 2025 07:59
Install ZSH on Windows!

Install ZSH on Windows!

  1. Install Git Bash
  2. Download latest package from here
  3. Extract with PeaZip into git bash install directory (C:\Program Files\Git for instance)
  4. Add to ~/.bashrc:
# Unmangle UTF-8 encoded text
/c/Windows/System32/chcp.com 65001 > /dev/null 2>&1

# Set default shell like normal
@benpm
benpm / README.md
Last active October 2, 2025 10:24
Windows VS 2022 Execute Build Command in VS Code

Windows VS 2022 Execute Build Command in VS Code

devcmd.bat is used to run a command within the context of a Visual Studio development environment in VS code. An environment variable, DEV_MODE, is used to indicate if it's being used to execute tasks or is meant to be interactive, and thus launch a Git Bash interactive shell.

@benpm
benpm / pairing.c
Last active June 11, 2024 09:15
fast symmetric pairing function in C
uint pair(uint a, uint b) {
const uint s = a + b + 1;
const uint minv = b ^ ((a ^ b) & -(a < b));
return (((s * s) - (s & 1)) >> 2) + minv;
}
@benpm
benpm / tasks.json
Created May 9, 2024 00:21
my default vscode tasks file that clears the goddamn terminal
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "CMake: build",
"command": "build",
"targets": [
"all"
],
@benpm
benpm / capture.py
Created March 22, 2023 20:35
Asynchronously run and capture output of program with python asyncio
import asyncio, os
async def run_cmd(cmd):
proc = await asyncio.create_subprocess_shell(
cmd,
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE)
# Read one line of output at a time
@benpm
benpm / high_dpi.cpp
Created March 5, 2023 01:20
High DPI / Dynamic Scaling for ImGui with GLFW
float monScaleX, monScaleY;
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &monScaleX, &monScaleY);
int dpiScale = std::max((int)monScaleX, (int)monScaleY);
ImGui::GetStyle().ScaleAllSizes((float)dpiScale);
ImGui::GetIO().FontGlobalScale = (float)dpiScale;
ImFontConfig fontConfig;
fontConfig.OversampleH = 2;
fontConfig.OversampleV = 2;
fontConfig.SizePixels = 16.0f * dpiScale;
# Loads a custom font, replace with your own font