Skip to content

Instantly share code, notes, and snippets.

/^([\\(+. ]*64[\\)-. ]*|[+ ]*|[+-. ]*)/
^([\\(+. ]*64[\\)-. ]*|[+ ]*|[+-. ]*)
@heymatthew
heymatthew / Caddyfile
Last active August 4, 2019 19:23
Docker for CoNZealand
members.conzealand.nz {
log stdout
errors stdout
proxy / members_production:3000 {
transparent
}
}
members-staging.conzealand.nz {
log stdout
@heymatthew
heymatthew / server.go
Created March 20, 2018 06:44
WIP Counter Webserver
package main
import (
"fmt"
"image"
_ "image/png"
"net/http"
"os"
"regexp"
"sync"
@heymatthew
heymatthew / batch-delete-gmail-emails.js
Last active August 14, 2023 19:55 — forked from gene1wood/batch-delete-gmail-emails.js
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
// This script, when used with Google Apps Scripts will delete 500 emails and can be triggered to run every minute without user interaction enabling you to bulk delete email in Gmail without getting the #793 error from Gmail.
// Configure the search query in the code below to match the type of emails you want to delete
// Browser to https://script.google.com/.
// Start a script and paste in the code below.
// After you past it in, save it and click the little clock looking button. This is for your triggers. You can set up how frequently you want the script to run (I did mine for every minute).
// Source : # https://productforums.google.com/d/msg/gmail/YeQVDuPIQzA/kpZPDDj8TXkJ
function batchDeleteEmail() {
var batchSize = 100 // Process up to 100 threads at once
@heymatthew
heymatthew / gpg_folder.rb
Created June 3, 2017 03:26
Script to quickly encrypt or decrypt whole directories
#!/usr/bin/env ruby
# gpg_folder - Script to quickly tar, compress and encrypt directories
# Copyright (C) 2017 Matthew B. Gray
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@heymatthew
heymatthew / latest_ruby.rb
Created November 20, 2016 18:44
Quickly find if you're running the latest rbenv
#!/usr/bin/env ruby
def get_lines(output)
output.lines.map(&:chomp).map(&:strip)
end
available = get_lines(`rbenv install -l`).select { |v| v.match(/^[\d\.]+$/) }
installed = get_lines(`rbenv versions`)
puts

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow: git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

Say that server, or Github, goes down for a bit.

@heymatthew
heymatthew / proxy.js
Created June 19, 2014 22:46
Simple Reusable Proxy with Partial Application
var express = require('express');
var extend = require('extend');
var q = require('q');
var request = q.denodeify( require('request') );
var makeRequester = function makeRequester(opts) {
return function requester(path) {
var retrieveResponse =
request({
'strictSSL': opts.selfsigned !== true, // for snakeoil certs
@heymatthew
heymatthew / gist:2590df4124b4d474d37a
Created May 20, 2014 00:04
Help?! Compressed spooler :(
[ root@283615a69847:/data ]$ cat /data/logstash.conf
input {
stdin {}
}
output {
stdout {
codec => compress_spooler {
compress_level => 6
spool_size => 50