Skip to content

Instantly share code, notes, and snippets.

View themasch's full-sized avatar

Mark Schmale themasch

  • SMF GmbH & Co. KG
  • Germany
View GitHub Profile
@themasch
themasch / mkindex.sh
Last active December 17, 2015 13:10 — forked from tobybaier/mkindex.sh
Tweaked tobybaiers version of his mkindex.sh file a little bit. There might me room for more improvments but i'm by far not a sh wizard. (Add <ul>
#!/bin/sh
for i in $1/*.mp3;
do
file=$(basename $i)
echo "<li><audio preload='none' controls='controls'><source src='$file' type='audio/mp3'/></audio> <a href='$file'>download $file</a></li>" >> "$1/index.html";
done;
echo "<li><a href='$1'>$1</a></li>" >> index.html
HOST: mark_laptop Loss% Snt Last Avg Best Wrst StDev
1.|-- DD-WRT 89.2% 1000 2.2 2.8 2.0 16.5 2.4
2.|-- 10.139.64.1 0.0% 1000 14.1 12.6 7.3 101.2 6.1
3.|-- 1211F-MX960-02-ae12-1090. 0.0% 1000 15.0 15.8 7.4 98.2 10.9
4.|-- 7111A-MX960-02-ae9.fra.un 43.7% 1000 18.2 20.4 13.4 66.9 7.1
5.|-- 7111A-MX960-01-ae0.fra.un 53.1% 1000 15.5 20.6 13.3 79.6 9.3
6.|-- 84-116-131-149.aorta.net 58.9% 1000 15.6 20.8 13.3 78.7 8.8
7.|-- 84.116.132.193 0.0% 1000 19.8 20.2 13.8 73.2 6.2
8.|-- 84.116.132.178 43.1% 1000 18.3 20.9 13.8 97.0 8.3
9.|-- 4.68.62.237 0.7% 1000 20.7 22.5 14.2 105.8 11.7
% node_modules/matcha/bin/matcha benchmark/*.js
buffer vs string
30,483 op/s ⨠ buffer
16,052 op/s ⨠ string
decode to buffer
29,790 op/s ⨠ bencode
28,577 op/s ⨠ bencoding
26,095 op/s ⨠ dht_bencode
@themasch
themasch / gitlab
Created August 26, 2013 12:45
gitlab init script for gentoo
#!/sbin/runscript
# GitLab 6.0 init script for Gentoo Linux
# see https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md
GITLAB_BASE=/home/git/gitlabhq
GITLAB_USER=git
depend() {
need net
}
var xml = null, xsl = null;
function transformModern(type) {
return function() {
if(type == 'xml') {
xml = this.responseXML;
} else {
xsl = this.responseXML;
}
if(xml && xsl) {
@themasch
themasch / benchmark.js
Last active December 23, 2015 01:09
can someone explain those results?
var log_2 = Math.log(2);
suite('getTagLength', function() {
set('mintime', 1000);
bench('log(x) / log_2', function() {
return ~~(4 - Math.log(0x42 >> 4) / log_2)
})
bench('log(x) / log(2)', function() {
return ~~(4 - Math.log(0x42 >> 4) / Math.log(2))
})
bench('log(x) / 0.69..', function() {
@themasch
themasch / limited.js
Last active December 29, 2015 18:39
speed limited stream
var Stream = require('stream')
, util = require('util')
util.inherits(Limited, Stream.Transform)
function Limited( options ) {
if(!(this instanceof Limited)) {
return new Limited( options )
mod AMod {
pub enum FunnyEnum {
FirstVariant,
SecondVariant
}
}
mod AnotherMod {
use AMod::FunnyEnum;
@themasch
themasch / fast_concat.js
Created December 19, 2013 12:31
faster for me (v0.10.21)
function faster_concat(list)
{
var len = 0;
var listLen = list.length;
var offset = 0;
if(listLen === 1) {
return list[0]
}
for(var i=0;i<listLen;i++) {
@themasch
themasch / doc.md
Last active October 19, 2025 06:30
unofficial docs of the LoL Spectator API

REST Service for LoL spectators

This is an unofficial, uncomplete and (pretty sure) wrong documentation of the RESTful service which powers the League of Legends spectator mode.

This documentation is desgined to be community driven and should be extended by everyone. If you find things missing, add them please!

How it works

Riot's spectator mode works by requesting replay data via HTTP form a service. The data is split in chunks which usually contain about 30 seconds of gameplay. Additionally there are key frames which seem to contain more information then a single chunk. They seem to be used to support