Skip to content

Instantly share code, notes, and snippets.

View huwr's full-sized avatar
🏡
Working from home

Huw Rowlands huwr

🏡
Working from home
View GitHub Profile
@huwr
huwr / itunes.sh
Last active December 18, 2019 23:40
Simple command line iTunes controller
#!/bin/bash
#
####################################
# Music Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
# edit 2010.06.01 Rahul Kumar
# edit 2013.08.09 Huw Rowlands
# edit 2019.12.19 Huw Rowlands - Updated to Catalina (Music.app)
####################################
@huwr
huwr / portclean.sh
Last active December 21, 2015 22:09
Cleans away old Mac Ports
#!/bin/bash -v
#
# clean old mac ports. Can save a few GBs.
# run as root.
echo "Before: "
du -sh /opt
dupes=$(port installed | cut -d '@' -f 1 | uniq -d)
if [ -z "$dupes" ]
@huwr
huwr / agreement.tex
Last active January 2, 2016 08:29
A Residential Lodging Agreement I made with a lodger in 2012. A few mistakes...
% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.
% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
@huwr
huwr / agreement.md
Created January 6, 2014 04:50
agreement.md

Residential Lodging Agreement

This residential lodging agreement is made between \lessor\ (the lessor) and \lessee\ (the lessee), who is lodging at the premises of \address.

Rent and Bond

  1. The rent is \rent\ per week.
@huwr
huwr / X-words.md
Last active January 2, 2016 08:49
All words containing X

X-Words

From usr/share/dict/words

  • abaxial
  • abaxile
  • abox
  • abrasax
  • abraxas
%Make date format of \today command Australian.
%sc and old style figures
\renewcommand{\today}{
\oldstylenums{\number\day}\space
\ifcase\month\or
\sc{January}\or \sc{February}\or \sc{March}\or \sc{April}\or
\sc{May}\or \sc{June}\or \sc{July}\or \sc{August}\or \sc{September}\or
\sc{October}\or \sc{November}\or \sc{December}
\fi\space
\oldstylenums{\number\year}
@huwr
huwr / tfn_validator.rb
Last active August 29, 2015 14:01
Australian TFN validator
#Algorithm for working out the validity of an Australian Tax File Number.
#
#The algorithm is 'public domain', according to an ANAO report in 1999: Management of Tax File Numbers by the Australian National Audit Office, 1999 (ISBN 0 644 38866 8)
#
#See: http://bioinf.wehi.edu.au/folders/fred/tfn.html
#
#An example TFN: 123 456 782
WEIGHTS = [1, 4, 3, 7, 5, 8, 6, 9, 10]
@huwr
huwr / Date+SunriseAndSunset.swift
Last active November 25, 2022 01:30
Swift Sunrise and Sunset calculation
//
// NSDate+SunriseAndSunset.swift
// Codiad
//
// Created by Huw Rowlands on 26.1.2016.
// Copyright © 2016 Huw Rowlands. All rights reserved.
//
import Foundation
import CoreLocation
@huwr
huwr / repeat.sh
Created May 19, 2017 06:19
Do until success
#!/bin/bash
#Do until success...
until $*; do
sleep 0.1;
done
//
// main.swift
// timestamp
//
// Created by Huw Rowlands on 24/3/18.
// Copyright © 2018 Huw Rowlands. All rights reserved.
//
import Foundation