Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Witt thomaswitt

View GitHub Profile
View gist:e7b6b08d2d6c94fb91d80a8cfc2f20a8
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"'
View keybase.md

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 Nov 18, 2021
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
View VPNConfigurationProfiles.mobileconfig
<?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 Dec 23, 2016
Convert AmEx travel expense CSV output to PDF files
View amex_travel_expenses_to_pdf.rb
#!/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 Oct 25, 2016
Switch HDMI output of Raspberry Pi devices off and on and preserve the X11 output
View raspberry-hdmi-screen.sh
#!/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 Oct 21, 2016
Get IP ranges of AWS in Europe
View get_aws_eu_ip_ranges.sh
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 Mar 11, 2015
test_api_ssl_endpoints.rb
View 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 Oct 7, 2017
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_
View VPN_FritzBox_OnDemand.mobileconfig
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
View upload_cert_alias.bash
# 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 Aug 29, 2015
Mass Create Route 53 Domains at AWS
View create_route53_domains.rb
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