Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Send TCP dumps to S3
die() { status=$1; shift; echo "FATAL: $*"; exit $status; }
# Replace with actual bucket name
BUCKET_NAME="my-bucket";
# Get instance id
INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`"
# Init temp file
@etyp
etyp / example.js
Last active November 17, 2018 20:43
React on escape outside with mousedown support
import EscapeOutside from "react-escape-outside"
class MyComponent extends Component {
constructor() {
super()
this.state = {
isOpen: false,
}
mainWindow = new BrowserWindow({
width: size.width < 1600 ? size.width - 50: size.width - 100,
height: size.width < 1600 ? size.height - 50: size.height - 100,
title: 'Hive: Home for busy teams',
/**
* Disable Electron's Node integration so that browser dependencies like `moment` will load themselves
* like normal i.e. into the window rather than into modules, and also to prevent untrusted client
* code from having access to the process and file system:
* - https://github.com/atom/electron/issues/254
* - https://github.com/atom/electron/issues/1753
@etyp
etyp / aws-sns-subscription.js
Last active April 9, 2018 23:38
Sample files for subscribing to SNS and starting graceful shutdown on given AWS instance using mongo (since load balancer will not route predictably)
import xml2js from 'xml2js';
import AWS from 'aws-sdk';
import { Meteor } from 'meteor/meteor';
import { HTTP } from 'meteor/http';
import { Picker } from 'meteor/meteorhacks:picker';
import { DeathrowInstances } from '/imports/startup/server/ddp-graceful-shutdown';
import { errorResponse } from '/imports/api/our-api/server/route-helpers.js';
import './middleware';
const SNS_PROTOCOL = Meteor.isDev() ? 'http' : 'https';
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
const EVENT_LOOP_TIME = 1000;
const connectedUsers = {}; // Structure is { userId: socket }
import { Meteor } from 'meteor/meteor';
const publishHooks = {};
const registerPublishHook = (publishNames, position, fn) => {
if (!(publishNames instanceof Array)) {
publishNames = [publishNames];
}
publishNames.forEach((publishName) => {
import { Meteor } from 'meteor/meteor';
const methodHooks = {};
const registerMethodHook = (methodNames, position, fn) => {
if (!(methodNames instanceof Array)) {
methodNames = [methodNames];
}
for (let i = 0; i < methodNames.length; i++) {
@etyp
etyp / .block
Last active July 11, 2017 12:35
city temps over time (lines/path)
license: mit
@etyp
etyp / .block
Created July 11, 2017 12:26
pie example
license: mit
@etyp
etyp / .block
Last active July 11, 2017 12:14
city temps over time
license: mit