Skip to content

Instantly share code, notes, and snippets.

Florian Bender fbender

Block or report user

Report or block fbender

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fbender
fbender / xml-to-har.py
Last active Aug 2, 2019 — forked from craigds/xml-to-har.py
Convert Internet Explorer 'capture network traffic' XML to a HAR file (by @craigds, force-unicode-version).
View xml-to-har.py
#!/usr/bin/env python
"""
Converts Internet Explorer 'capture network traffic' XML to a HAR file.
Turns out that XML is just a HAR file anyways, but in XML form. So this
just converts it to JSON, and Bob's your uncle.
Requires Python 2.7+ and LXML.
"""
from __future__ import unicode_literals
@fbender
fbender / bootlocal.sh
Last active Sep 22, 2015
Since Docker Machine (ex boot2docker) does (mostly) not persist changes in the VM file system, a Discourse installation is easily broken when the VM is restarted. This script prepares the boot2docker VM on each boot so handling Discourse in Docker Machine is easer.
View bootlocal.sh
#!/bin/sh
# mounts a folder to /var/discourse and installs bash (required by
# Discourse launcher script)
#
# HOWTO:
#
# 1. `docker machine ssh default` into the VM
# 2. `mkdir /mnt/sda1/var/discourse`
# 3. put this script at /var/lib/boot2docker/bootlocal.sh (this file
# will be persisted through reboots)
@fbender
fbender / mirror.sh
Last active Sep 1, 2015
`wget` script to mirror / backup a site and its subressources even if they span across different domains
View mirror.sh
#!/bin/bash
# `wget` script to mirror / backup a site and its subressources even if they span across different domains
#
# Author: Florian Bender
# Updated: 2015-08-31
# License: MIT
#
# Copyright (c) 2015 Florian Bender <fb+git@quantumedia.de>
#
@fbender
fbender / strawman-http-session-persistence.md
Last active Aug 29, 2015
[Strawman] Proposal for HTTP Session & User Identification (Persistence)
View strawman-http-session-persistence.md

Goals

  • specify use cases of session management and persistence
  • identify use cases of Cookies not concerning session management and persistence
  • allow a website to act as an identity broker for other websites, (optionally?) factoring in OpenID/Persona/etc.
  • replace Cookies with more user control and enhanced privacy (e.g. allow use case 1 below)
  • find a technical solution for the EU Cookie Law resp. its goal
  • propose HTTP Session & User Identification as an HTTP/2 extension (allow Cookie Upgrading?)
  • propose HTTP Session & User Identification as a replacement for Cookies in HTTP/3
  • the spec behaviour should be (largely) polyfill-able via Service Workers, i.e. user agent complies with spec even though it natively does not (requires complying server)
@fbender
fbender / sleep-timer.scpt
Last active Apr 15, 2019
AppleScript to put your Mac to sleep after X minutes, fading out the system volume shortly before sleeping. Can be turned into an app via the "Export" feature of the AppleScript Editor.
View sleep-timer.scpt
-- written by Florian Bender, 2015
-- based on work by Michael Wyszomierski <https://wysz.com/wyszdom/2009/06/simple-sleep-timer-with-applescript/>
-- license: Public Domain / CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
tell application "System Events"
set volumeSettings to get volume settings
set volumeValue to (output volume of volumeSettings)
set fadeTime to 10 -- time in seconds for fade change
set fadeChange to (volumeValue div fadeTime)
-- display alert "Volume: " & volumeValue & ", Delta: " & fadeChange
display dialog "Sleep time (min):" default answer "25"
View keybase.md

Keybase proof

I hereby claim:

  • I am fbender on github.
  • I am fbender (https://keybase.io/fbender) on keybase.
  • I have a public key whose fingerprint is 65AE C8A5 9890 99CC 951C 8CC2 38A5 7375 EFD0 B4D8

To claim this, I am signing this object:

@fbender
fbender / diff-toggler.js
Last active Aug 29, 2015
SPAN toggler with JSON import / export
View diff-toggler.js
// License: MIT
// Wrote this to help me with merging two spreadsheets using a WinMerge diff report. This is in no way optimized.
// The report HTML only requires adding the JS and desired CSS for the toggled state, e.g.:
// <style>span.toggled{background-color:lightcyan !important;}</style>
// Gecko-based browsers with context menu support have "Import" and "Export" items added to their context menu.
"use strict";
function getNodes(selector) {
var nodelist = document.querySelectorAll(selector);
@fbender
fbender / fortran-num.m
Last active Aug 29, 2015
Validate a Fortran number literal in Matlab (Snippet).
View fortran-num.m
validInt = '^\d+$';
ri = regexp(value, validInt);
if size(ri, 2) == 1
% integer
end
validDouble = '^(\d+(\.\d*)?|\.\d+)[dD][+-]?\d{1,3}$';
rd = regexp(value, validDouble);
@fbender
fbender / base64.m
Last active Dec 25, 2016
Base64 for MATLAB
View base64.m
function b64 = base64( str )
%BASE64 Encode string (array of chars) into Base64
% Currently seems to fail for any input > 4 characters. :(
%% Settings
% Valid output codes to choose from.
base64Chars = char([65:90, 97:122, 48:57, 43, 47]); % +/ per RFC 2045 et al.
%base64UrlChars = char([65:90, 97:122, 48:57, 45, 95]); % -_ per RFC 4648 §4
base64PadChar = '=';
@fbender
fbender / netinfo-if-network-link.md
Last active Aug 29, 2015
W3C/netinfo: the `NetworkLink` interface
View netinfo-if-network-link.md
You can’t perform that action at this time.