Skip to content

Instantly share code, notes, and snippets.

View mccaffers's full-sized avatar

mccaffers mccaffers

View GitHub Profile
@mccaffers
mccaffers / server.conf
Created September 25, 2025 16:45
QuestDB Maximum Performance Configuration. This configuration maximises performance at the expense of memory usage for QuestDB
# QuestDB Maximum Performance Configuration
# WARNING: This configuration maximizes performance at the expense of memory usage
# Ensure you have sufficient RAM and CPU cores before applying these settings
# ===========================================
# SHARED WORKER CONFIGURATION (CRITICAL)
# ===========================================
# Set to number of CPU cores (or slightly less to leave cores for OS)
# Running on a 94 core machine, so we set to 32 to leave room for OS and other tasks
shared.worker.count=32
@mccaffers
mccaffers / babble_ios_privacy_policy.md
Created June 1, 2025 15:24
Babble_iOS_App_Privacy_Policy

Babble (iOS - iPhone & iPad) Privacy Policy

Babble takes your privacy seriously.

Collection of Routine Information

This application does not utilise analytics or tracking.

Cookies

@mccaffers
mccaffers / git_commit_hash_into_plist_xcode_build_phase.sh
Created May 5, 2025 15:19
This script updates an iOS app's Info.plist file with the current Git commit hash, creating the GitCommitHashApp key if it doesn't already exist. Useful for reference the git hash inside the Swift application.
INFO_PLIST="${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}"
# Get the GIT hashes
searchOpsApp=$(git rev-parse --short HEAD)
# Query and save the value; suppress any error message, if key not found.
valueApp=$(/usr/libexec/PlistBuddy -c 'print :GitCommitHashApp' "${INFO_PLIST}" 2>/dev/null)
# Check if value is empty
if [ -z "$valueApp" ]
@mccaffers
mccaffers / elasticsearch-aws-ami-al2023.sh
Last active September 29, 2025 07:50
This script installs Elasticsearch and Kibana on Amazon Linux 2023. It configures the repositories, installs the software, sets it to start on boot, and resets the elastic user password for initial access.
#!/bin/bash
# This script installs Elasticsearch and Kibana on Amazon Linux 2023
# It configures the repositories, installs the software, sets it to start on boot,
# and resets the elastic user password for initial access
## Step 1: Import the Elasticsearch GPG Key for package verification
# This ensures packages are downloaded from a trusted source
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
@mccaffers
mccaffers / screenshot-every-minute-macos.sh
Last active April 4, 2025 19:15
Bash script to take a screenshot on macOS every minute, converts to webp
# Take a screenshot on macOS every minute
# converts the screenshot to webp to reduce file size
while :;
do
name=$(date +%m\-%d\-%y\_%H.%M.%S);
screencapture -m -D 1 -t png ~/Desktop/screenshots/$name.png;
convert ~/Desktop/screenshots/$name.png ~/Desktop/screenshots/$name.webp;
rm -rf ~/Desktop/screenshots/$name.png;
sleep 60;
done
@mccaffers
mccaffers / ios-unit-test.sh
Last active September 2, 2024 14:53
Unit test iOS from the command line
# Wipe the simulators
xcrun simctl erase all
# Run the unit tests
xcodebuild -scheme TestProject \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
-resultBundlePath TestResult/ \
-enableCodeCoverage YES \
clean build test \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
@mccaffers
mccaffers / convert.sh
Last active April 4, 2025 19:16
ffmpeg commands to convert simulator recorded video for iCloud Developer upload
ffmpeg -i ./sim2.mp4 -crf 28 -an simrecording.mp4
@mccaffers
mccaffers / forwarder.mjs
Last active September 29, 2025 07:51
AWS Lambda Request Forwarder
'use strict'
import http from "https";
import zlib from "zlib";
/* global atob */
function queryString (kvPairs) {
const result = []
for (let key in kvPairs) {
@mccaffers
mccaffers / dismiss-multiple-sheets-snippet.swift
Last active April 4, 2025 19:16
SwiftUI - Dismiss multiple sheets (modals) at once
// Swiftui Tricks
// Dimiss multiple sheets
if let firstScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
if let firstWindow = firstScene.windows.first {
let viewController = firstWindow.rootViewController
viewController?.dismiss(animated: true)
}
}