Skip to content

Instantly share code, notes, and snippets.

View thomaswitt's full-sized avatar
💭
Investing pre-seed/seed into tech startups via @ExpediteVentures

Thomas Witt thomaswitt

💭
Investing pre-seed/seed into tech startups via @ExpediteVentures
View GitHub Profile
@thomaswitt
thomaswitt / gist:95c0cc2a182c34aca991f188c3290c35
Created January 31, 2024 14:54
copy-ssh-key-to-all-aws-regions.sh
for region in $(aws ec2 describe-regions --all-regions | jq -r '.Regions | map(.RegionName) | join(" ")'); do echo $region; aws ec2 import-key-pair --region $region --key-name "SSH Key" --public-key-material fileb://<(head -n 1 ~/.ssh/authorized_keys) ; done
@thomaswitt
thomaswitt / personal-voice.c
Created January 19, 2024 10:30
Enable "Personal Voice" in a terminal to use 'say' with your own voice
/*
Compile via:
gcc -x objective-c -framework AVFoundation -framework Foundation personal-voice.c -o personal-voice
Run it in a terminal (make sure you authorized apps to use your personal voice)
*/
#import <AVFoundation/AVFoundation.h>
int main(){
[AVSpeechSynthesizer requestPersonalVoiceAuthorizationWithCompletionHandler:^(AVSpeechSynthesisPersonalVoiceAuthorizationStatus status){
@thomaswitt
thomaswitt / remove_unwanted_macos_agents.bash
Last active December 7, 2023 08:13
How to monitor and remove unwanted Launch Agents and Daemons in macOS (for .bash_profile)
# Remove unwanted helpers
process_agents() {
local directory=$1
shift
local agents=("$@")
local pattern=$(IFS=\|; echo "${agents[*]}")
shopt -s nullglob
for plist in "$directory"/{LaunchAgents,LaunchDaemons,PrivilegedHelperTools}/*; do
if ! echo "$plist" | egrep -q "$pattern"; then
if [[ $directory = /Library* ]]; then
@thomaswitt
thomaswitt / sonyTVRemote.sh
Created February 10, 2023 06:46
Turn Sony Bravia TV on and off – To be used with EventScripts (https://www.mousedown.net/software/EventScripts.html)
#!/usr/bin/env bash
# Turn Sony Bravia TV on and off
# To be used with EventScripts (https://www.mousedown.net/software/EventScripts.html)
# Get Auth Cookie Script from https://github.com/breunigs/bravia-auth-and-remote.git
IP="0.0.0.0"
MACADDR="00:00:00:00:00:00"
COOKIE="output from https://github.com/breunigs/bravia-auth-and-remote/blob/master/auth_cookie_examples/auth.sh"
OWN_SSID="MY_SSID"
@thomaswitt
thomaswitt / instagram-media-rename.bash
Created May 24, 2022 11:59
Take an Instagram data export, use metadata from media.json file, rename pictures and add EXIF/IPTC date and title, so they're ready to import in a photo management application like iPhoto
#!/bin/bash
if [[ ! -s "media.json" ]]; then
echo "*** ERROR: No media.json file in current directory"
exit 1
fi
mkdir result
echo -n "Processing "
aws --profile MY_PROFILE route53 list-resource-record-sets --hosted-zone-id '/hostedzone/ZOHE_ID' --output json | jq -jr '.ResourceRecordSets[] | "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[]?.Value)\n"'
@thomaswitt
thomaswitt / keybase.md
Created October 1, 2018 23:52
Keybase proof

Keybase proof

I hereby claim:

  • I am thomaswitt on github.
  • I am thomas_witt (https://keybase.io/thomas_witt) on keybase.
  • I have a public key ASDd6BzSb0TMTRzkv_0yh6Vy0yzZ0NRbzKk2J8ADRo2fcgo

To claim this, I am signing this object:

@thomaswitt
thomaswitt / VPNConfigurationProfiles.mobileconfig
Last active November 23, 2023 21:23
An OnDemand VPN iOS profile for iPad and iPhone that automatically connects you to different VPNs (e.g. Meraki, FRITZ!Box and Streisand) | Blog-Entry: https://thomas-witt.com/auto-connect-your-ios-device-to-a-vpn-when-joining-an-unknown-wifi-d1df8100c4ba
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<!-- Home: Manual -->
<dict>
<key>UserDefinedName</key>
@thomaswitt
thomaswitt / amex_travel_expenses_to_pdf.rb
Created December 23, 2016 11:44
Convert AmEx travel expense CSV output to PDF files
#!/usr/bin/env ruby
require 'rubygems'
require 'csv'
require 'bigdecimal'
require 'prawn' # gem install prawn
require 'prawn/measurement_extensions'
require 'prawn/table' # gem install prawn-table
raise "No CSV file given" if ARGV[0].nil?
@thomaswitt
thomaswitt / raspberry-hdmi-screen.sh
Created October 25, 2016 17:53
Switch HDMI output of Raspberry Pi devices off and on and preserve the X11 output
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Syntax: $0 (on|off)"
exit
fi
if [ $1 == "on" ]; then
tvservice -p
sleep 2