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

Tuesday, March 09, 2010

nVidia and Slackware-Current

A week ago slackware-current got a huge update and one of the things that were updated was the kernel. Kernel 2.6.33 intr0duced a new nvidia driver: nouveau, which resulted by reverse-engineering the official driver I think. The problem is that out of the box, at least for now, neither nouveau, nor the official nvidia driver are runnable on the system.

For nouveau, the Xorg that is included with slackware-current does not contain the needed xf86-video-nouveau driver.
You can download and compile this, but you need to find the suitable for your nouveau kernel module and this is not the latest from the nouveau repository:

git://anongit.freedesktop.org/git/nouveau/xf86-video-nouveau/

You could of course download the latest pair of kernel and xorg driver and this should work, but for now, I decided to stay with the official driver from nvidia. Two problems arise here. First the nouveau driver is loaded automatically in the boot process when the hardware is probed and it is conflicting with the official nvidia driver. Second, the latest nvidia driver 190.53 does not compile with kernel 2.6.33.

In order to overcome the first problem you'll probably need to blacklist the nouveau module, or unload it every time before starting X-Window. You cannon directly unload nouveau and it's dependencies using rmmod. You have to unbind the nouveau frame buffer first. See here for more info.

Anyway, blacklisting the modules is easier. Simply append this:
blacklist drm
blacklist ttm
blacklist nouveau
to /etc/modprobe.d/blacklist.conf and the old vga console driver will run the next time you boot the system.

For the latest nvidia driver (190.53) you need first to apply the patch found here:
nvidia-betasam-2.6.33.patch.txt

You can apply a patch like this:
sh ./NVIDIA-Linux-x86-190.53-pkg1.run --apply-patch nvidia-betasam-2.6.33.patch.txt

This will create a new file: NVIDIA-Linux-x86-190.53-pkg1-custom.run with the patched driver, which is compatiple with kernel 2.6.33.

Wednesday, January 28, 2009

Download kde4 from slackware-current

This is a script to mirror the kde4 packages from slackware-current. For now, those packages works for slackware 12.2 too.

The script may be executed multiple times from the same directory. It will detect the changes made in the repositoty, it will remove the obsolete local files and will only download the newer files that are not present in the local copy.

#!/bin/sh

# Copyright 2008-2009 Nikos Skalkotos, Athens, Greece
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


server=ftp://ftp.ntua.gr
url_path=pub/linux/slackware/slackware-current/testing/packages/kde4
url=$server/$url_path
dirs="deps extragear kde kde3-compat kde-l10n"
files="remove-kde3.sh remove-kde4.sh"

if [ "$1" = "--clean" ]; then
echo -n "Cleaning up..."
rm -fr $files $dirs
echo "done"
exit 0
fi

remove_obsolete() {
echo "Checking local directory \"$1\" for obsolete files..."
(cd $1
for i in `ls`; do
exists=`echo "$2" | grep $i`

if [ $i != "" -a "$exists" = "" ] ; then
echo "Removing file: $1/$i"
rm -f $i
fi
done
)
}


for filename in $files; do
#Those are small scripts, so I'll download them every time
rm -f $filename
wget -c $url/$filename
done

for dir in $dirs; do

#I need to create the dir the first time
mkdir -p "$dir"

echo
#Clean old files no longer listened in the repository
echo -n "Listing kde4/$dir content..."
dir_content=`curl -sl $url/$dir/`
echo "done"
remove_obsolete $dir "$dir_content"

#Now mirror the directory
(cd $dir; wget --mirror -nH -nd $url/$dir/)
done

Sunday, January 25, 2009

Youtube watch in normal/high quality

Anybody noticed the watch in normal/high quality link that is present in the bottom right corner of some videos in www.youtube.com?

The funny thing is that in some videos where the streaming delays while watching it in normal quality, it works perfectly in high quality. The only thing I could assume is that the videos are stored in high quality and are converted to normal quality on-the-fly instead of being stored in both formats.

This makes the option pretty useless.