This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
check_session() { | |
[ -f $HOME/.op/token ] && export OP_SESSION_my="$(cat $HOME/.op/token)" | |
# attempt sign in if session is not active | |
if ! op get account &> /dev/null; then | |
signin | |
check_session | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./air-cert-dates.sh /path/to/app.air | |
signatures="$(unzip -p "$1" META-INF/signatures.xml)" | |
xpath '//Signature[@Id="PackageSignature"]//X509Certificate[1]/text()' <<< "$signatures" 2>/dev/null \ | |
| sed -e $'1s/^/-----BEGIN CERTIFICATE-----\\\n/;$s/$/\\\n-----END CERTIFICATE-----/' \ | |
| openssl x509 -dates -noout \ | |
| sed -e $'1s/^/metric,date\\\n/;s/=/,/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Photos" | |
activate | |
set folderList to name of every folder | |
set selectedFolders to choose from list folderList with prompt "Select folders:" with multiple selections allowed | |
set destination to POSIX path of (choose folder with prompt "Please select a backup location:") | |
repeat with f in folders | |
if selectedFolders contains name of f then | |
my exportFolder(f, destination) | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$char = 'イ'; | |
// What's the UTF-8 encoding of this character? (This file is saved in UTF-8) | |
var_dump(bin2hex($char)); // e382a4 | |
// What does another encoding look like? | |
// See http://www.fileformat.info/info/unicode/char/30a4/charset_support.htm | |
var_dump(bin2hex(mb_convert_encoding($char, "EUC-JP", "UTF-8"))); // a5a4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"E92000001": { | |
"country_or_area": "England", | |
"council": 0, | |
"wards": 0, | |
"postcodes": 0, | |
"full_or_partial": "F", | |
"key_points": "Your area is under Covid restrictions, in the Tier 1 (medium alert) category for England.", | |
"meeting_friends_and_family": "* You can mix socially in a group of up to six people from multiple households. This includes children and applies indoors and outdoors, including private homes. \n* Socialising in larger groups is against the law, with fines up to £6,400.\n* There are exceptions, for example if your household or support bubble is larger than six, or if someone enters your house to carry out work, registered childcare or care for a vulnerable person.\n", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
domain=$1 | |
origin="example-origin.net" | |
file=/etc/hosts | |
fqdn= | |
if [ $# -lt 1 ]; then | |
echo "Usage: $(basename "$0") DOMAIN [{production|staging|origin|off}]" >&2 | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Checks a server certificate chain for old USERTrust intermediate cert, | |
# which will expire in May 2020. | |
# | |
# Possible output: | |
# | |
# • Error (e.g. cannot connect to host) | |
# • Not a Sectigo/Comodo chain (cannot find one of the CAs) | |
# • New USERTrust root cert found (valid, but superfluous) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
github=$(curl -s https://api.github.com/meta | jq -r '.web | .[]' | sed 's~/32~~' | sort) | |
ufw=$(ufw status | grep '# GitHub' | awk '{print $1}' | sort) | |
comm -13 <(echo "$ufw") <(echo "$github") | while read addition; do | |
echo "Adding $addition" | |
ufw allow out to $addition port 22 comment GitHub | |
done |