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 / VPNConfigurationProfiles.mobileconfig
Last active May 28, 2025 21:08
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
@thomaswitt
thomaswitt / get_aws_eu_ip_ranges.sh
Last active October 21, 2016 13:28
Get IP ranges of AWS in Europe
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region=="eu-west-1" or .region == "eu-central-1" or .region == "GLOBAL") | .ip_prefix' | sort -u | sort -n
@thomaswitt
thomaswitt / test_api_ssl_endpoints.rb
Created March 11, 2015 14:32
test_api_ssl_endpoints.rb
#!/usr/bin/env ruby
require 'openssl'
require 'socket'
require 'uri'
CA_BUNDLE_URL='https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt'
#CA_BUNDLE_URL='https://raw.githubusercontent.com/bagder/ca-bundle/e9175fec5d0c4d42de24ed6d84a06d504d5e5a09/ca-bundle.crt'
puts "Downloading ca-bundle.crt from github to local file"
@thomaswitt
thomaswitt / VPN_FritzBox_OnDemand.mobileconfig
Last active March 17, 2022 12:23
iOS VPN configuration file: Connect to FritzBox VPN if connected to the internet through any insecure WiFi Network (all except than trusted) … customize all strings starting with REPLACE_
Check out the newer version of this gist at:
https://gist.github.com/thomaswitt/2f847199863a103dfcf004fec3c538d0
and the corresponding blog post:
https://thomas-witt.com/auto-connect-your-ios-device-to-a-vpn-when-joining-an-unknown-wifi-d1df8100c4ba
# upload-cert www_myserver_com.crt aws_profile_name SSL123_SecondaryCA.crt SSL123_PrimaryCA.crt
function upload-cert() {
NAME=`echo "$1" | cut -d'.' -f1`
END=`openssl x509 -in $NAME.crt -noout -enddate | cut -f2 -d= | while read x; do date -j -f '%b %d %T %Y %Z' "$x" '+%Y-%m-%d'; done`
cat $3 $4 $5 >certchain.pem
aws --profile $2 iam upload-server-certificate --server-certificate-name ${NAME}-${END} \
--certificate-body file://$NAME.crt --private-key file://$NAME.key.rsa --certificate-chain file://certchain.pem
}
@thomaswitt
thomaswitt / create_route53_domains.rb
Last active August 29, 2015 13:57
Mass Create Route 53 Domains at AWS
require 'aws-sdk'
AWS.config({
access_key_id: ENV['AWSAccessKeyId'].strip,
secret_access_key: ENV['AWSSecretKey'].strip,
region: 'eu-west-1',
use_ssl: true,
})
r53 = AWS::Route53.new
@thomaswitt
thomaswitt / crawl_sipgate.rb
Last active August 29, 2015 13:56
As the sipgate guys appearently don't have an API to fetch all users and SIP credentials for provisioning, you have to crawl their web-site. Ugly, but it works. The crawl may take quite some time, so you're better off caching it. If there's somebody listening from @sipgate: please provide a clean API …
require 'mechanize'
m = Mechanize.new
users = []
rooms = []
login = m.get('https://secure.live.sipgate.de/settings/setup')
login.form do |f|
f.username = '[email protected]'
f.password = 'secret_password'
@thomaswitt
thomaswitt / get_pingdom_probe_servers.sh
Created February 11, 2014 09:33
Get all pingdom probe servers by IP, useful for adding to an EC2 security group
wget -q -O - \
https://www.pingdom.com/rss/probe_servers.xml | \
perl -nle 'print $1 if /IP: (([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5]));/' | \
sort -n -t . -k1,1 -k2,2 -k3,3 -k4,4