Skip to content

Instantly share code, notes, and snippets.

View richardmcmillen's full-sized avatar

Ricky McMillen richardmcmillen

  • Wellington, New Zealand
View GitHub Profile
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'benchmark-ips'
end
require 'benchmark/ips'
@richardmcmillen
richardmcmillen / browser.atlassian-wiki.talon
Created May 8, 2022 02:13
Talon voice commands for Jira and Atlassian Wiki markup
tag: browser
browser.host: companyname-jira.atlassian.net
browser.host: companyname-confluence.atlassian.net
-
# https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html
(bull | bullet | bulleted) list: "- "
(number | numbered) list: "# "
bold: key(cmd-b)
(italic | italicize): key(cmd-i)
(under | underline): key(cmd-u)
@richardmcmillen
richardmcmillen / timestamp.sh
Last active June 1, 2021 11:55
Add a timestamp (obtained from EXIF data) to photos (identified by jpg,gif,png,jpeg extension) in the current directory in a new folder named "output". Requires imagemagick
#!/usr/bin/env bash
# Usage:
# !!! BACKUP ALL PHOTOS BEFORE USING :) !!!
# Add this script as a file in `/usr/local/bin`, call it timestamp.
# Make it executable, run `chmod +x /usr/local/bin/timestamp`
# In terminal change into the directory which contains photos. `cd ~/Photos/blah`
# Run the script `timestamp`.
# It will create an `output` folder in the current directory and place all modified photos inside it.
set -euo pipefail
@richardmcmillen
richardmcmillen / clear_down_ibdata1
Last active December 21, 2015 09:30
Clear down ibdata1 MySQL log files on Ubuntu
#!/bin/bash
# This script just automates the steps shown in highest rated StackExchange asnwer at the time:
# http://dba.stackexchange.com/questions/8982/what-is-the-best-way-to-reduce-the-size-of-ibdata-in-mysql#answer-8983
# Learn more about the ibdata1 file:
# https://www.percona.com/blog/2013/08/20/why-is-the-ibdata1-file-continuously-growing-in-mysql/
RESET="\033[0m"
RED="\e[31m"
@richardmcmillen
richardmcmillen / pre-commit
Created November 11, 2014 16:22
Avoid committing changes to the config/database.yml file. Save this in the hooks directory of your project .git/hooks/pre-commit
#!/bin/sh
# Abort commit if there are changes to the database.yml
echo "$(tput setaf 3)Checking for changes to config/database.yml$(tput sgr 0)"
if git diff --name-status --cached | grep -q 'config/database.yml'
then
echo "pre-commit: $(tput setaf 1)Aborting commit due to changes in the database.yml$(tput sgr 0)"
exit 1
else
@richardmcmillen
richardmcmillen / repo
Last active December 20, 2015 20:28
Open a file or commit from the current repository on GitHub.
#!/bin/bash
# Open file or commit on Github
function usage {
ME=${0##*/}
echo "Options:"
echo " -f Path to file"
echo " -b Branch to target"
echo " -c Commit to show"
echo ""