Skip to content

Instantly share code, notes, and snippets.

@villeodell
villeodell / coda-api-swagger2.yaml
Created November 11, 2023 14:23
Coda API (coda.io) Swagger 2 definition for services that don't yet support OpenAPI 3.0 and later
---
swagger: "2.0"
info:
version: 1.4.3
title: Coda API
description: |
# Introduction
The Coda API is a RESTful API that lets you programmatically interact with Coda docs:
@villeodell
villeodell / clean-filenames.sh
Last active October 26, 2022 10:53
Clean filenames for OneDrive or FAT32
#!/bin/zsh
#------------------------------------------------------------------
# Strip illegal characters :;*?\"<>| recursively beginning in
# the directory it is run from.
#
# Use when preparing to sync or copy files to a filesystem
# that does not allow these characters. (MS OneDrive, fat32, etc..)
#
# zmv [OPTIONS] oldpattern newpattern
@villeodell
villeodell / List applications by date last opened.md
Last active April 7, 2022 13:46
macOS command line: list applications by last opened date and output to csv

List macOS applications by date last opened

Make a list of your current applications along with the date you last used them.

  1. Get the relevant metadata attributes for Applications to mimic "Date last opened" in Finder using mdls
  2. Convert plist xml output to json using yq
  3. With jq
    • select just the most recent date if multiple dates
    • sort the results
  • ouput the app name and date to csv
@villeodell
villeodell / normalise-loudness.rb
Created December 18, 2021 18:51 — forked from njh/normalise-loudness.rb
Script to normalise a WAV file's loudness to specific LUFS using ffmpeg
#!/usr/bin/env ruby
#
# Script to normalise an audio file's loudness using ffmpeg
#
# Usage: normalise-loudness.rb <input.wav> <output.wav>
#
# License: https://unlicense.org/
#
# Requires the 'json' ruby gem:
#
@villeodell
villeodell / readme.md
Last active October 15, 2021 12:45
Restart bluetooth from macOS Dock

Restart Bluetooth from macOS Dock

macOS has an annoying bug where bluetooth periodically stops working. If you're working via a BT keyboard/trackpad you are forced to wait a minute or two until it resolves on it's own.

Alternative (5 seconds): Have a cable at the ready, plugin your trackpad, restart BT via the macOS Dock.

Setup a shortcut to restart Bluetooth from the dock

Install blueutil

@villeodell
villeodell / typinator-expansion-ms-teams-meeting-options.txt
Created September 16, 2021 22:00
Typinator expansion using perl and regex that prompts for Microsoft Teams join link and outputs a 'Meeting Options' link
{/Perl
use strict;
########
# input a teams join link, extract the important bits, use them to print the meeting options link
# {{?Join Link}} is Typinator code to ask for user input
########
my $str = '{{?Join Link}}';
my $regex = qr/(?i).+19(?::|%3a)(.+(?:@|%40)thread.+)\/(.+)\?context=%7b%22Tid%22%3a%22(.+)%22%2c%22Oid%22%3a%22(.+)%22%7d/mp;
@villeodell
villeodell / eventLink.js
Last active April 7, 2022 14:33
Google Workplace (G Suite) bookmarklets
@villeodell
villeodell / userContent.css
Created April 26, 2020 20:25
Firefox new tab light/dark mode
/* create this as /chrome/userContent.css under Firefox Profile directory */
/* Enable Light/Dark Mode New Tab Background Color */
@media (prefers-color-scheme: dark) {
@-moz-document url("about:newtab"), url("about:home") {
body { background-color: #222 !important;}
}
}

Regular Expression Cheatsheet

Anchors

^   Matches at the start of string or start of line if multi-line mode is
	enabled. Many regex implementations have multi-line mode enabled by
	default.

$ Matches at the end of string or end of line if multi-line mode is enabled.
# restart bluetoothd and bluetoothaudiod on macOS
sudo kill -9 `pgrep bluetooth`