<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<?xml-stylesheet type="text/css" href="http://pdes-net.org/x-haui/feeds//styles/feed.css"?>


<title type="html">x-haui</title>
<subtitle type="html">news, diary, journal, whatever</subtitle>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds/"/>
<link rel="self" type="application/atom+xml" href="http://pdes-net.org/x-haui/feeds//atom.xml"/>
<updated>2010-08-19T19:14:58+02:00</updated>
<author>
<name>haui</name>
<uri>http://pdes-net.org/x-haui/feeds/</uri>
</author>
<id>http://pdes-net.org/x-haui/feeds//</id>
<generator uri="http://nanoblogger.sourceforge.net" version="3.4.2">
NanoBlogger
</generator>

<entry>
<title type="html">Vim tips</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/08/18/vim_tips/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/08/18/vim_tips/index.html</id>
<published>2010-08-18T15:53:02+02:00</published>
<updated>2010-08-18T15:53:02+02:00</updated>
<category term="vim" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Almost 4PM...time for some vim tips. :-)
<ul>
<li><b>autocmd</b><br />
Vim's powerful <i>autocmd</i> feature can be used to automatically 
perform certain commands when a specific event occurs. The events that can be used as triggers 
range from creating a new file to resizing vim's window. A complete list of available triggers
 can be obtained by typing <i>:help autocmd-events</i> in vim. So, how's this useful?<br />
Let's say you write most of your Perl scripts in vim, why should <b>you</b> insert the shebang and some other stuff 
 manually in a new file, when the editor can do this for you? The following two steps show you how it's done:
<ol><li>
Create a new file ~/.vim/skeletons/skeleton.pl containing a shebang for Perl 
as well as the recommended use strict/warnings statements:
<pre>
p=$(which perl); mkdir -p ~/.vim/skeletons; cat << EOF > ~/.vim/skeletons/skeleton.pl
#!$p
use strict;
use warnings;
EOF
</pre>
</li>
<li>
Put the following in your ~/.vimrc
<pre>autocmd BufNewFile *.pl 0r ~/.vim/skeletons/skeleton.pl | :normal G</pre>
</li>
</ol>
Now, when you're creating a new *.pl-file it is automatically prepended with the contents of ~/.vim/skeletons/skeleton.pl and vim starts at the end of the file.
Needless to say, that you can use multiple autocmd commands to support languages other than Perl.
</li>
<br />

<li><b>Syntax check</b><br />
Everyone knows about vim's :make command, but did you know that it's possible to set the 
make program for each file type separately?
<pre>autocmd FileType perl set makeprg=perl\ -c\ %\ $*</pre>
By adding this to your ~/.vimrc, :make will no longer invoke <i>make file</i> but <i>perl -c file</i> instead, when you're editing a Perl script. As usual, Perl is just an example - i.e. Ruby programmers might use <i>ruby -c</i> or the like.
</li>

<br />
<li><b>Y?</b><br />
There's some inconsistency between deleting and yanking in vim: <br />
<i>dd</i> deletes the current line, <i>D</i> deletes from the cursor to the end of the line.<br />
<i>yy</i> yanks the current line, but <i>Y</i> also yanks the current line...<br />
To yank all characters from the cursor position to the end of the line, you either need to type <i>y$</i>, or
add a custom mapping for <i>Y</i> to your ~/.vimrc:
<pre>map Y y$</pre>
</li>

<br />
<li><b>Matchit</b></li>
Typing % in normal mode finds the next item in the current line or under the cursor and jumps to its match. 
Items include c-style comments, parenthesis and some preprocessor statements. Unfortunately,
 there's no native support for HTML or Latex, but there's a handy little plugin,
 that adds support for these and many other languages: 
<a href="http://www.vim.org/scripts/script.php?script_id=39">Matchit</a>.
</li>
</ul>

Enough for one day....
</div>
</content>

</entry>
<entry>
<title type="html">yaydl 1.5.2</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/07/24/yaydl_1_5_2/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/07/24/yaydl_1_5_2/index.html</id>
<published>2010-07-24T17:10:36+02:00</published>
<updated>2010-07-24T17:10:36+02:00</updated>
<category term="projects" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="${BASE_URL}yaydl.html">yaydl</a> 1.5.2 fixes the support for youtube....<br>
<div class="download"><a href= "http://pdes-net.org/x-haui/scripts/perl/yaydl_youtubedownloader/yaydl-1.5.2.tar.gz">Download the tar.gz</a>
<p>
</div>
</content>

