Skip to content

Instantly share code, notes, and snippets.

@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 DNAnexusProjectName"
echo " Before running, be sure to log in to BaseSpace"
echo " bs auth"
echo " The CLI toolkits for bs and dx 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
if [ $# -eq 0 ]; then
echo "This script can be used to transfer all files from a DNAnexus project to a GS bucket for Terra."
echo "Usage: $0 DNAnexus_project-id:/path/to/recurse gs://bucket/path [pattern_to_match]"
echo " Before running, be sure to log in to both BaseSpace and DNAnexus via:"
echo " dx login"
echo " The CLI toolkits for bs and dx can be found here and must be installed first:"
echo " https://documentation.dnanexus.com/downloads"
exit 1
#!/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)
@tomkinsc
tomkinsc / graphical_mpileup_qual.py
Last active August 22, 2022 20:11
This replaces basecall quality scores with graphical equivalents. Based on pyemojify and fastqe, but self-contained without dependencies external to the standard library.
#!/usr/bin/env python
import re, sys, os
from stat import S_ISFIFO
import argparse
# quick and dirty script to show emoji or bars for samtools mpileup quality scrores
# extra verbose so this does not require any external libraries
# based on fastqe and emojify:
# https://raw.githubusercontent.com/fastqe/fastqe/master/fastqe/fastqe_map.py
@tomkinsc
tomkinsc / gist:f5d52274226139887380480543063f6a
Created July 23, 2022 08:07 — forked from hongar/gist:2a7c416c6d049fb5891a5577a424e56d
uBlock Origin: Block "Sign in to (website) with Google" popup
||id.google.com^
||accounts.google.com/gsi/$3p
@tomkinsc
tomkinsc / flowcell-id_to_seqmodel.py
Created July 13, 2022 21:54
quick regex-based script for returning the model of Illumina sequencer for a given flowcell ID
#!/usr/bin/env python
import sys, re
flowcell_to_machine_model_and_chemistry = {
r'[A-Z,0-9]{5}AAXX':{
"machine": "Illumina Genome Analyzer IIx",
"chemistry": "All",
"lane_count": 8,
"note": ""