Skip to content

Instantly share code, notes, and snippets.

View suprememoocow's full-sized avatar

Andrew Newdigate suprememoocow

View GitHub Profile
var TodoList = app.LiveCollection.extend({
...
});
@suprememoocow
suprememoocow / play.yml
Created October 9, 2014 15:10
Use Ansible to Manage Cloudwatch Volume Alarms in AWS EC2
---
- action: ec2_facts
- name: "list volumes"
command: 'aws ec2 describe-volumes --filter Name=attachment.instance-id,Values={{ ansible_ec2_instance_id }}'
register: ec2_volumes_output
- set_fact:
ec2_volumes: "{{ ec2_volumes_output.stdout | from_json }}"
@suprememoocow
suprememoocow / DataBounce.js
Created December 16, 2011 15:12
DataBounce: server-side workaround for data: url problems in Internet Explorer. Full example at https://github.com/suprememoocow/databounce
var DataBounce = function(dataUrl, config) {
config = config || {};
var defaults = {
formName: "exportform",
filename: "",
exportFrameName: "exportFrame",
postUrl: "dataBounce"
};
@suprememoocow
suprememoocow / (snippet) web.xml
Created January 6, 2012 13:37
PrecompressedStaticServlet: serves pre-compressed resource files from an Http Servlet container if they exist.
<web-app>
<!-- ... -->
<servlet>
<servlet-name>compressionHandlingDefaultServlet</servlet-name>
<servlet-class>com.barclayswealth.fsvoc.presentation.PrecompressedStaticServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
@suprememoocow
suprememoocow / winston-logrotate.js
Last active May 11, 2019 01:19
A function for reopening a winston File logging transport post logrotation on a HUP signal. To send a HUP to your node service, use the postrotate configuration option from logrotate. `postrotate kill -HUP ‘cat /var/run/mynodeservice.pid‘`
function reopenTransportOnHupSignal(fileTransport) {
process.on('SIGHUP', function() {
var fullname = path.join(fileTransport.dirname, fileTransport._getFile(false));
function reopen() {
if (fileTransport._stream) {
fileTransport._stream.end();
fileTransport._stream.destroySoon();
}
@suprememoocow
suprememoocow / prometheus_exporter_dashboard.json
Created October 13, 2020 07:45
Dashboard for the Victron Exporter for Prometheus
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",

Keybase proof

I hereby claim:

  • I am suprememoocow on github.
  • I am suprememoocow (https://keybase.io/suprememoocow) on keybase.
  • I have a public key ASArGob_MP2p2mMUwBx511-U9kESxEi7i7Oaci1KVBhjXQo

To claim this, I am signing this object:

@suprememoocow
suprememoocow / raid.yml
Created April 28, 2014 16:32
Setup and initialise a RAID10 array of EC2 EBS volumes using an Ansible playbook
- action: ec2_facts
- apt: pkg=lvm2 state=present
- apt: pkg=mdadm state=present
- pip: name=boto state=latest
- ec2_vol: instance="{{ hostvars[inventory_hostname]['ansible_ec2_instance-id'] }}"
volume_size=20
device_name="{{ item }}"
@suprememoocow
suprememoocow / intercept.js
Created May 29, 2012 09:53
AJAX timing interceptor: this class intercepts all AJAX calls and records the time taken for the HTTP request to complete. These timings are posted back to the server in batches, if there are any to send, about every two seconds. Tested in Firefox, Chrome
(function(XHR) {
"use strict";
var stats = [];
var timeoutId = null;
var open = XHR.prototype.open;
var send = XHR.prototype.send;
@suprememoocow
suprememoocow / busted-output.txt
Last active July 26, 2023 20:54
Testing Redis Lua Scripts
●●
2 successes / 0 failures / 0 errors / 0 pending : 0.008108 seconds