Skip to content

Instantly share code, notes, and snippets.

View HaleTom's full-sized avatar
💭
Using human learning for machine learning

Tom Hale HaleTom

💭
Using human learning for machine learning
View GitHub Profile
@HaleTom
HaleTom / keybase.md
Created September 11, 2019 07:53
Keybase identity proof

Keybase proof

I hereby claim:

  • I am haletom on github.
  • I am tomhale (https://keybase.io/tomhale) on keybase.
  • I have a public key ASA0UCq38IWRstxf9o5_HXYCzXjb7paM7SF7QfHRykoxsAo

To claim this, I am signing this object:

@HaleTom
HaleTom / .bash_funcs
Created August 30, 2016 09:33
My bash shell functions
# Functions to be sourced by .bashrc
#
# Ensure that ones to be accessed outside of .bashrc are added
# to the 'export' line at the very end.
# The absolute directory name of a file(s) or directory(s)
function abs_dirname {
for _ in $(eval echo "{1..$#}"); do
(cd "${dir:="$(dirname "$1")"}" && pwd || exit 1 )
[[ $? -ne 0 ]] && return 1
@HaleTom
HaleTom / describe.py
Last active June 2, 2022 21:32
describe - line and filename, variable name, class, str representation and some other info
# Print the line and filename, function call, the class, str representation and some other info
# Inspired by https://stackoverflow.com/a/8856387/5353461
import inspect
import re
def describe(arg):
frame = inspect.currentframe()
callerframeinfo = inspect.getframeinfo(frame.f_back)
@HaleTom
HaleTom / aria2-trackers-update
Last active March 23, 2024 09:07
Update aria2.conf with 20 "best" BitTorrent trackers
#!/bin/bash
# Update the bt-tracker= line in aria2.conf
# Any bt-tracker= lines are removed and and a new one added at the bottom of the file
# Updates at: https://gist.github.com/HaleTom/fe873dc2f3c5bd14f7418efefc2b91a8
# Inspiration: https://github.com/wuyuansushen/aria2c_TrackersList
set -euo pipefail
shopt -s failglob
@HaleTom
HaleTom / git-quote-string-multiline
Created October 1, 2016 03:21
Quote a single- or multi-line string for use in git's aliases
#!/bin/bash -eu
# Quote a single- or multi-line string for use in git's aliases
# Copyright (c) 2016 Tom Hale under https://en.wikipedia.org/wiki/MIT_License
quote() {
printf %s "$1" | sed -r 's/(["\\])/\\\1/g';
}
IFS=$(printf '\n')
@HaleTom
HaleTom / print256colours.sh
Last active May 2, 2024 14:43
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256