Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / touchid_sudo.md
Last active May 15, 2023 16:17
Enable TouchID in terminal for sudo on macOS

sudo vi /etc/pam.d/sudo

Add to the end BEGINNING of the file:

auth sufficient pam_tid.so

@kennwhite
kennwhite / Enable sudo TouchID.md
Last active June 4, 2024 14:45
How to run a macOS app as admin using TouchID/password dialog box.

(This isn't specific to Wireshark)

sudo vi /etc/pam.d/sudo

Add to the end BEGINNING of the file:

auth sufficient pam_tid.so

Test with a trivial sudo command, and you should get a TouchID prompt:

@kennwhite
kennwhite / undork_macos_finder_views.sh
Last active June 16, 2023 21:39
Undork macOS & OSX Finder scattering .DS_Store files everywhere and not being consistent about list views
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Remove other views, which Finder remembered because of the .DS_Store files:
find ~ -name ".DS_Store" -delete 2>/dev/null
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
@kennwhite
kennwhite / undork right click touchpad mac os.txt
Last active June 6, 2024 21:36
Enable / turn on right click tap on macOS (Ventura) and undork default
System Settings >
Trackpad >
Tracking speed: slightly slower (optional)
Click: Medium
Force Click and haptic feedback: off
Look up & data detectors: off
Tap to click: off
*THEN*
Secondary click: change "Click or Tap with Two Fingers"
@kennwhite
kennwhite / rust_base64_madness.rs
Last active October 2, 2024 13:44
Rust and base64 encoding decode madness
// YOU HAVE LOTS OF...OPTIONS WITH RUST'S BASE64 ECOSYSTEM. base64::decode() was deprecated Jan 2023
//
// use base64; // let key = base64::decode(base64_key); // <=== classic method, but will throw Deprecation warnings
// use base64::prelude::*; // let key = BASE64_STANDARD.decode(base64_key)?;
// use data_encoding::BASE64; // let key = BASE64.decode( b"SGVsbA...gh=" ) // b prefix is required
// use base64::{Engine as _, alphabet, engine::{self, general_purpose}}; // let key = general_purpose::STANDARD.decode(...);
// use base64::{Engine as _, engine::{general_purpose}}; // let key = general_purpose::STANDARD.decode(...);
// use base64::{Engine as _, engine::general_purpose}; // let key = general_purpose::STANDARD.decode(...);
// use base64::{Engine as _, engine::{general_purpose::STANDARD as base64}}; // let key = base64.decode(...); // DANGER!!
// use base64::{Engine as _, engine::{general_purpose as BASE64}}; // let key = BASE64::STANDARD.decode(...);
@kennwhite
kennwhite / build_mongodb_from_source_centos_9.sh
Created May 1, 2023 13:18
Reproducibly build MongoDB (7.0.0-rc0) from source on CentOS 9 Streams
# Reproducible CentOS 9 Streams install steps for mongod v. 7.0.0
# Cent 8 doesn't support g++-11.3
#
# NOT MEANT AS A TRUE SCRIPT -- SOME INTERACTION IS REQUIRED FROM PROMPTS
#
# THIS IN NO WAY IS OFFICIAL, OR REPRESENTS MongoDB Inc. USE AT YOUR OWN RISK
#
# Get ami # for official CentOS 9 Stream from https://www.centos.org/download/aws-images/
@kennwhite
kennwhite / build_mongodb_from_source_debian_11.sh
Last active February 7, 2024 06:04
Reproducibly build MongoDB (7.0.0-rc0) from source on Debian 11 Bullseye
# Reproducible Debian 11 install steps for mongod v. 7.0.0 (defaults to gcc/g++ v 12, not 11, which requires more steps)
# NOT MEANT AS A TRUE SCRIPT -- SOME INTERACTION IS REQUIRED FROM PROMPTS
# DO NOT DO run apt get autoremove !!!
#
# THIS IN NO WAY IS OFFICIAL, OR REPRESENTS MongoDB Inc. USE AT YOUR OWN RISK
#
# Get ami # for Debian 11 Bullseye, from: https://wiki.debian.org/Cloud/AmazonEC2Image/Bullseye
echo 'deb http://http.us.debian.org/debian/ testing non-free contrib main' | sudo tee -a /etc/apt/sources.list >/dev/null
sudo apt -y update