Skip to content

Instantly share code, notes, and snippets.

View tomkinsc's full-sized avatar

Chris Tomkins-Tinch tomkinsc

View GitHub Profile
#!/bin/sh
set -eu
# from https://askubuntu.com/a/1536468
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
@tomkinsc
tomkinsc / hide_google_ai_overview.txt
Last active January 30, 2025 00:09
uBlock Origin cosmetic filter expression to hide "AI Overview" block in Google search results; working on English-language results as of 2025-01-29. subject to revision as DOM evolves over time; also block "People also ask" block
##h1:has-text(AI Overview):xpath(./ancestor::div[(@data-mcpr)])
##span:has-text(People also ask):xpath(./ancestor::div[(@jscontroller)])
@tomkinsc
tomkinsc / xfer_bs_to_gs.sh
Last active July 19, 2024 18:10
Transfer all data from a BaseSpace project to a Google Storage bucket
#!/bin/bash
if [ $# -eq 0 ]; then
echo "This script can be used to transfer *all* files from a BaseSpace project to a Google Storage bucket"
echo "Usage: $0 BaseSpaceProjectName GCPBucketPrefix"
echo ""
echo " NOTE: This will download data from BaseSpace to the machine running this script"
echo " before uploading to GS, so ample uninterrupted bandwidth is required"
echo " for upload and download."
echo " Files are piped, so disk usage required for the transfer is negligible."
@tomkinsc
tomkinsc / disable_apple_mail_link_previews.sh
Last active December 1, 2023 17:58
Disable web URL link previews in Apple Mail under macOS 13.x Ventura (14.x+ has a UI setting to do so). Seems to take effect immediately, without restart of Mail.app or the computer.
@tomkinsc
tomkinsc / cpu_temp_macos.sh
Created November 17, 2023 14:59
macOS CPU die temperature
#!/bin/bash
sudo powermetrics --samplers smc |grep -i "CPU die temperature"
# or thermal pressure:
# sudo powermetrics -s thermal | grep "Current pressure"
# ...or just install the "Hot" menubar app:
# https://github.com/macmade/Hot
#!/bin/bash
if [ $# -eq 0 ]; then
echo "This script can be used to transfer all files from a BaseSpace project "
echo "Usage: $0 BaseSpaceProjectName"
echo " Before running, be sure to log in to BaseSpace"
echo " bs auth"
echo " The CLI toolkits for bs can be found here and must be installed first:"
echo " https://developer.basespace.illumina.com/docs/content/documentation/cli/cli-overview"
exit 1
#!/bin/bash
set -ex
if [ $# -eq 0 ]; then
echo "This script can be used to transfer all files from a DNAnexus project to a GS bucket (for Terra, etc.)"
echo "Usage: $0 DNAnexus_project-id:/path/to/recurse gs://bucket/path [grep pattern_to_match; ex. ".tar.gz"]"
echo " Before running, be sure to log in to both Google Cloud and DNAnexus via:"
echo " dx login"
echo " gcloud auth init"
#!/bin/bash
# First get auth token: https://api.firecloud.org/#/Profile/getProxyGroup
# Check to see if a pipe exists on stdin.
if [ -p /dev/stdin ]; then
while IFS= read emailaddress; do
printf "$emailaddress\t"
curl -X 'GET' \
"https://api.firecloud.org/api/proxyGroup/$(echo $emailaddress | sed 's/@/%40/')" \
@tomkinsc
tomkinsc / POWERSHELL_NOTES.md
Last active October 18, 2022 23:25
Install powershell on ubuntu
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install powershell
hash -r

pwsh
Install-Module -Name PSWSMan
@tomkinsc
tomkinsc / README.md
Created October 15, 2022 22:25
VPN killswitch to auto re-enable the native VPN built in to macOS if it drops and is not active, or if the Wi-Fi is turned on and connects to a "non-home" network

Native VPN killswitch for macOS

This creates a daemon job to watch VPN and Wi-Fi state to ensure the native macOS VPN is active if it drops and is no longer active, or if there is a change in Wi-Fi state (as in the case of Wi-Fi being turned on).

Install instructions

  • customize the string variables at the top of vpn-killswitch.sh to the name of your Wi-Fi network and VPN configuration
  • Place the vpn-killswitch.sh file somewhere, make it executable (chmod u+x vpn-killswitch.sh)
  • alter the full path to whereever the script was placed in the on-network-change.job.plist file
  • (Change the line with /Users/MYUSERNAME/full/path/to/vpn-killswitch.sh)