</entry>
<entry>
<title type="html">Bandwidth monitors</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/07/20/bandwidth_monitors/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/07/20/bandwidth_monitors/index.html</id>
<published>2010-07-20T22:08:42+02:00</published>
<updated>2010-07-20T22:08:42+02:00</updated>
<category term="linux" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>There are many tools available, that allow you to monitor (among other things) the current downstream of your internet connection. Some of them, like <a href="http://dag.wieers.com/home-made/dstat/">dstat</a> and <a href="http://www.gropp.org/?id=projects&sub=bwm-ng">bwm-ng</a> are handy console applications, whereas others integrate nicely into your desktop. Two popular examples for this would be <a href="http://conky.sourceforge.net/">conky</a> or <a href="http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html">gkrellm<a>.<br />
So, in general there's no real need for the following bash one-liner, unless you're just an ordinary user working on some poorly equipped linux box which doesn't offer any of the tools mentioned above. In that case, you'll be glad to have a dirty solution like the following available:
<pre>r=$(cat /sys/class/net/eth0/statistics/rx_bytes) ; while [ 1 ]; do n=$(cat /sys/class/net/eth0/statistics/rx_bytes); d=$(((n-r) / 1024 ));r=$n; echo "$d KB/s"; sleep 1;done</pre>
<br />
There is no need to mention,that <i>eth0</i> must be replaced by your primary interface's name.
</div>
</content>

</entry>
<entry>
<title type="html">Remove Exif data</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/07/18/remove_exif_data/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/07/18/remove_exif_data/index.html</id>
<published>2010-07-18T21:24:27+02:00</published>
<updated>2010-07-18T21:24:27+02:00</updated>
<category term="linux" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Sometimes it's advantageous to remove <a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format">Exif</a> metadata from image files, for example when posting images online. Fortunately, that's not a big deal since we're using linux:
<pre>mogrify -strip image.jpg</pre>
...or if you want to process more files:
<pre>mogrify -strip *.jpg</pre>

</p>
</div>
</content>

</entry>
<entry>
<title type="html">Important notice!!11</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/07/18/important_notice11/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/07/18/important_notice11/index.html</id>
<published>2010-07-18T21:04:55+02:00</published>
<updated>2010-07-18T21:04:55+02:00</updated>
<category term="misc" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<a href="http://pdes-net.org/x-haui/pics/scheine.jpg"><img src="http://pdes-net.org/x-haui/pics/scheine_thumb.jpg"></a>
</p>
</div>
</content>

</entry>
<entry>
<title type="html">Linux, mplayer and the ZDF Mediathek</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/04/21/linux_mplayer_and_the_zdf_mediathek/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/04/21/linux_mplayer_and_the_zdf_mediathek/index.html</id>
<published>2010-04-21T00:40:45+02:00</published>
<updated>2010-04-21T00:40:45+02:00</updated>
<category term="linux" />
<category term="scripts" />
<category term="perl" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>While the idea behind the <a href="http://de.wikipedia.org/wiki/ZDFmediathek">ZDF Mediathek</a> is not so bad at all, the actual implementation is a pain in the ass - especially the flash version of the website, which causes my Firefox to crash again and again...<br>
So I tried the HTML version of the site, which has two major advantages:<br>
1.) Firefox doesn't crash anymore and<br>
2.) one can watch the videos with any external program like vlc or mplayer.<br><br>
However, there's still a huge drawback: The videos are streamed via the <a href="http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">Real-Time Streaming Protocol</a>
 or the <a href="http://en.wikipedia.org/wiki/Microsoft_Media_Services">Microsoft Media Server Protocol</a>, so basic operations like fast-forwarding, rewinding or pausing should be avoided. Additionally, as no (significant) buffering is performed, your internet connection will be in use for the whole runtime of a video, limiting other online activities.<br>
Looking for an easy solution for this, I checked mplayer's manpage and found the <i>-dumpstream</i> option. The rest was some elementary bash scripting:<br>
<pre>
mplayer -dumpfile "$(date +%y_%m_%d_%H_%M.dump)" -dumpstream "$(curl -s "$(curl -s "$LINK" | egrep "&lt;li&gt;DSL\s*2000\s*&lt;a href=.*asx" | sed -r 's#.*href="([^"]+)".*#\1#')" | egrep -o 'mms://[^"]+')"
</pre>
This will save any(?) video from the Mediathek to a local file called <i>*current_date*.dump</i>.
If you didn't figure it out by yourself, <i>$LINK</i> must be set to / replaced by the actual URL pointing to your video (you'll need the URL to the HTML version, or do some additional preprocessing first).<br><br>

