Skip to content

Instantly share code, notes, and snippets.

View mikemoate's full-sized avatar

Mike Moate mikemoate

View GitHub Profile
// Google Apps Script for use at https://script.google.com/
// Use timed triggers to run the desired functions on a regular schedule (e.g. every 12 hours)
// search is a gmail search string, keepDays is the last N days of threads to keep in Inbox
function gmailAutoArchive(search, keepDays) {
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-keepDays);
var threads = GmailApp.search(search);
@mikemoate
mikemoate / hide_admin.sh
Last active August 21, 2018 09:56
Hide Countingup administrator account on Mac
#!/bin/sh
set -x
sudo dscl . create /Users/administrator IsHidden 1
sudo mv /Users/administrator /var/administrator
sudo dscl . -create /Users/administrator NFSHomeDirectory /var/administrator
sudo dscl . -delete "/SharePoints/Administrator's Public Folder"
sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
@mikemoate
mikemoate / build_terraform.sh
Last active November 29, 2018 10:50
Build terraform and terraform-provider-terraform using forked terraform-provider-aws
# Pre-req: Have a working go install :-)
# Increase open files limit (macOS default of 256 is too low)
ulimit -n 10000
# Create paths
mkdir -p $GOPATH/src/github.com/terraform-providers/
mkdir -p $GOPATH/src/github.com/hashicorp/
# Get govendor and ensure $GOPATH/bin is in path
@mikemoate
mikemoate / boxstarter-script-work
Last active December 28, 2017 14:44
Boxstarter script to rebuild work machine, tested with Windows 7
# Bootstrap script for use with http://boxstarter.org/
# To use append the URL to the raw snippet to http://boxstarter.org/package/nr/url?
# (e.g. http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/mikemoate/0915288fff447b640cdb/raw/83b32099ea8f21d06604ae70003312b7492b8cd8/boxstarter-script-work)
# NOTE: You may see errors from some packages if you have already installed the software before using boxstarter.
# (some MSI's handle this badly and so exit with the wrong code, I've seen this for HipChat, RoyalTS, Virtualbox and Vagrant)
# Windows settings
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Set-TaskbarOptions -Size Small -Lock -Dock Bottom