Skip to content

Instantly share code, notes, and snippets.

@BastiTee
BastiTee / splitIcoFile.js
Created May 25, 2016 07:22
Experiments on reading and extracting images from ICO files
splitIcoFile = function( inputFilePath ) {
const fs = require("fs");
const path = require("path");
const DFILE = fs.openSync(inputFilePath, 'r');
const BASENAME = path.basename(inputFilePath, ".ico");
const HEADER_SIZE = 6;
const IMAGE_HEADER_SIZE = 16;
@BastiTee
BastiTee / background-worker-with-promises.js
Created June 7, 2016 11:36
A background FIFO job queue and worker function for node.js
/*
* We have a worker function that does some expensive task, e.g., an
* I/O task or something else.
*/
worker = function ( jobId ) {
// we need to put it into a new promise object
return new Promise(function(resolve, reject) {
// It will take something between 1 and 2 seconds.
@BastiTee
BastiTee / decrypt-laterpay-paywall-spon
Last active December 5, 2016 12:26
Script to decrypt SPON / SPIEGEL Plus articles protected by LaterPay.net (execute in browser nav bar or create a bookmark with code as target)
javascript:void function(){var e=function(t,o){if(0>o)return e(t,o+26);for(var n="",d=0;d<t.length;d++){var r=t[d],c=t.charCodeAt(d);c>=33%26%26256>=c%26%26(r=String.fromCharCode(c-1)),n+=r}return n};$(".obfuscated-content").removeClass("obfuscated-content"),$(".laterpay-under-overlay").next().removeClass(),objs=$(".obfuscated");for(var t=0;t<objs.length;++t)decoded=e(objs[t].innerText),node=$(objs[t]),node.length>0%3F(contents=node.contents(),contents.each(function(t,o){decoded=e($(o).text()),$(o).is("a")||(o.textContent=decoded)})):(decoded=e(node.text()),node.text(decoded))}();
@BastiTee
BastiTee / install.sh
Last active January 2, 2018 13:21
Find all twitter accounts you follow, that are not in any of your lists and listed accounts you don't follow using https://github.com/sferik/t
#!/bin/bash
[ $( whoami ) != "root" ] && {
echo "Run with sudo."
exit 1
}
apt install ruby-dev
gem install t
@BastiTee
BastiTee / t-nobody-cares.sh
Created March 10, 2017 13:53
Remove all of your tweets from the command line using https://github.com/sferik/t
#!/bin/bash
[ -z $( command -v t ) ] && {
echo "'t' gem (https://github.com/sferik/t) not installed."
exit 1
}
[ -z "$1" ] && {
echo "No twitter handle (e.g. @myacc) provided."
exit 1
}
@BastiTee
BastiTee / create-combined-pa-sink.sh
Created March 18, 2017 11:59
Create a combined device for all available pulseaudio sinks
#!/bin/bash
sinkname="combined"
# check root
[ $( whoami ) == "root" ] && {
echo "-- please run as regular user."
exit 1
}
@BastiTee
BastiTee / ._d3v4_donut_chart_with_externalized_legend
Last active November 7, 2017 13:20
d3v4: Donut chart with externalized legend
d3v4: Donut chart with externalized legend
@BastiTee
BastiTee / ._d3v3_chord_diagram
Last active July 24, 2017 18:02
d3v3: Chord diagram
d3v3: Chord diagram
@BastiTee
BastiTee / ._d3v4_chord_diagram
Last active July 24, 2017 18:02
d3v4: Chord diagram
d3v4: Chord diagram
@BastiTee
BastiTee / ._d3v4_packed_bubbles
Last active January 10, 2018 08:04
d3v4: Packed bubbles
d3v4: Packed bubbles