Skip to content

Instantly share code, notes, and snippets.

View akrabat's full-sized avatar

Rob Allen akrabat

View GitHub Profile
@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 December 16, 2022 14:44
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
@akrabat
akrabat / ctags
Last active January 28, 2021 06:52
git hooks for ctags. Place in `.git_template/hooks/` & run: `git config --global init.templatedir '~/.git_template'`
#!/bin/sh
set -e
PATH="$HOME/bin:/usr/local/bin:$PATH"
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