Monday, December 19, 2011

slackware & git colors

By default in Slackware, the colors in git are not displayed correct. If you enable colors in git with a command like this:
git config color.ui true
instead of colored text you see escape characters like those below:
ESC[33mblablabalESC[m
This has to do with the fact that `less' which is used by git to display pages doesn't by default output escape sequences in "raw" form to the terminal (you need apply to use -R option). Executing something like this will fix the issue:
git config --global core.pager "less -FXRS"

Wednesday, August 24, 2011

Clear All Windows 2008 R2 event logs

If you want to clear the event logs in a Windows Server system, you can fire up Event Viewer, browse to the desired log and from the Actions menu select Clear Log.... But if you want to clear all the System and Application logs at once, you'd better use the `wevtutil' command line utility Microsoft offers. A Windows PowerShell command like this will do the job:
wevtutil el | foreach { wevtutil cl $_ }

Wednesday, March 30, 2011

Download Alien Bob's multilib support packages

I've created a Perl script to download all slackware-current multilib support packages from here. Perl really makes you a lazy programmer. You can do unbelievable many things in just a few lines.
#!/usr/bin/perl -w

use LWP::UserAgent;
use strict;

sub get_links
{
my $url = shift;
my $page = LWP::UserAgent->new->get($url)->content;

map { m@/$@ && get_links($_) || system("wget -xnH $_"); }
map { "$url$_" } $page =~ m@<a href="(.+)">\1</a>@g;
}

my $url = "http://connie.slackware.com/~alien/multilib/current/";

get_links($url);

Friday, January 14, 2011

Extracting frames from a live stream

Many times, downloading and saving a stream locally is not an option. For example if the stream is a live stream. If you need to extract frames from a stream like this, you need to do it on-the-fly.

A good tool for dumping media content streamed over rtmp is rtmpdump and a good tool for extracting frames from a video is ffmpeg. Luckily for us those two can be piped together, since rtmpdump by default dumps the streamed media content to standard output and ffmpeg provides the option to read the input from a pipe.

To extract one frame per second from a stream try something like this:
rtmpdump -r <rtmp_video_url> | ffmpeg -i pipe:0 -r 1 frame%05d.jpg