Skip to content

Instantly share code, notes, and snippets.

from aws_cdk import (
aws_route53 as route53,
aws_route53_targets as targets,
aws_cloudfront as cloudfront,
aws_cloudfront_origins as origins,
aws_certificatemanager as certificatemanager,
Stack
)
from constructs import Construct
@mrowe
mrowe / stopinator.rb
Created May 9, 2013 02:07
The genesis of the zombie apocalypse.
def ec2
Fog::Compute.new(:provider => 'AWS',
:aws_secret_access_key => ENV['EC2_SECRET_KEY'],
:aws_access_key_id => ENV['EC2_ACCESS_KEY'])
end
def tenured? (instance)
instance.created_at && (instance.created_at < Chronic.parse('50 minutes ago'))
end
@mrowe
mrowe / folder-sizer.gs
Created July 27, 2022 09:54
Get the total size of a folder in Google Drive
// adapted from https://webapps.stackexchange.com/a/123681
function doCount() {
var FOLDER_ID = "<folder_id>";
Logger.log("Getting folder sizes...");
var totalSize = countFolder(DriveApp.getFolderById(FOLDER_ID), "/");
Logger.log("Folder Sizes Report completed");
Logger.log(Utilities.formatString("TOTAL SIZE: %12.2f MB", (totalSize / (1024 * 1024))));
@mrowe
mrowe / skeleton
Created July 16, 2014 06:55
init.d skeleton
#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@mrowe
mrowe / better-annotated.s
Last active October 16, 2021 00:20
clang compiled to ARM assembler
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 11, 0 sdk_version 11, 3
.globl _main ; -- Begin function main
.p2align 2
_main: ; @main
Lfunc_begin0:
.file 1 "/Users/mrowe/src" "better.c"
.loc 1 4 0 ; better.c:4:0
.cfi_startproc
; %bb.0:
@mrowe
mrowe / harvard-deakin-university-2020.csl
Last active October 2, 2021 07:18
Zotero style definition for the 2020 version Deakin Australian Harvard (incomplete)
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-GB">
<info>
<title>Deakin University - Harvard 2020</title>
<id>http://www.zotero.org/styles/harvard-deakin-university-2020</id>
<link href="http://www.zotero.org/styles/harvard-deakin-university" rel="self"/>
<link href="http://www.zotero.org/styles/harvard-the-university-of-melbourne" rel="template"/>
<link href="http://www.deakin.edu.au/students/studying/study-support/referencing/harvard" rel="documentation"/>
<author>
<name>simtyrell</name>
@mrowe
mrowe / .xmobarrc
Created June 10, 2017 00:52
Xmonad/Xmobar config
Config { font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
, borderColor = "black"
, border = TopB
, bgColor = "black"
, fgColor = "grey"
, alpha = 255
, position = TopW L 100
, allDesktops = True
, overrideRedirect = True
, commands = [
@mrowe
mrowe / wait-for.clj
Last active July 20, 2020 18:09
A first attempt at a polling loop in clojure...
;; Based on a queue polling function from Chas Emerick's bandalore:
;; https://github.com/cemerick/bandalore/blob/master/src/main/clojure/cemerick/bandalore.clj#L124
(defn wait-for
"Invoke predicate every interval (default 10) seconds until it returns true,
or timeout (default 150) seconds have elapsed. E.g.:
(wait-for #(< (rand) 0.2) :interval 1 :timeout 10)
Returns nil if the timeout elapses before the predicate becomes true, otherwise
@mrowe
mrowe / debug.md
Created May 17, 2020 01:07
Debugging weird prod problem

We were in the final push towards a major release of a large public-facing J2EE application when I was assigned The Defect. The application, which had been working quite well in functional test environments (all things considered), suddenly stopped when deployed to SIT. Well, it started up ok, but if you tried to log in, you were faced with a long wait. Very long.

It was exactly the same code that had been working in other environments, but the difference in SIT, of course, was that debug logging was turned off.

After a day of changing logging levels, bouncing WebSphere servers and tracing debug logging code, I stumbled across this gem:

    Iterator i = formBean.getKeys();
    while (i.hasNext()) {
 if (LOG.isDebugEnabled()) {
Title Notes Username Password URL Type
AirBNB p4ssw0rd Password
Airbnb user p4ssw0rd https://login.airbnb.com Login
PayPal user p4ssw0rd https://www.paypal.com Login
Bendigo Bank user p4ssw0rd Login
Quantium PSeeker Replica (read only) quantium p4ssw0rd Database
irc mrowe p4ssw0rd Server
Disney user p4ssw0rd Login
Zoho user p4ssw0rd https://accounts.zoho.com Login
Bookbaby user p4ssw0rd https://www.bookbaby.com/myaccount/login.aspx Login