Before you ask: Of course I wrote an easy-to-use, ready-to-run script for this - it even does some limited error checking. It can be found <a href="http://pdes-net.org/x-haui/scripts/perl/mediathek.pl">here</a>. <br>
<br><br>
<b>Update:</b> Seems like this only works for just a few videos, so don't be too disappointed if it fails...
<br><br>

</p>
</div>
</content>

</entry>
<entry>
<title type="html">yaydl 1.5.1</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/04/10/yaydl_1_5_1/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/04/10/yaydl_1_5_1/index.html</id>
<published>2010-04-10T21:40:47+02:00</published>
<updated>2010-04-10T21:40:47+02:00</updated>
<category term="projects" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Version 1.5.1 comes with support for video.golem.de (ok....not as big as youtube, but who cares...)<br>
<br>
BTW: If you want to be informed about new versions without reading my blog (shame on you!), 
you might want to subscribe to yaydl on <a href='http://freshmeat.net/projects/yaydl'>freshmeat</a>.<br>
<div class="download"><a href= "http://pdes-net.org/x-haui/scripts/perl/yaydl_youtubedownloader/yaydl-1.5.1.tar.gz">Download the tar.gz</a>
<p>
</div>
</content>

</entry>
<entry>
<title type="html">yaydl 1.5</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/04/08/yaydl_1_5/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/04/08/yaydl_1_5/index.html</id>
<published>2010-04-08T00:33:29+02:00</published>
<updated>2010-04-08T00:33:29+02:00</updated>
<category term="projects" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>I know, you've all been waiting for it, so without any further ado, here it is, <a href="http://pdes-net.org/x-haui/yaydl.html">yaydl</a> 1.5!<br>
It includes all new features from version 1.4a, as well as support for custom 
<a href="http://en.wikipedia.org/wiki/Youtube#Quality_and_codecs">fmt codes</a>. 
As usual, I also fixed some bugs - check out the
 <a href= "http://pdes-net.org/x-haui/scripts/perl/yaydl_youtubedownloader/changelog">changelog</a> for details.<br>
<div class="download"><a href= "http://pdes-net.org/x-haui/scripts/perl/yaydl_youtubedownloader/yaydl-1.5.tar.gz">Download the tar.gz</a>
<p>
</div>
</content>

</entry>
<entry>
<title type="html">yaydl 1.4.5a</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/04/02/yaydl_1_4_5a/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/04/02/yaydl_1_4_5a/index.html</id>
<published>2010-04-02T16:25:01+02:00</published>
<updated>2010-04-02T16:25:01+02:00</updated>
<category term="projects" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Still a alpha version, but youtube works again!<br>
<div class="download"><a href= "http://pdes-net.org/x-haui/scripts/perl/yaydl_youtubedownloader/yaydl-1.4.5a.tar.gz">Download the tar.gz</a>
<p>
</div>
</content>

</entry>
<entry>
<title type="html">yaydl 1.4a</title>
<author>
<name>haui</name>
</author>
<link rel="alternate" type="text/html" href="http://pdes-net.org/x-haui/feeds//archives/2010/02/15/yaydl_1_4a/index.html"/>

<id>http://pdes-net.org/x-haui/feeds//archives/2010/02/15/yaydl_1_4a/index.html</id>
<published>2010-02-15T00:20:45+02:00</published>
<updated>2010-02-15T00:20:45+02:00</updated>
<category term="projects" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>It's already been more than one month since I released yaydl 1.3.7, so it's time for a small status update. 
The attached preview of the upcoming release already includes two main new features: support for playlists and 1080p videos on Youtube. 
Please note that these improvements aren't fully stable yet and might include some bugs - so if you're a fan of rock-stable software, keep your hands off this alpha ;-)
<br><br>
<div class="download">
<a href= "http://pdes-net.org/x-haui/scripts/perl/yaydl_youtubedownloader/yaydl-1.4a.tar.gz">Download the tar.gz</a>
</div>
<p>
</div>
</content>

</entry>

</feed>
