Skip to content

Instantly share code, notes, and snippets.

Kane kane-c

  • Australia
View GitHub Profile
kane-c / GoogleMeet.bsstrategy
Created Sep 4, 2018
BeardedSpice strategy to un/mute Google Meet via media keys/headphones button
View GoogleMeet.bsstrategy
// GoogleMeet.js
// BeardedSpice
// Created by @kane-c.
// Copyright (c) 2015-2017 GPL v3
// We put the copyright inside the plist to retain consistent syntax coloring.
kane-c / GoogleHangouts.bsstrategy
Last active Sep 4, 2018
BeardedSpice strategy to un/mute Google Hangouts via media keys/headphones button
View GoogleHangouts.bsstrategy
// GoogleHangouts.js
// BeardedSpice
// Created by @kane-c.
// Copyright (c) 2015-2017 GPL v3
// We put the copyright inside the plist to retain consistent syntax coloring.
kane-c /
Created May 16, 2017
Upgrade Brew and all installed packages including casks, then clean up
brew-upgrade() {
(set -x; brew update;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
casks=( $(brew cask outdated) )
for cask in ${casks[@]}
kane-c /
Last active Jul 21, 2017
Postgres backup script to be used with Docker/Dokku
#!/usr/bin/env sh
# Usage: database username container-name drive-folder-id gpg-recipient
# Requires gdrive:
# wget '' -O /usr/local/bin/gdrive
# chmod +x /usr/local/bin/gdrive
# Store Postgres credentials in `.pgpass` and gdrive configuration in `.gdrive.conf`
# Ensure GPG is configured too
timeslot=`date '+%Y%m%d%H%M'`
View Preferences.sublime-settings
"color_scheme": "Packages/User/SublimeLinter/base16-ocean.dark (SL).tmTheme",
"detect_indentation": true,
"dictionary": "Packages/Language - English/en_GB.dic",
"ensure_newline_at_eof_on_save": true,
kane-c /
Created Jun 29, 2016
Update and clean stuff for macOS
# Usage: . ./ (so that upgrade_oh_my_zsh works)
echo 'Updating brew'
brew update
brew upgrade --all
brew cleanup
echo 'Updating shell'
echo 'Updating Docker and its images'
dinghy upgrade
kane-c /
Created Jun 21, 2016
Create OS level notifications via Python through a web server
#!/usr/bin/env python
Simple server to create OS notifications.
Example usage with Django:
To get a notification when the Django development server is running or has just
reloaded in resoonse to a code change, append this to ``:
import requests
kane-c / git-bump
Last active Aug 18, 2016
Handy git shortcut scripts
View git-bump
#!/bin/sh -e
# Semantic versioning automatic bump and optional push
# First, add this to your `.gitconfig`
# [alias]
# max-tag = !echo $((echo $(git config --get bump.prefix)0.0.0 && git tag -l "$(git config --get bump.prefix || echo)*.*.*") | (git config --get bump.prefix && sed "s/$(git config --get bump.prefix)//g" || cat) | sort -s -t . -k 1,1n -k 2,2n -k 3,3n | tail -n 1)
# Then add this file (chmod +x) to your PATH.
# Optionally add a tag prefix (e.g. `v`) globally or per repo:
# git config --global --add bump.prefix v
kane-c / bookmarklet.js
Last active Apr 21, 2016
Responsive resizer bookmarklet
View bookmarklet.js
javascript:void((function(d)%7Bif(self!%3Dtop%7C%7Cd.getElementById(%27toolbar%27)%26%26d.getElementById(%27toolbar%27).getAttribute(%27data-resizer%27))return false%3Bd.write(%27<!DOCTYPE HTML><html style%3D"opacity:0%3B"><head><meta charset%3D"utf-8"/></head><body><a data-viewport%3D"320x480" data-icon%3D"mobile">iPhone, iPod Touch</a><a data-viewport%3D"320x568" data-icon%3D"mobile" data-version%3D"5">iPhone 5/5c/5s/SE</a><a data-viewport%3D"375x667" data-icon%3D"mobile" data-version%3D"6">iPhone 6/6S</a><a data-viewport%3D"414x736" data-icon%3D"mobile" data-version%3D"6%2B">iPhone 6/6S Plus</a><a data-viewport%3D"768x1024" data-icon%3D"tablet">iPad</a><a data-viewport%3D"1024x1366" data-icon%3D"tablet" data-version%3D"Pro">iPad Pro</a><a data-viewport%3D"1280×720" data-icon%3D"display" data-version%3D"720">720p</a><a data-viewport%3D"1920×1080" data-icon%3D"display" data-version%3D"1080">1080p</a><a data-viewport%3D"2560×1440" data-icon%3D"display" data-version%3D"1440">1440p</a><script src%3D"http://lab.
kane-c / git-grep-all
Created May 26, 2015
Search all git repos in a directory
View git-grep-all
bold=$(tput bold)
normal=$(tput sgr0)
for project in $(find * -type d -maxdepth 0)
cd $project
if [ -d ".git" ]
You can’t perform that action at this time.