This website uses cookies for anonymised tracking and analytics. The tracking software used is called Matomo and is self-hosted. Your data never leaves this server and is not used for advertising or other nefarious purposes. By clicking accept, you agree to the privacy policy and to the use of cookies in tracking your use of the website. If, at a later time, you want to opt-out from this decision, visit this page.

Kudusch’s Trash

A blog about Life, the Universe and Everything…

Update, Umzug und neues Aussehen

April 3, 2014

wordpress-logo-simplified-rgb

 

Goodbye Tumblr, hello WordPress.org!

Im Zuge meines Umzugs von goneo.de zu ReHost24 habe ich mich von meinem (in der Szene extrem populären) Tumblr Blog getrennt und hoste meinen Blog jetzt selbst. Wie immer war diese Entscheidung verbunden mit diversem gefummel und einigen gereizten Nerven, aber wert war’s trotzdem.

Die alten Links auf den Tumblr funktionieren momentan leider noch nicht, da werde ich mir noch was einfallen lassen müssen. Auch eine Suche steht noch auf meiner To do-Liste.

Bis dahin aber funktioniert das hier alles prima und ist grundsätzlich einfach viel toller.

ColorClock screensaver

February 12, 2014

Time and color, combined into a screensaver!

This Mac OSX screensaver displays the current time and its RGB-color equivalent. In 24 hours the red-value goes from 0 to 255, the green and blue values do so in 60 minutes/seconds.
So at midnight you’ll have black and at 23:59:59 you’ll have white. And in between you’ll find every other color in the RGB-spectrum.

This is not my original idea. I saw a flash version of this concept a few years ago and rebuild it with javascript. You can find the original here.
The Mac OSX screensaver wrapper is from this project. See the readme.md for licensing.

The screensaver is available with either Helvetica Neue or a monospace font (Menlo).

Download:

If you don’t have a Mac or just don’t want to use a screensaver, you can visit the web version here (monospace) and here (Helvetica).

Tags: colorcsshtmljavascriptMac OSXrgbscreensaver

Gehacktes für den ARD Mediathek Download (HTTP Live Streaming .ts files download and merge)

December 29, 2013

Ein kleines php-Skript um Videos aus der ARD Mediathek (oder anderen Diensten, die HLS anbieten) herunter zuladen.

