Skip to content

Instantly share code, notes, and snippets.

@kennwhite
kennwhite / vpn_psk_bingo.md
Last active April 5, 2025 04:55
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

@kennwhite
kennwhite / killBashWarningEverywhere.md
Last active March 25, 2025 21:33
Kill every warning of "The default interactive shell is now zsh." everywhere on MacOS

I'm well aware of how old the version of Bash is that ships with MacOS and Apple's public deprecation plans. That said, I don't like having to fiddle with this in VS Code and every other tool that tries to be clever. This will kill the message everywhere for processes of this user. Don't bother screwing around with $HOME .bashrc .profiile .bash_profile BS. Or do, but realize the local config specific to the user won't suffice for VS Code et al. You can also use Brew to do this, which will use the most recent version of Bash, but I have a love-hate relationship with Brew and prefer to use this approach instead. Caveat Emptor: This works for me, but use at your own risk.


@kennwhite
kennwhite / tree_build.sh
Created March 11, 2025 08:14
Install tree utility on MacOS without Brew
#!/usr/bin/env bash
#
# Download tar file for "tree" here: https://oldmanprogrammer.net/source.php?dir=projects/tree
# Maintained here: https://github.com/Old-Man-Programmer/tree
# (No, really. It's 10+ years old, and updated as recently as Nov 25, 2024)
#
# I think this requires XCode pre-installed for gcc etc.
curl -LO https://github.com/Old-Man-Programmer/tree/archive/refs/heads/master.zip
unzip ./master.zip
@kennwhite
kennwhite / 1944_OSS_Simple_Sabotage_Field_Manual.md
Last active February 11, 2025 11:57
1944 OSS Simple Sabotage Field Manual
@kennwhite
kennwhite / flatten_json_examples.md
Created February 8, 2025 18:04
Convert large json files into flat, line-by-line format. With and without surrounding brackets & commas

Convert large json files into flat, line-by-line format. With and without surrounding brackets & commas

head -n 10 data.json

[
  {
    "name": "Angela Merkel",
    "phone": "+49123456789",
    "dob": {
@kennwhite
kennwhite / chrome_build_ubuntu.sh
Last active December 8, 2024 16:15
Building Chrome from source in Ubuntu 18 & 20
# Based on:
# https://chromium.googlesource.com/chromium/src/+/master/docs/linux/build_instructions.md#System-requirements
# Easiest path is to use Ubuntu 18.04 *Desktop*
# It will bring along a lot of the critical system GUI & font dependencies
# Only needed for 18 minimal, not 18 full or 20:
# echo "shmfs /dev/shm tmpfs defaults,size=58G 0 0" | sudo tee -a /etc/fstab
# Assumes we're running in a container/VM, otherwise don't run as root
@kennwhite
kennwhite / alpine_password.sh
Last active December 5, 2024 14:23
Non-interactive user create & password change for Alpine Linux
#! /usr/bin/env sh
# Create unprivileged Alpine linux user. Run this script as root/sudo
# Don't prompt for password and make group same as username, default path & shell
adduser -D -g appuser appuser
# Set a decent random password (aiming for a 256 bit security level, but better than "monkey")
PW=$(head -c 32 /dev/urandom | base64) && echo -e "$PW\n$PW" | passwd appuser && unset PW
@kennwhite
kennwhite / MongoDB_bindIp_solution.md
Last active November 6, 2024 19:55
Misconceptions about MongoDB network binding ("net.bindIp")
@kennwhite
kennwhite / VS_Code_go_debugging.md
Last active November 2, 2024 04:21
Setting up VS Code and Golang with debug & build flag (-tags foo) support

Setting up VS Code and Golang with debug & build flag (-tags foo) support

This is the setup that worked for me after half a day of hacking around and chasing rabbit holes down old forum posts and open & closed Github issues.

Problem: While Go integration with VS Code is pretty slick in general, I needed to pass compile-time build flags, e.g., -tags foo[^1] to go build and go run directives, and I wanted to be able to properly debug with breakpoints etc. While there are some promising tutorials out there like this on Digital Ocean and on Log Rocket it turned out that one of the first things they both say to do is add the Delve extension to VS Code,

@kennwhite
kennwhite / Gatekeeper Exception command line.md
Last active October 15, 2024 23:50
Bypass MacOS Gatekeeper for specific apps & executables on command line

To override Big Sur's Gatekeeper restriction: "cannot be opened because the developer cannot be verified" from the command line

Example with MongoDB (can be run against a folder e.g., JavaSDK or individual executables):

xattr -d com.apple.quarantine /Users/me/Downloads/mongodb-macos-x86_64-enterprise-4.4.2/bin/*

This appears to be sticky for all identical versions of that executable, i.e., if you have two copies of the identical binary in unrelated directories, removing quarantine for one seems to enter a file signature hash into the allowed list globally.