Skip to content

Instantly share code, notes, and snippets.

View scarytom's full-sized avatar
💻
coding

Tom Denley scarytom

💻
coding
View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active June 25, 2024 12:02
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@fnordomat
fnordomat / WIFIonICE.sh
Last active February 22, 2024 11:18
Automatic negotiation of a captive portal: connect to icomera wifi in DB ICE trains (Germany) without having to jump through hoops.
#!/bin/bash
# Deutsche Bahn / icomera AB offers "free wifi" (ESSID: "WIFIonICE") with internet access via
# mobile networks on some high-speed (ICE) trains.
#
# This takes care of the WIFIonICE captive portal.
#
# Please drop me a note if this script is insecure for some reason. It probably is.
#
@dhemery
dhemery / hamcrest-matcher-style.java
Created December 10, 2011 00:25
DSLs to verify and wait for conditions: Which style do you prefer?
verifyThat(masterView, isPresent());
verifyThat(masterView, eventually(isPresent()));
// What would the "when the subject satisfies a condition" example look like? Maybe this?
when(masterView, isPresent()).touch();