How to use

  • go to http://mediathek.daserste.de, open with iPad User Agent
  • navigate to the desired program, get link to the master.m3u8 file from source (in the video-tag)
  • run the script with url to the master.m3u8 file as argument (e.g. php get_tshls ‘http://http://hls.daserste.de/i/…/ios.smil/master.m3u8’
  • wait for the script to download and merge all media files; every 10 second part is about 3 MB (when it’s done, it will output the runtime)
  • if necessary, convert the *.ts file with a media converter eg. handbrake to a *.mp4 file
  • enjoy
<?php
/*
Made by Kudusch (blog.kudusch.de, kudusch.de, @Kudusch)

---------

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
 Version 2, December 2004 

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified 
copies of this license document, and changing it is allowed as long 
as the name is changed. 

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
 
0. You just DO WHAT THE FUCK YOU WANT TO.

---------

# How to use

- go to http://mediathek.daserste.de, open with iPad User Agent
- navigate to the desired program, get link to the master.m3u8 file from source (in the <video>-tag)
- run the script with url to the master.m3u8 file as argument (e.g. php get_tshls 'http://http://hls.daserste.de/i/videoportal/Film/c_380000/386059/ios.smil/master.m3u8'
- wait for the script to download and merge all media files; every 10 second part is about 3 MB (when it's done, it will output the runtime)
- if necessary, convert the *.ts file with a media converter eg. handbrake to a *.mp4 file
- enjoy

*/

//runtime
$startTime = microtime(get_as_float);

//get url from input
$url = $argv[1];
//get stream with highest bandwith
$streamUrl = getHighBandwidthStream($url);
//get array of all links to *.ts files
$list = getHlsFiles($streamUrl);

//make new directory
if (!is_dir('files')) {
 mkdir('files');
}

//download all files from array, name with 3 leading zeros
//if file is longer than 166.5 minutes, adjust str_pad params
$n = 1;
foreach ($list as $key) {
 $number = str_pad($n, 3, "0", STR_PAD_LEFT);
 print_r($n." ");
 file_put_contents("files/part.".$number.".ts", fopen($key, 'r'));
 $n++;
}

//merge files and delte parts
sleep(10);
mergeFiles('files');

//echo part numbers and runtime for debugging
echo("\nRun in ".(microtime(get_as_float)-$startTime)." seconds.");

//input: string, output: string
function getHighBandwidthStream($masterUrl) {
 //get content of master.m3u8
 $ch = curl_init($masterUrl);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
 $result = curl_exec($ch);
 curl_close($ch);
 
 //return link to second last stream (https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/streamingmediaguide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html#//apple_ref/doc/uid/TP40008332-CH103-SW1)
 $result = split("#", $result);
 for ($i = 0; $i < 2; $i++) {
 array_shift($result);
 }
 $length = count($result);
 $result = split("\n", $result[$length-2]);
 return $result[1];
}

//input: string, output: array
function getHlsFiles($streamUrl) {
 //get content of *.m3u8 file
 $ch = curl_init($streamUrl);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
 $raw = curl_exec($ch);
 curl_close($ch);
 
 //remove comments and unnecessary data
 $list_raw = split("\n", $raw);
 for ($i = 0; $i < 5; $i++) {
 array_shift($list_raw);
 }
 for ($i = 0; $i < 2; $i++) {
 array_pop($list_raw);
 }
 
 //extract file links 
 $list = array();
 $i = 1;
 foreach ($list_raw as $key) {
 if($i%2 == 0) {
 array_push($list, $key);
 }
 $i++;
 }
 
 //return array
 return $list;
}

function mergeFiles($dirName) {
 //get all *.ts files in directory
 if ($handle = opendir($dirName)) {
 while (false !== ($file = readdir($handle))) {
 if (strpos($file, ".ts") !== false) {
 $fileList = $fileList." files/".$file;
 }
 }
 closedir($handle);
 }
 
 //join and remove parts
 $shellScript = "cat ".substr($fileList, 1)." >> movie.ts";
 shell_exec($shellScript);
 shell_exec("rm -r files");
}
?>
Tags: ard mediathekcatgehackteshlsHTTP Live Streamingmergephpscriptts

ASCII Converter for Alfred 2

March 19, 2013

This is another little workflow for the Alfred Powerpack

image

image

With this workflow you can convert a string of characters into their ASCII code values and vice versa.
You can convert from and to hexadecimal, binary and decimal.
The results will be displayed as soon as you run the workflow and copied to your clipboard when you press enter.

You can either enter a string or just use your clipboard content.

ASCII converter

 

This extension is written in AppleScript and does not require an internet connection to work; the conversion is done inside the script and does not rely on an extern service.

Enjoy.

If you experience any problem with this extension, found a bug or have feature request, hit me on twitter.

Changelog:
Version 1.1
-fixes a rather stupid bug where the conversion for hex would not be in hexadecimal, but in hexal

Version 1.0
-rewritten as an Alfred 2 workflow
-detection of input

 

Control Notification Center and Growl.app from Alfred.app

March 16, 2013

An Alfred v2 workflow to control Growl.app and Mountain Lion’s Notification Center.
You’ll need version +1.3 of Growl.

You can use the following keywords:

Show the current status of Growl and NotificationCenter : stat
Pause Growl and Notification Center : pause
Resume Growl and Notification Center : resume
Pause or resume Growl : growl
Pause or resume Notification Center : notificationcenter
Close all Growl notifications : close_growl
Close all NotificationCenter notifications : close_nc
Show Growl’s rollup : show
Hide Growl’s rollup : hide
Enable Growl’s incoming network : enable
Disable Growl’s incoming network : disable/
Restart Growl : restart

Just download this extension, install it and it’s ready to use.

If you don’t have Growl installed, you can just download the NotificationCenter only version of the workflow.

Download!
(Growl and NotificationCenter)

 

Download!
(NotificationCenter only)

This extension is written in AppleScript and uses the Shell.

If you experience any troubles with this, hit me on twitter.
Enjoy.

Changelog:
v.2.3:
-support for Mac OS X 10.10 Yosemite
-you can now download this workflow in two versions (one with growl, one without)
v.2.2:
-added support for Mac OS X 10.9 Mavericks’ new security features
v.2.1:
-added support for Mac OS X 10.9 Mavericks
v.2.0.0:
-now rewritten as an Alfred 2 workflow
-added option to close all pending NotificationCenter items

If you don’t have the Alfred Powerpack or you don’t want to use Alfred for this task, you can either extract the code from the workflow file or just ask me for the source.

previous page

Impressum / RSS / kudusch.de