Skip to content

Instantly share code, notes, and snippets.

View mfn's full-sized avatar

Markus Podar mfn

View GitHub Profile
@mfn
mfn / README.md
Last active April 7, 2022 20:05
Generated munin graph from HAR file

Parses a HAR archive (e.g. generated with https://gist.github.com/mfn/5111680 ) and generate three type of graphs: hosts, mimetypes and timings.

Requires environment variables to be used:

  • HAR pointing to the HAR file
  • SECTION to choose between HOSTS, MIMETYPES and TIMINGS
  • GRAPH_CATEGORY,
  • GRAPH_TITLE

To use the plugin usually requires creating a symlink for each graph type you want and configuring them via plugin-conf.d/.

@mfn
mfn / netsniff.js
Last active October 30, 2018 13:18
netsniff.js from phantomjs, added DOMContentLoaded
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function () {
function pad(n) { return n < 10 ? '0' + n : n; }
function ms(n) { return n < 10 ? '00'+ n : n < 100 ? '0' + n : n }
return this.getFullYear() + '-' +
pad(this.getMonth() + 1) + '-' +
pad(this.getDate()) + 'T' +
pad(this.getHours()) + ':' +
pad(this.getMinutes()) + ':' +
pad(this.getSeconds()) + '.' +
@mfn
mfn / http_responsetime_detailed.rb
Last active December 12, 2015 08:49 — forked from anonymous/http_responsetime_detailed.rb
Munin script written in Ruby to get more details about a single HTTP connection, namely: DNS lookup time, connect time, send request time, wait for first byte of response and response time.
#!/usr/bin/env ruby
require 'uri'
require 'socket'
if ARGV[0] and ( ARGV[0] == "-h" or ARGV[0] == "--help" )
puts "#{$0} [-h|--help] [config]"
puts "Munin plugin to measure individual HTTP timings"
puts " --help,-h Show this help"
puts " config Prints the configuration for munin"
@mfn
mfn / uri_hash.rb
Created May 21, 2011 20:18
Have an uri give me a hash with all it's components
require 'uri'
require 'pp'
uri = URI.parse "http://foo/bar?baz&frob#blamp"
pp uri.component.each_with_object({}).find_all { |c,h| h[c] = uri.send(c) }
require 'find'
dirs_to_scan = [ '.' ]
dirs_to_scan = ARGV if ARGV.length > 0
dirs_to_scan.each do |dir|
Find.find( dir ) do |entry|
if FileTest.directory?(entry) && FileTest.directory?(entry + "/.svn")
puts entry
Find.prune
@mfn
mfn / find-empty-dir-in-svn.rb
Created March 3, 2011 00:02
Find all empty directories in an svn checkout
require 'find'
dir_to_scan = '.'
dir_to_scan = ARGV[0] if ARGV.count == 1
dirs = []
# First collect all directories, but ignore anything with .svn in it
Find.find( dir_to_scan ) do |entry|
next if entry =~ /\.svn/