Montag, 9. Mai 2016

Build ffmpeg with non free codecs included

With my recently updateted build script it is now more easier than ever to build ffmpeg with non free codecs included. At this page you will not find any ffmpeg downloads with non free codes but you can build your own binary with some simple steps.

Go to https://github.com/markus-perl/ffmpeg-build-script. Download and install the build script. All dependencies are downloaded and compiled without any interaction.

Sonntag, 26. April 2015

Pushover Cli

About

pushover-cli is a command line client for https://pushover.net to send pushover notifications. Moreover it is possible with this client to pipe streams directly to your cellphone like tail -f /var/log/my.log | pushover-cli -

Pushover Cli download and installation

Simply execute the following command to install the latest version of this script to your system:

sudo curl -o /usr/bin/pushover-cli https://raw.githubusercontent.com/markus-perl/pushover-cli/master/pushover-cli && sudo chmod 555 /usr/bin/pushover-cli


Commandline options

Usage:   ./pushover-cli [options] <message> <title>
Stdin:   ./pushover-cli [options] - <title>
Example: ./pushover-cli -u ubLBe5u3zNXF9gBtX2zKkezSuPgu3v -t aK5BW3sjAqPsedH44VyQSbaQecoRen "Hello World"

  -u --user     <user id>             Pushover User-ID
  -t --token    <api token>           Pushover API-Token
  -p --priority <high, normal, low>   Default: normal
  -l --url      <url>                 Link the message to this URL
  -c --config   <path to file>        Default: /etc/pushover.conf
  -v --verbose                        Be verbose
  -q --quiet                          Be quiet

Dienstag, 21. Oktober 2014

FFmpeg Build Script

After searching the whole internet for a Mac OSX binary built of ffmpeg with non free codecs included i finally gave up and wrote my own building script.

Since I wanted a statically compiled binary which also can be used on devices without Xcode installed, homebrew was not the perfect solution for me.

I started from scratch building a script that automatically downloads all dependencies and compiles all necessary libraries.

My final script can be found on github: https://github.com/markus-perl/ffmpeg-build-script

Samstag, 11. Oktober 2014

PHP CSV detect delimiter

/**
 * @param string $csvFile Path to CSV file
 * @return string
 */
public function detectDelimiter($csvFile)
{
        $delimiters = array(
            ';' => 0,
            ',' => 0,
            "\t" => 0,
            "|" => 0
        );

        $handle = fopen($csvFile, "r");
        $firstLine = fgets($handle);
        fclose($handle);

        foreach ($delimiters as $delimiter => &$count) {
            $count = count(str_getcsv($firstLine, $delimiter));
        }

        return array_search(max($delimiters), $delimiters);
}

Mittwoch, 23. April 2014

HowTo install ZendDebugger for PHP 5.4 or PHP 5.5 on Debian

Since the ZendDebugger is bundled with ZendStudio and ZendServer the PHP module cannot easily be downloaded standalone.

But with some simple steps the module can be extracted out of the official ZendStudio tarball which can be downloaded for free on http://www.zend.com/en/products/studio/downloads.

Prerequisites


Make sure, openssl0.9.8 is installed. Newer Versions like openssl1.0.0+ will not work.

on debian squeeze

$ sudo apt-get install libssl0.9.8

on debian wheezy

$ wget http://snapshot.debian.org/archive/debian/20110406T213352Z/pool/main/o/openssl098/libssl0.9.8_0.9.8o-7_amd64.deb
$ sudo dpkg -i libssl0.9.8_0.9.8o-7_amd64.deb

Extract the extension


Create a temporary working dir

$ mkdir /tmp/zend_debugger
$ cd /tmp/zend_debugger

Download Zend Studio 10.6

$ wget http://downloads.zend.com/studio-eclipse/10.6.0/ZendStudio-10.6.0-linux.gtk.x86_64.tar.gz

Find the extension in the archive

$ tar -tvf ZendStudio-10.6.0-linux.gtk.x86_64.tar.gz | grep ZendDebugger.so
This will give you the following output:
-rwxrwxr-x vagrant/nogroup   238153 2014-01-08 16:11 ZendStudio/plugins/com.zend.php.debug.debugger.linux.x86_64_10.6.0.v20140128-2127/resources/php53/ZendDebugger.so
-rwxrwxr-x vagrant/nogroup   238217 2014-01-08 15:56 ZendStudio/plugins/com.zend.php.debug.debugger.linux.x86_64_10.6.0.v20140128-2127/resources/php54/ZendDebugger.so
-rw-r--r-- vagrant/nogroup   238631 2014-01-08 15:22 ZendStudio/plugins/com.zend.php.debug.debugger.linux.x86_64_10.6.0.v20140128-2127/resources/php55/ZendDebugger.so

Extract the extension for PHP 5.3, 5.4 and 5.5

$ tar -xzvf ZendStudio-10.6.0-linux.gtk.x86_64.tar.gz --strip-components 4 --wildcards *ZendDebugger.so

Install the extension


Now copy the extension matching your PHP Version to the local extension dir

For PHP 5.5

$ sudo cp php55/ZendDebugger.so `php -i | grep extension_dir | awk '{print $NF}'`

For PHP 5.4

sudo cp php54/ZendDebugger.so `php -i | grep extension_dir | awk '{print $NF}'`

Update your php.ini

Add the following lines at the end of your php.ini file
[Zend Debugger]
zend_extension=ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1/24,192.0.0.1/32
zend_debugger.expose_remotely=allowed_hosts

Check the extension

$ php -v
PHP 5.5.11-1~dotdeb.1 (cli) (built: Apr  4 2014 02:15:16)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Zend Debugger v6.0.0, Copyright (c) 1999-2013, by Zend Technologies

That's it. If you can find the line "Zend Debugger v6.0.0" in the output the debugger extension is successfully installed.

Dienstag, 22. April 2014

NodeJs socket hang up

events.js:72

        throw er; // Unhandled 'error' event
              ^
Error: socket hang up
    at createHangUpError (http.js:1472:15)
    at Socket.socketOnEnd [as onend] (http.js:1568:23)
    at Socket.g (events.js:180:16)
    at Socket.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)


This error happens even with the latest nodejs version if you're using a ssl certificate whose domain cannot be resolved by your dns.

Let's say your SSL certificate is issued to www.your-domain.com make sure a dns lookup can resolve this domain.

Simply add your domain to your /etc/hosts file
127.0.0.1 www.your-domain.com

If your using a wildcard certificate *.your-domain.com you can simply add this domain to your /etc/hosts file:

127.0.0.1 *.your-domain.com

Mittwoch, 9. April 2014

socket.io.js, line 1641 character 7 Access denied

SCRIPT5: Access is denied.
socket.io.js, line 1641 character 7
This error happens under IE 10, if nodejs and you webpage runs on a different port. You should ensure that your webserver and your nodejs server are running on the same port with the same protocol.