Skip to content

Instantly share code, notes, and snippets.

View tobiasmcnulty's full-sized avatar

Tobias McNulty tobiasmcnulty

View GitHub Profile
# Documentation: https://docs.brew.sh/Cask-Cookbook
# https://docs.brew.sh/Adding-Software-to-Homebrew#cask-stanzas
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
cask "python-3-9" do
version "3.9.13"
sha256 "351fe18f4fb03be7afac5e4012fc0a51345f43202af43ef620cf1eee5ee36578"
url "https://www.python.org/ftp/python/#{version}/python-#{version}-macos11.pkg"
name "python-3-9"
desc "Python 3.9 for Mac via python.org"
@tobiasmcnulty
tobiasmcnulty / GoogleSheetToOdkCentral.js
Last active December 26, 2023 19:37
Sample AppsScript for exporting an XLSForm in Google Sheets to Excel and publishing it in ODK Central
function getGoogleSpreadsheetAsExcel() {
// Adapted from:
// https://stackoverflow.com/questions/39765110/google-script-convert-sheet-to-xlsx
let ss = SpreadsheetApp.getActive();
let url = "https://docs.google.com/feeds/download/spreadsheets/Export?key=" + ss.getId() + "&exportFormat=xlsx";
let options = {
"method": "get",
"headers": {"Authorization": "Bearer " + ScriptApp.getOAuthToken()}
};
console.log(`Google API request (${options.method}): ${url}`);
@tobiasmcnulty
tobiasmcnulty / sources.list
Created August 8, 2023 12:01
Ubuntu 22.04 Jammy - sources.list for aarch64
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
@tobiasmcnulty
tobiasmcnulty / deploy-ceph.yaml
Last active November 18, 2022 17:46
How We Built a Caktus Cloud - Accompanying Files
# Adapted from:
# https://docs.ceph.com/projects/cephadm-ansible/en/latest/index.html#samples
- name: Bootstrap cluster
hosts: ceph_mon1
tags: cluster
become: true
gather_facts: false
roles:
- role: "nickjj.acme_sh"
tags: ["acme_sh"]
@tobiasmcnulty
tobiasmcnulty / deploy-os.yml
Last active November 12, 2022 18:50
Kolla-Ansible files
- hosts: localhost
tags: ext_net
tasks:
- name: Check OS_ environment variables are available
assert:
that:
- os_images_auth['auth_url'] != ""
# Network and subnet adapted from:
# https://github.com/openstack/kolla-ansible/blob/22cc60b21f98bb0ae0b2d78f0465b6fbdf07d5a2/tools/init-runonce#L99-L103
- name: External network in OpenStack
@tobiasmcnulty
tobiasmcnulty / download-rackspace-cloud-files.sh
Last active July 7, 2022 14:10
How to download Rackspace Cloud Files containers
# I could not get python-swiftclient to obtain its own auth token from Rackspace directly for a non-default region.
# Instead, I obtain one with the swiftly client and then use the `swift` CLI to download the container.
pip install -U python-swiftclient swiftly
export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
export OS_USERNAME=...
export OS_REGION_NAME=IAD
# Set your API Key as the password, not your password...
export OS_PASSWORD=...
$ docker run --rm -e POSTGRES_PASSWORD=mysecretpassword -d postgres:13
a9fd95ccfeaeaa94c0a0a39deac52e74f59841607258c6827eabd2b33972f633
$ docker exec -it a9fd95ccfeaeaa94c0a0a39deac52e74f59841607258c6827eabd2b33972f633 bash
root@661543604ec8:/# apt-get update && apt-get install -y procps
<snip>
root@661543604ec8:/# psql -U postgres -c 'SELECT pg_sleep(60)' &
[1] 463
root@661543604ec8:/# ps auxww
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
postgres 1 0.0 0.1 213072 27168 ? Ss 14:45 0:00 postgres
Elastic Load Balancer, CloudFront and Let's Encrypt
@tobiasmcnulty
tobiasmcnulty / g-mass-storage.service
Last active March 17, 2022 02:42
Unit file to load the `g_mass_storage` module after `iscsi.service`
# Adapted from: https://unix.stackexchange.com/a/260022/18065
[Unit]
Description=Loads kernel module for USB OTG
After=iscsi.service
DefaultDependencies=false
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/modprobe g_mass_storage file=/dev/xyx
- name: Disable onboard audio
replace:
path: /boot/config.txt
regexp: '^dtparam=audio=on$'
replace: '#dtparam=audio=on'
register: disable_onboard
when: dac_type is defined
- name: Enable DAC ({{ dac_type }})
lineinfile: