Skip to content

Instantly share code, notes, and snippets.

View inversion's full-sized avatar

Andrew Moss inversion

View GitHub Profile
@inversion
inversion / autossh.init.sh
Created May 6, 2017 13:07 — forked from Clement-TS/autossh.init.sh
Autossh init script (Ubuntu) for ssh tunneling
#! /bin/sh
# author: Clément Désiles
# date: 01/08/2016
# source: https://gist.github.com/suma/8134207
# source: http://stackoverflow.com/questions/34094792/autossh-pid-is-not-equal-to-the-one-in-pidfile-when-using-start-stop-daemon
### BEGIN INIT INFO
# Provides: autossh
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
@inversion
inversion / terraform_resource_move.sh
Last active August 31, 2022 20:08
Update state after moving existing terraform resources to a module
#!/bin/bash
# 1. Fill in your module name
# 2. Run the terraform state mv commands from the output
# Pipeline steps:
# Generate plan
# Remove ANSI colour codes
# Generate state mv commands
# Strip any moves of numbered instances of a resource (i.e. from using count)
@inversion
inversion / gist:89f5dbff2bd5fef1018c07dba5d44849
Created June 2, 2016 10:38
List the drains for all your heroku apps
$(which ggrep || which grep) -oP '(^[a-z].+) ' | xargs -n 1 -I % sh -c 'echo % && heroku drains --app %;'
@inversion
inversion / list_heroku_apps.sh
Created June 2, 2016 10:31
List Heroku apps for piping to other commands
# ggrep to use GNU grep (from brew install grep on OSX)
heroku apps | $(which ggrep || which grep) -oP '(^[a-z].+) '
@inversion
inversion / gist:60a96ea3294e4ce35615
Last active November 30, 2015 21:18
TfL Hex Line Colours JSON
{
"Bakerloo": "#B36305",
"Central": "#E32017",
"Circle": "#FFD300",
"District": "#00782A",
"DLR": "#00A4A7",
"Hammersmith and City": "#F3A9BB",
"Jubilee": "#A0A5A9",
"Metropolitan": "#9B0056",
"Northern": "#000000",
@inversion
inversion / fdupes_delete_by_directory.py
Last active April 23, 2022 21:38
Delete fdupes duplicates by directory
#!/usr/bin/env python
import fileinput
import os.path as path
import re
class Processor(object):
def __init__(self):
self.condemnedFiles = []
@inversion
inversion / Hide_Facebook_Like_News.user.js
Last active August 29, 2015 14:05
Hide Facebook News feed entries which are random posts from friends' liked pages. They are matched by looking for the 'Like Page' button within a news feed entry. Instructions for adding user scripts to Chrome here: http://stackoverflow.com/questions/5258989/manually-adding-a-userscript-to-google-chrome or for Firefox use Greasemonkey. It's prob…
// ==UserScript==
// @name Hide Facebook 'Like' News
// @namespace uk.me.amoss
// @include /https?://www.facebook.com/.*/
// @version 1
// @grant none
// ==/UserScript==
// Configurable
var indicateInsteadOfHiding = false;
@inversion
inversion / export_ical_dates.py
Created October 28, 2012 22:48
Export dates from ical file (Python)
from icalendar import Calendar, Event
fp = open('basic.ics', 'r')
icalStr = "".join(line for line in fp)
fp.close()
cal = Calendar.from_ical(icalStr)
dates = []
# Add start datetimes of events to list for sorting