Skip to content

Instantly share code, notes, and snippets.

View blalor's full-sized avatar

Brian Lalor blalor

View GitHub Profile
@blalor
blalor / 00README.md
Last active December 19, 2015 10:59
Vert.x SockJS memory leak diagnosis

Vert.x 1.3.1.final SockJS memory leak reproduction

This gist contains code to reproduce a memory leak in Vert.x when a SockJS client fails to disconnect cleanly. Also provided is a heap dump generated by the JVM on my laptop.

overview

Vert.x has a memory leak in its SockJS implementation. If a SockJS client connects, subscribes to EventBus messages (via the EventBus bridge), and then disappears without closing its connection, Vert.x will continue to accumulate pending writes until memory is exhausted. I have reproduced this with multiple transports. This scenario can happen in the real world if the client has a flaky network connection, or perhaps if the user merely puts their laptop to sleep.

requirements

@blalor
blalor / make_debs.sh
Last active December 17, 2015 10:49
Creates Debian packages for whisper, carbon, graphite-web. sources: * https://github.com/jbraeuer/graphite-debs
#! /bin/bash
#
# requires: fpm, python-pip
# gem install fpm
# apt-get install python-pip
#
set -e
@blalor
blalor / gist:5527096
Last active October 9, 2017 14:50
redhat → debian, arch rosetta stone
@blalor
blalor / README.md
Created January 26, 2013 14:36
Vert.x assembly for Maven

This is sample configuration to help you build a Vert.x "mod" archive. Put mod.xml into your project as src/main/assembly/mod.xml and the include the maven-assembly-plugin plugin config in your pom.xml. Also create src/main/resources/mod.json. When you run mvn package you will get target/${artifactId}-${version}-mod.zip which will contain all of your dependencies in ${groupId}.${artifactId}-v${version}/lib and ${groupId}.${artifactId}-v${version}/mod.json. Your application code and resources will be in ${groupId}.${artifactId}-v${version}/lib/${artifactId}-${version}.jar.

@blalor
blalor / RaphaelPoint.js
Last active October 11, 2015 02:18
Polymaps + Raphaël
function RaphPoint(paper, lat, lon) {
var that = this;
that._paper = paper;
that._lat = lat;
that._lon = lon;
that._map = null; // provided via map()
that._el = that._paper.circle(0,0,5)
.attr("fill", "#223fa3")
@blalor
blalor / gist:1371071
Created November 16, 2011 19:30
serving a (non-bare) git repo

on your computer

Make a note of your computer's IP address; your_ip.

Record the full path to your working copy, the parent of the .git directory; repo_path.

  1. cd <repo_path>
  2. touch .git/git-daemon-export-ok
@blalor
blalor / echotest.c
Created September 15, 2011 01:40
ATtiny85 pin crosstalk?
#include "soft_serial.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdbool.h>
static volatile uint8_t data_byte;
@blalor
blalor / HsqldbDAOImpl.java
Created February 15, 2011 16:08
Spring factory for Hsqldb URLs
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.dao.DataIntegrityViolationException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Date;
@blalor
blalor / target_device_size.sh
Created February 9, 2011 19:51
attempts to determine the total amount of flash in a given device
#!/bin/bash
set -e
MCU="$1"
cat <<-'EOF' > foo.c
#include <avr/pgmspace.h>
unsigned char mydata[64][16] PROGMEM =
{
@blalor
blalor / avr-size.sh
Created February 6, 2011 13:11
shows how much ram and program space is used by a compiled program
#!/bin/bash
# http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=792113#792113
# ".data+.bss+.noinit is the initial RAM allocation."
# AVR Memory Usage
# ----------------
# Device: atmega328p
#
# Program: 12580 bytes (38.4% Full)