Skip to content

Instantly share code, notes, and snippets.

View hassy's full-sized avatar
🐢
Working through a massive backlog of issues, PRs and emails. Send coffee.

Hassy Veldstra hassy

🐢
Working through a massive backlog of issues, PRs and emails. Send coffee.
View GitHub Profile
// Start with an empty db.
URL with("http://localhost:8080/?action=select&op=pairs") fetch
// ==> []
URL with("http://localhost:8080/dir1?action=mkdir") fetch
URL with("http://localhost:8080/dir1/?action=write&key=k1") post("k1_val")
URL with("http://localhost:8080/?action=select&op=pairs") fetch
// ==> [["dir1",{"k1":"k1_val"}]]
// Now create a key and an empty container
@hassy
hassy / gist:429949
Created June 8, 2010 12:35
Excel Quine
=SUBSTITUTE("=SUBSTITUTE(@,CHAR(64),CHAR(34)&@&CHAR(34))",CHAR(64),CHAR(34)&"=SUBSTITUTE(@,CHAR(64),CHAR(34)&@&CHAR(34))"&CHAR(34))
@hassy
hassy / speed up a video
Created June 21, 2010 17:13
Create a time-lapse video / speed up a video
#!/bin/bash
# Usage: speedup.sh <input> <output> <frames>
# frames is the number of frames per second (1 = fastest, 10 is slower etc)
mkdir speedup_tmp
ffmpeg -i $1 -r $3 -f image2 speedup_tmp/%05d.png
ffmpeg -i speedup_tmp/%05d.png -b 512000 $2
rm -rf ./speedup_tmp
Renderer: NVIDIA GeForce 9400M OpenGL Engine
- RGBA bits: 8880
- Depth bits: 24
- Stencil bits: 8
diffuse textured
diffuse
solid
outline
Loaded 110380 tris, 62988 verts, 19369 edges
Add
Renderer: NVIDIA GeForce 9400M OpenGL Engine
- RGBA bits: 8880
- Depth bits: 24
- Stencil bits: 8
diffuse textured
diffuse
solid
outline
GL Error: INVALID_OPERATION
- Object.run (https://tinkercad.com/stacktrace.js:74:14)
web: node server.js
@hassy
hassy / prosody-load-test.md
Last active January 10, 2016 19:52
Quick Prosody load-test

Prosody XMPP Performance Test

Results of a quick performance test for Prosody - a popular open-source XMPP server.

Server

Prosody v0.7 with libevent enabled

Lua 5.1

Problem: I needed to test some code that would auto-reconnect to a remote service, without being able to stop/restart the service.

Solution: tcpkill

For example:

apt-get install dsniff

sudo tcpkill -i eth0 port 27017 # no more outgoing connections to Mongodb

{
"config": {
"target": "ws://localhost:8080",
"phases": [
{"duration": 120, "arrivalRate": 10}
]
},
"scenarios": [
{
"engine": "ws",
@hassy
hassy / minigun-core-example.js
Last active January 9, 2016 13:16
Example for using minigun-core
var minigun = require('minigun-core').runner;
var script = require('./my-test-script.json');
var ee = minigun(script);
ee.on('phaseStarted', function(spec) {}); // fired when a phase begins; spec is the phase definition (from the script)
ee.on('phaseCompleted', function(spec) {}); // fired when a phase completes; spec is as above
ee.on('stats', function(stats) {}); // fired every 10s; stats is a JSON object with stats for the previous 10s
ee.on('done', function(report) {}); // fired when the test completes, report is a JSON object with all stats
ee.run();