Skip to content

Instantly share code, notes, and snippets.

View akrabat's full-sized avatar

Rob Allen akrabat

View GitHub Profile
@akrabat
akrabat / nowplaying.5s.sh
Created July 20, 2025 15:22
Updated Now Playing script for SwiftBar
#!/bin/bash
# <xbar.title>Now playing</xbar.title>
# <xbar.version>v1.1</xbar.version>
# <xbar.author>Adam Kenyon</xbar.author>
# <xbar.author.github>adampk90</xbar.author.github>
# <xbar.desc>Shows and controls the music that is now playing. Currently supports Spotify, iTunes, and Longplay.</xbar.desc>
# <xbar.image>https://pbs.twimg.com/media/CbKmTS7VAAA84VS.png:small</xbar.image>
# <xbar.dependencies></xbar.dependencies>
# <xbar.abouturl></xbar.abouturl>
@akrabat
akrabat / phplint
Last active August 13, 2020 14:53
RRecursive php lint
#!/usr/bin/env bash
set -o nounset
# Recursively call `php -l` over the specified directories/files
if [ -z "$1" ] ; then
printf 'Usage: %s <directory-or-file> ...\n' "$(basename "$0")"
exit 1
fi
@akrabat
akrabat / no_automount
Created August 5, 2020 08:51
Add a volume to /etc/fstab to prevent auto-mounting. See http://akrabat.com/prevent-an-external-drive-from-auto-mounting-on-macos/
#!/usr/bin/env bash
# Usage: ./no_automount My\ Disk
NAME=$1
if [ -z "$NAME" ] ; then
echo "Usage: no_automount {Disk Name}"
exit 1
fi
FSTAB=/etc/fstab
@akrabat
akrabat / Vagrantfile
Last active June 26, 2020 10:06
Vagrantfile starting point for PHP/MySQLn
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
# Shared ports
# config.vm.network "forwarded_port", host:8888, guest: 80
# config.vm.network "forwarded_port", host:3307, guest: 3306
# Mount shared folder using NFS
# config.vm.synced_folder ".", "/vagrant",
@akrabat
akrabat / Dockerfile
Created June 20, 2020 12:52
Dockerfile for rst2pdf testing
# To run:
#
# docker build -t rst2pdfdev .
# docker run --rm -v $(pwd)/rst2pdf:/rst2pdf -it rst2pdfdev bash
#
# Now, in the bash prompt:
#
# pip3 install --upgrade setuptools
# pip3 install pytest
# pip3 install -c requirements.txt -e .[tests,sphinx,images,svgsupport,aafiguresupport,mathsupport,rawhtmlsupport]
--
-- For each album, add a hierarchical keyword of the format
-- "PhotosExport>folder1>folder2>album" to each photo.
--
-- Copyright 2019 Rob Allen.
-- License: MIT - https://akrabat.com/license/mit/
--
-- Variables to control how many albums to process per run
-- change appropriately per run if you need to do in batches
@akrabat
akrabat / snippets.lua
Last active December 28, 2019 12:20
Useful Lua snippets
--[[
Does "str" start with "start"?
]]
local function starts_with(str, start)
return str:sub(1, #start) == start
end
--[[
Get the item with a getName() of 'name' from the table 'collection'
@akrabat
akrabat / Vagrantfile
Last active July 3, 2025 07:05
Example Vagrantfile for Windows
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Base box: https://github.com/akrabat/packer-templates
Vagrant.configure("2") do |config|
config.vm.box = "19ft/windows2016"
config.vm.guest = :windows
config.vm.boot_timeout = 600
@akrabat
akrabat / vimdc
Created January 19, 2019 18:52
Basic vim setup ~/.vim/vimrc
set nocompatible
" General settings
syntax on
filetype plugin indent on
set autoread " Automatically reload changed files
set autowrite " Automatically save before :next, :make etc.
set backspace=indent,eol,start " backspace from this line to the previous one
set encoding=utf-8 " UTF-8 is good…
@akrabat
akrabat / shell.sh
Last active December 15, 2017 16:43
Binding an ElephantSQL's credentials to a Bluemix OpenWhisk action
# A simple action to prove it works
$ cat myaction.php
<?php
function main(array $args) : array
{
return $args;
}
$ bx wsk action update myaction myaction.php
# Create the PostgreSQL database