Skip to content

Instantly share code, notes, and snippets.

@phiresky
phiresky / copy-from-time-machine.sh
Last active January 1, 2016 18:19 — forked from vjt/copy-from-time-machine.sh
Copy data from a Time Machine volume mounted on a Linux box. made compatible with non-english system languages
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
@phiresky
phiresky / compiled
Last active October 22, 2017 10:21
export ICS file from KIT Webinscribe. paste into web console
var a="BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//phiresky.de//tools\n",b=$("table.piTable>tbody").children;
for(i=0;i<b.length;i++)var c=b[i].children,d=c[0].textContent.trim(),e=c[1].textContent,f=/Tutorium (..) ([-0-9:]+) (.*)/.exec(c[2].textContent.trim()),g=f[1],h=f[2],k=f[3],g=["Mo","Di","Mi","Do","Fr"].indexOf(g),h=/(..):(..)-(..):(..)/.exec(h),l="201410"+(27+g)+"T"+h[1]+h[2]+"00",m="201410"+(27+g)+"T"+h[3]+h[4]+"00",a=a+("BEGIN:VEVENT\nLOCATION:"+k+"\nSUMMARY:Tutorium für "+d.replace(/,/g,"\\,")+"\nDESCRIPTION:"+e+"\nDTSTART:"+l+"\nDTEND:"+m+"\nRRULE:FREQ=WEEKLY;COUNT=16\nEND:VEVENT\n");
var a=a+"END:VCALENDAR\n",n=document.body.appendChild(document.createElement("a"));n.href=URL.createObjectURL(new Blob([a],{type:"text/calendar"}));n.download="Tutorien WS2014 "+$("h3").textContent.match(/.{6}(.*)/)[1]+".ics";n.click();
{
"help": "{n} is replaced with the sheet number, n represents the padding of the number e.g. ({2} => (01,02,03))",
"name": "KIT Inf SS2014",
"uebs": {
"RO": {
"begin": "2014-04-28 13:15",
"every": 7,
"url": "http://ti.ira.uka.de/TI-2/Uebungen/blatt{2}.pdf",
"info": "Keine Pflicht aber Bonuspunkte auf die Klausur"
},
{
"name": "KIT Inf WS2014",
"uebs": {
"DT": {
"begin": "2014-11-03 13:00",
"every": 7,
"url": "http://ti.ira.uka.de/TI-2/Uebungen/blatt{2}.pdf"
}
},
"end": "2015-02-15"
{
"help": "{n} is replaced with the sheet number, n represents the padding of the number e.g. ({2} => (01,02,03))",
"name": "KIT Inf SS2015 (4. FSem)",
"uebs": {
"Sicherheit": {
"begin": "2015-04-23 15:45",
"every": [14,21,14],
"url": "https://crypto.iti.kit.edu/fileadmin/User/SicherheitSS15/Uebung/Sicherheit_UE{2}.pdf",
"info": "Keine Abgabe. Besprechung in der Übung. <a href='https://crypto.iti.kit.edu/index.php?id=sic-sose15'>Vorlesungsseite</a>"
},
@phiresky
phiresky / downloadChannel.sh
Last active August 29, 2015 14:13
Download / Parse MrSuicideSheep Youtube Channel
#!/bin/bash
# downloadChannel
#
# downloads a whole youtube channel, including descriptions and thumbnails
# should work on any channel or playlist
# youtube-dl is awesome
# depends: youtube-dl
if [[ ! "$1" ]]; then
echo "No channel specified"
@phiresky
phiresky / gist:f651244ca61568b9a19a
Last active August 29, 2015 14:25
hash collision probability test
second = 1;
year = 365.25 * 24 * 60 * 60 * second;
universe_age = 13.82e9 * year;
hash_length = 256;
hash_speed = 2500 * 1e6 / second; // fastest GPU from https://en.bitcoin.it/wiki/Non-specialized_hardware_comparison
probability_of_asteroid_wiping_out_humans = 1 / (100 * 1e6 * year); // http://www.wired.com/2013/02/asteroid-odds/
// http://preshing.com/20110504/hash-collision-probabilities/
function collision_probability(tries, possibilities) {
@phiresky
phiresky / motioninterpolation.vpy
Last active April 11, 2024 00:36
Realtime motion interpolating 60fps playback in mpv
# vim: set ft=python:
# see the README at https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645
# source: https://github.com/mpv-player/mpv/issues/2149
# source: https://github.com/mpv-player/mpv/issues/566
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
import vapoursynth
core = vapoursynth.get_core()
<script>
function log(s) {
document.writeln(s+"<br>");
console.log(s);
}
function generateString(bytes) {
return Array(bytes+1).join("a");
}
@phiresky
phiresky / test.md
Last active February 21, 2016 02:15
unicode RTL test

is this really an opening brace? ‮"}"

‮.erehwemos ti gnitsap dna "god yzal eht revo spmuj xof nworb kciuq ehT" :siht ypoc ot yrT‭