Skip to content

Instantly share code, notes, and snippets.


Rob Allen akrabat

View GitHub Profile
akrabat / phplint
Last active Aug 13, 2020
RRecursive php lint
View phplint
#!/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
View no_automount
#!/usr/bin/env bash
# Usage: ./no_automount My\ Disk
if [ -z "$NAME" ] ; then
echo "Usage: no_automount {Disk Name}"
exit 1
akrabat / Vagrantfile
Last active Jun 26, 2020
Vagrantfile starting point for PHP/MySQLn
View Vagrantfile
Vagrant.configure("2") do |config| = "ubuntu/focal64"
# Shared ports
# "forwarded_port", host:8888, guest: 80
# "forwarded_port", host:3307, guest: 3306
# Mount shared folder using NFS
# config.vm.synced_folder ".", "/vagrant",
akrabat / Dockerfile
Created Jun 20, 2020
Dockerfile for rst2pdf testing
View Dockerfile
# 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]
View KeywordAlbum.applescript
-- For each album, add a hierarchical keyword of the format
-- "PhotosExport>folder1>folder2>album" to each photo.
-- Copyright 2019 Rob Allen.
-- License: MIT -
-- Variables to control how many albums to process per run
-- change appropriately per run if you need to do in batches
akrabat / snippets.lua
Last active Dec 28, 2019
Useful Lua snippets
View snippets.lua
Does "str" start with "start"?
local function starts_with(str, start)
return str:sub(1, #start) == start
Get the item with a getName() of 'name' from the table 'collection'
akrabat / Vagrantfile
Last active Apr 11, 2021
Example Vagrantfile for Windows
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Base box:
Vagrant.configure("2") do |config| = "19ft/windows2016"
config.vm.guest = :windows
config.vm.boot_timeout = 600
akrabat / vimdc
Created Jan 19, 2019
Basic vim setup ~/.vim/vimrc
View vimdc
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 /
Last active Dec 15, 2017
Binding an ElephantSQL's credentials to a Bluemix OpenWhisk action
# A simple action to prove it works
$ cat myaction.php
function main(array $args) : array
return $args;
$ bx wsk action update myaction myaction.php
# Create the PostgreSQL database
akrabat / ctags
Last active Jan 28, 2021
git hooks for ctags. Place in `.git_template/hooks/` & run: `git config --global init.templatedir '~/.git_template'`
View ctags
set -e
mkdir .git/tags_lock 2>/dev/null || exit 0
trap 'rmdir .git/tags_lock; if [ -f .git/tags.$$ ]; then rm .git/tags.$$; fi' EXIT
# Assumes universal-ctags is on the path
ctags --tag-relative=yes -R -f .git/tags.$$
mv .git/tags.$$ .git/tags