<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Autarchy of the Private Cave*nix &#187;</title> <atom:link href="http://bogdan.org.ua/categories/nix/feed" rel="self" type="application/rss+xml" /><link>http://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Tue, 15 May 2012 21:56:55 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>tudu: a beautiful ncurses to-do list application</title><link>http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html</link> <comments>http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html#comments</comments> <pubDate>Tue, 11 Oct 2011 12:15:21 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[ncurses]]></category> <category><![CDATA[tudu]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1722</guid> <description><![CDATA[tudu is just what it says in the title, and is written in C. All the functions are mapped to keys. Extremely flexible: you can use it either as a simple to-do list, or utilize a bunch of optional features (priorities, schedules, deadlines, categories, tags, maybe something else). If you (like me) love ncurses &#8211; [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://cauterized.net/~meskio/tudu/" rel="nofollow" class="broken_link">tudu</a> is just what it says in the title, and is written in C.<br
/> All the functions are mapped to keys. Extremely flexible: you can use it either as a simple to-do list, or utilize a bunch of optional features (priorities, schedules, deadlines, categories, tags, maybe something else).</p><p>If you (like me) love ncurses &#8211; you will love tudu <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Just give it a try.</p><p><img
src="http://bogdan.org.ua/wp-content/uploads/2011/10/tudu.jpg" alt="" title="tudu" width="680" height="400" class="alignnone size-full wp-image-1724" /><br
/> Screenshot copyright: Ruben Pollan (tudu author).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F10%2F11%2Ftudu-a-beautiful-ncurses-to-do-list-application.html&amp;title=tudu%3A%20a%20beautiful%20ncurses%20to-do%20list%20application" id="wpa2a_4"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Good advice: /bin/false is not security</title><link>http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html</link> <comments>http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html#comments</comments> <pubDate>Sat, 01 Oct 2011 21:38:30 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[false]]></category> <category><![CDATA[nologin]]></category> <category><![CDATA[port forwarding]]></category> <category><![CDATA[ssh]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1706</guid> <description><![CDATA[SSH Security and You &#8211; /bin/false is *not* security.]]></description> <content:encoded><![CDATA[<p><a
href="http://www.semicomplete.com/articles/ssh-security/" rel="nofollow" >SSH Security and You &#8211; /bin/false is *not* security</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F10%2F01%2Fgood-advice-bin-false-is-not-security.html&amp;title=Good%20advice%3A%20%2Fbin%2Ffalse%20is%20not%20security" id="wpa2a_8"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to remotely convert live 1xHDD/LVM Linux server to 2xHDD RAID1/LVM (GRUB2, GPT)</title><link>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html</link> <comments>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html#comments</comments> <pubDate>Tue, 17 May 2011 13:23:05 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[GPT]]></category> <category><![CDATA[grub2]]></category> <category><![CDATA[LVM]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[RAID]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1593</guid> <description><![CDATA[Assumptions: current HDD is /dev/sda, it has a GPT (with bios_grub being /dev/sda1), separate /boot partition (/dev/sda2), and a physical LVM volume (/dev/sda3), where LVM holds all the remaining partitions (root, /home, /srv, &#8230;); LVM is properly configured, and system reboots with no problems your new drive is /dev/sdb, it is identical to /dev/sda, and [...]]]></description> <content:encoded><![CDATA[<p>Assumptions:</p><ul><li>current HDD is /dev/sda, it has a GPT (with bios_grub being /dev/sda1), separate /boot partition (/dev/sda2), and a physical LVM volume (/dev/sda3), where LVM holds all the remaining partitions (root, /home, /srv, &#8230;); LVM is properly configured, and system reboots with no problems</li><li>your new drive is /dev/sdb, it is identical to /dev/sda, and it comes empty from the manufacturer (this is important! wipe the drive if it is not empty, especially if it used to be a part of another RAID)</li><li>your system is Debian or Debian-based; in this exact example I&#8217;ve been using Ubuntu Server 10.04</li><li>your LVM volume group is named vg0</li><li>make sure you understand what each command does before executing it</li><li>you do have an external backup of all your important data, and you do understand that the following operations are potentially dangerous to your data integrity</li></ul><p>Inspired by: <a
href="http://www200.pair.com/mecham/raid/raid1-degraded-etch.html" rel="nofollow" >Debian Etch RAID guide</a>, <a
href="http://serverfault.com/questions/267819/convert-1x2tb-hdd-with-lvm-into-2x2tb-hdd-with-raid1lvm-or-with-lvm-mirroring" rel="nofollow" >serverfault question</a>.<br
/> <span
id="more-1593"></span></p><ol><li>Create the GPT on the new drive:<br
/> <strong>parted /dev/sdb mklabel gpt</strong></li><li>Get the list of partitions on /dev/sda:<br
/> <strong>parted -m /dev/sda print</strong></li><li>Create /dev/sdb partitions similarly to what you have on /dev/sda (my example numbers follow, use your numbers here):<br
/> <strong>parted /dev/sdb mkpart bios_grub 1049kB 2097kB</strong><br
/> <strong>parted /dev/sdb mkpart boot 2097kB 258MB</strong><br
/> <strong>parted /dev/sdb mkpart lvm 258MB 2000GB</strong></li><li>Set proper flags on partitions:<br
/> <strong>parted /dev/sdb set 1 bios_grub on</strong> (GPT doesn&#8217;t have MBR, so you create a 1-MB partition instead to hold grub2&#8242;s boot code)<br
/> <em>(possibly optional)</em> <strong>parted /dev/sdb set 2 raid on</strong><br
/> <em>(possibly optional)</em> <strong>parted /dev/sdb set 3 raid on</strong></li><li><em>(possibly optional)</em> To make sure /dev/sdb1 (the bios_grub) indeed contains grub&#8217;s boot code, I did <strong>dd if=/dev/sda1 of=/dev/sdb1</strong></li><li><strong>apt-get install mdadm</strong></li><li>Note: at this point, older tutorials suggest adding a bunch of raid* kernel modules to /etc/modules and to grub&#8217;s list of modules to load. I&#8217;m not sure this is really necessary, but do see the tutorials mentioned at the top for more information. If you do modify the lists of modules &#8211; don&#8217;t forget to run <strong>update-initramfs -u</strong>.</li><li>Create two initially-degraded RAID1 devices (one for /boot, another for LVM):<br
/> <strong>mdadm &ndash;&ndash;create /dev/md0 &ndash;&ndash;level=1 &ndash;&ndash;raid-devices=2 /dev/sdb2 missing</strong><br
/> <strong>mdadm &ndash;&ndash;create /dev/md1 &ndash;&ndash;level=1 &ndash;&ndash;raid-devices=2 /dev/sdb3 missing</strong></li><li>Store the configuration of your RAID1 to the mdadm.conf file (important! this is not done automatically!)<br
/> <strong>mdadm -Es >> /etc/mdadm/mdadm.conf</strong></li><li>Verify the contents of your mdadm.conf:<br
/> <strong>cat /etc/mdadm/mdadm.conf</strong><br
/> <strong>dpkg-reconfigure mdadm</strong>, and enable booting in degraded mode</li><li>Copy your current /boot (/dev/sda2) to the new /dev/md0 /boot partition:<br
/> (one can use dd here as well, but for some reason my attempt at dd failed writing 1 last byte of data)<br
/> <strong>mkdir /mnt/md0</strong><br
/> <strong>mount /dev/md0 /mnt/md0</strong><br
/> <strong>cp -a /boot/* /mnt/md0/</strong><br
/> <strong>umount /dev/md0</strong><br
/> <strong>rmdir /mnt/md0</strong></li><li>Now extend your existing volume group to include the newly-created /dev/md1:<br
/> <strong>pvcreate /dev/md1</strong><br
/> <strong>vgextend vg0 /dev/md1</strong></li><li>Verify the list of logical volumes you curently have: enter <strong>lvm</strong> shell, and type <strong>lvs</strong>. Here&#8217;s what I had:<br
/> LV   VG    Attr   LSize   Origin Snap%  Move Log Copy%  Convert<br
/> home vg0   -wi-ao   1.70t<br
/> logs vg0   -wi-ao   4.66g<br
/> root vg0   -wi-ao  10.24g<br
/> srv  vg0   -wc-ao 100.00g<br
/> swap vg0   -wi-ao   1.86g<br
/> tmp  vg0   -wi-ao   4.66g</li><li>Now, you can move all the logical volumes to new physical volume in one command: <strong>pvmove /dev/sda3 /dev/md1</strong>. Personally, remembering the problem I had with dd from /dev/sda2 to /dev/md0, I decided to move all logical volumes one-by-one; as this takes time, you may consider joining these operations with <strong>;</strong> or <strong>&#038;&</strong>, and putting the /tmp last (as the easiest one to re-create if it fails to move):<br
/> <strong>pvmove &ndash;&ndash;name home /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name srv /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name logs /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name swap /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name root /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name tmp /dev/sda3 /dev/md1</strong></li><li>To be safer, I ran FS check on a few volumes I could umount:<br
/> <strong>umount /dev/mapper/vg0-srv</strong><br
/> <strong>fsck -f /dev/mapper/vg0-srv</strong><br
/> <strong>mount /dev/mapper/vg0-srv</strong><br
/> <strong>umount /dev/mapper/vg0-tmp</strong><br
/> <strong>fsck -f /dev/mapper/vg0-tmp</strong><br
/> <strong>mount /dev/mapper/vg0-tmp</strong></li><li>Remove /dev/sda3 from the physical space available to your volume group:<br
/> <strong>vgreduce vg0 /dev/sda3</strong></li><li>Install grub2 to both drives, so as to make them both bootable in case of failure:<br
/> <strong>grub-install &#8216;(hd0)&#8217;</strong><br
/> <strong>grub-install &#8216;(hd1)&#8217;</strong></li><li>Edit <strong>/etc/fstab</strong>, pointing /boot to /dev/md0. You may use UUIDs here, but please do not use UUIDs from mdadm.conf &#8211; those are different from FS-UUIDs, instead do <strong>ls -l /dev/disk/by-uuid</strong> to find the UUID of /dev/md0. Personally, I had no problems just using /dev/md0.</li><li>Now is the time to add your original /dev/sda to the RAID1; be absolutely sure you have moved all the data off that drive, because these commands will destroy it:<br
/> <strong>mdadm &ndash;&ndash;manage &ndash;&ndash;add /dev/md0 /dev/sda2</strong><br
/> <strong>mdadm &ndash;&ndash;manage &ndash;&ndash;add /dev/md1 /dev/sda3</strong><br
/> Re-syncing array will take some time.</li><li>To be on the safe side, you may want to run again <strong>update-initramfs -u</strong> and <strong>update-grub</strong>; I have also edited /etc/grub.d/40_custom, adding there 2 more boot options: from /dev/sda2 and /dev/sdb2 (/boot on both drives) &#8211; have no idea if that will work, but having more boot options didn&#8217;t hurt</li><li>Reboot into your new system. Actually, at this point reboot is only necessary to verify that your system is bootable &#8211; you may delay this reboot as long as you want to.</li><li>Many tutorials also suggest testing your RAID1 by manually &#8220;degrading&#8221; it, trying to boot, and then rebuilding it back. I haven&#8217;t done that, but you may want to.</li></ol><p>Improvement suggestions, criticism and thank-you are welcome in the comments.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F05%2F17%2Fhow-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html&amp;title=How%20to%20remotely%20convert%20live%201xHDD%2FLVM%20Linux%20server%20to%202xHDD%20RAID1%2FLVM%20%28GRUB2%2C%20GPT%29" id="wpa2a_12"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Generate .mood moodbar files for your whole music collection</title><link>http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html</link> <comments>http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html#comments</comments> <pubDate>Sun, 10 Apr 2011 20:21:46 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[amarok]]></category> <category><![CDATA[moodbar]]></category> <category><![CDATA[music]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1561</guid> <description><![CDATA[Amarok moodbar wiki page has 2 nice scripts to generate .mood files for your whole music collection (to be displayed by amarok when playing). Both scripts should be started from the directory where you keep your music. The .mood files will be generated next to the source music files (in the same directories). You can [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://amarok.kde.org/wiki/Moodbar" rel="nofollow" >Amarok moodbar wiki</a> page has 2 nice scripts to generate .mood files for your whole music collection (to be displayed by amarok when playing).</p><p><span
id="more-1561"></span></p><p>Both scripts should be started from the directory where you keep your music. The .mood files will be generated next to the source music files (in the same directories). You can modify the scripts to have the moods stored to $HOME/.kde/share/apps/amarok/moods/, so as not to clutter your music directories.</p><p>Script for multicore CPUs (will not overwrite existing mood files):</p><div
class="igBar"><span
id="lcode-4"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-4"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">NUMCPU=<span
style="color:#CC0000;">"$(grep ^processor /proc/cpuinfo | wc -l)"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">find . -type f -regextype posix-awk -iregex <span
style="color:#CC0000;">'.*<span
style="color:#000099; font-weight:bold;">\.</span>(mp3|ogg|flac|wma)'</span> | while read i ; do</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;while <span
style="color:#006600; font-weight:bold;">&#91;</span> `jobs -p | wc -l` -ge $NUMCPU <span
style="color:#006600; font-weight:bold;">&#93;</span> ; do</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sleep <span
style="color:#800000;color:#800000;">0</span>.<span
style="color:#800000;color:#800000;">1</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;done</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;TEMP=<span
style="color:#CC0000;">"${i%.*}.mood"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;OUTF=`echo <span
style="color:#CC0000;">"$TEMP"</span> | sed <span
style="color:#CC0000;">'s#<span
style="color:#000099; font-weight:bold;">\(</span>.*<span
style="color:#000099; font-weight:bold;">\)</span>/<span
style="color:#000099; font-weight:bold;">\(</span>[^,]*<span
style="color:#000099; font-weight:bold;">\)</span>#<span
style="color:#000099; font-weight:bold;">\1</span>/.<span
style="color:#000099; font-weight:bold;">\2</span>#'</span>`</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;if <span
style="color:#006600; font-weight:bold;">&#91;</span> ! -e <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span> ; then</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;moodbar -o <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#CC0000;">"$i"</span> &amp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;fi</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done</div></li></ol></div></div></div><p></p><p>Script for single-threaded moods generation (will only overwrite the last-generated mood file from a previous run):</p><div
class="igBar"><span
id="lcode-5"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-5"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DIR=$<span
style="color:#006600; font-weight:bold;">&#123;</span><span
style="color:#800000;color:#800000;">1</span>:-.<span
style="color:#006600; font-weight:bold;">&#125;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LAST=.<span
style="">moodbar</span>-lastreadsong</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">C_RET=<span
style="color:#800000;color:#800000;">0</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">control_c<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; &nbsp; &nbsp; &nbsp; # run if user hits control-c</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#006600; font-weight:bold;">&#123;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; echo <span
style="color:#CC0000;">"$1"</span>&gt; <span
style="color:#CC0000;">"$LAST"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; echo <span
style="color:#CC0000;">"Exiting..."</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; exit</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#006600; font-weight:bold;">&#125;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span
style="color:#006600; font-weight:bold;">&#91;</span> -e <span
style="color:#CC0000;">"$LAST"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span>; then</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; read filetodelete &lt;<span
style="color:#CC0000;">"$LAST"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; rm <span
style="color:#CC0000;">"$filetodelete"</span> <span
style="color:#CC0000;">"$LAST"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exec <span
style="color:#800000;color:#800000;">9</span>&lt;&lt;<span
style="color:#006600; font-weight:bold;">&#40;</span>find <span
style="color:#CC0000;">"$DIR"</span> -type f -regextype posix-awk -iregex <span
style="color:#CC0000;">'.*<span
style="color:#000099; font-weight:bold;">\.</span>(mp3|ogg|flac|wma)'</span><span
style="color:#006600; font-weight:bold;">&#41;</span> # you may need to add m4a and mp4</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">while read i</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; TEMP=<span
style="color:#CC0000;">"${i%.*}.mood"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; OUTF=`echo <span
style="color:#CC0000;">"$TEMP"</span> | sed <span
style="color:#CC0000;">'s#<span
style="color:#000099; font-weight:bold;">\(</span>.*<span
style="color:#000099; font-weight:bold;">\)</span>/<span
style="color:#000099; font-weight:bold;">\(</span>[^,]*<span
style="color:#000099; font-weight:bold;">\)</span>#<span
style="color:#000099; font-weight:bold;">\1</span>/.<span
style="color:#000099; font-weight:bold;">\2</span>#'</span>`</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; trap <span
style="color:#CC0000;">'control_c &quot;$OUTF&quot;'</span> INT</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; if <span
style="color:#006600; font-weight:bold;">&#91;</span> ! -e <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span> || <span
style="color:#006600; font-weight:bold;">&#91;</span> <span
style="color:#CC0000;">"$i"</span> -nt <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span>; then</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; moodbar -o <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#CC0000;">"$i"</span> || <span
style="color:#006600; font-weight:bold;">&#123;</span> C_RET=<span
style="color:#800000;color:#800000;">1</span>; echo <span
style="color:#CC0000;">"An error occurred!"</span>&gt;&amp;<span
style="color:#800000;color:#800000;">2</span>; <span
style="color:#006600; font-weight:bold;">&#125;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fi</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done &lt;&amp;<span
style="color:#800000;color:#800000;">9</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exec <span
style="color:#800000;color:#800000;">9</span>&lt;&amp;-</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit $C_RET</div></li></ol></div></div></div><p></p><p>That same page has a link to an older, somewhat more polished <a
href="http://forum.kde.org/viewtopic.php?f=119&#038;t=84811" rel="nofollow" >ruby script</a> for the same task. It requires a running instance of Amarok, and uses it's media collection to find music files and create mood files for them. This script can potentially (after a little editing) store .mood files either with the music or to the $HOME/.kde/... path mentioned above. It is for an older version of Amarok, and thus is not likely to work with e.g. Amarok 2.4</p><div
class="igBar"><span
id="lruby-6"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('ruby-6'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">RUBY:</span><div
id="ruby-6"><div
class="ruby"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#008000; font-style:italic;">#!/usr/bin/ruby</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#008000; font-style:italic;"># Simple moodbar file management utility by Joe Rabinoff</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#008000; font-style:italic;"># This is also my first ever ruby script so bear with me</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$moodbar_folder = <span
style="color:#996600;">"#{ENV['HOME']}/.kde/share/apps/amarok/moods/"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> usage<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"This is the moodbar file management utility<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Usage is:<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"&nbsp; &nbsp;moodbar_util.rb -rename&nbsp; &nbsp; Rename mood files"</span> \</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span
style="color:#996600;">" from any old naming scheme to the current one<span
style="color:#000099;">\n</span>"</span> \</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; + <span
style="color:#996600;">"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (not applicable when mood"</span> \</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span
style="color:#996600;">" files are stored with music)<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"&nbsp; &nbsp;moodbar_util.rb -calcall&nbsp; &nbsp;Calculate all un-calculated"</span> \</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + <span
style="color:#996600;">" mood files<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">exit</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> check_amarok_running<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; result = <span
style="color:#996600;">`dcop 'amarok*'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#0000FF; font-weight:bold;">return</span> <span
style="color:#006600; font-weight:bold;">&#40;</span>result.<span
style="color:#9900CC;">length</span>&gt; <span
style="color:#006666;color:#800000;">0</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> get_devices<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; result = <span
style="color:#996600;">`dcop amarok collection query 'SELECT id, lastmountpoint FROM devices;'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ret = Hash.<span
style="color:#9900CC;">new</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; result.<span
style="color:#9900CC;">each_index</span> <span
style="color:#9966CC; font-weight:bold;">do</span> |i|</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ret<span
style="color:#006600; font-weight:bold;">&#91;</span>result<span
style="color:#006600; font-weight:bold;">&#91;</span>i<span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#9900CC;">to_i</span><span
style="color:#006600; font-weight:bold;">&#93;</span> = result<span
style="color:#006600; font-weight:bold;">&#91;</span>i+<span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#93;</span> <span
style="color:#9966CC; font-weight:bold;">if</span> i % <span
style="color:#006666;color:#800000;">2</span> == <span
style="color:#006666;color:#800000;">0</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#0000FF; font-weight:bold;">return</span> ret</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> mood_name<span
style="color:#006600; font-weight:bold;">&#40;</span>url, deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ret = url.<span
style="color:#CC0066; font-weight:bold;">gsub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\//, ','<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#0000FF; font-weight:bold;">return</span> deviceid.<span
style="color:#9900CC;">to_s</span> + <span
style="color:#996600;">","</span> + ret</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> rename<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; &nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Renaming mood files from outdated naming schemes...<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># As far as I can tell, the best way to do this is just select all</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># tracks, check the old possible moodbar names, and rename them</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tracks = <span
style="color:#996600;">`dcop amarok collection query 'SELECT url, deviceid FROM tags;'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; devices = get_devices</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#006666;color:#800000;">0</span>.<span
style="color:#9900CC;">step</span><span
style="color:#006600; font-weight:bold;">&#40;</span>tracks.<span
style="color:#9900CC;">length</span>-<span
style="color:#006666;color:#800000;">1</span>, <span
style="color:#006666;color:#800000;">2</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span> |i|</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; url&nbsp; &nbsp; &nbsp; = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i<span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\.<span
style="color:#006600; font-weight:bold;">&#91;</span>^\.<span
style="color:#006600; font-weight:bold;">&#93;</span>*$/, '.<span
style="color:#9900CC;">mood</span>'<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; deviceid = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i+<span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#9900CC;">to_i</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; path = url.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\./, ''<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span
style="color:#9966CC; font-weight:bold;">if</span> devices.<span
style="color:#9900CC;">has_key</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;path = devices<span
style="color:#006600; font-weight:bold;">&#91;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#93;</span> + path</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; moodfile&nbsp; = $moodbar_folder + mood_name<span
style="color:#006600; font-weight:bold;">&#40;</span>url, deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; moodfile1 = $moodbar_folder + path.<span
style="color:#CC0066; font-weight:bold;">gsub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\//, ','<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">next</span> <span
style="color:#9966CC; font-weight:bold;">if</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">if</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile1<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">system</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"mv"</span>, <span
style="color:#996600;">"-f"</span>, moodfile1, moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Moved "</span>, moodfile1, <span
style="color:#996600;">" to "</span>, moodfile, <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> calcall<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Calculating all nonexisting moodbars...<span
style="color:#000099;">\n</span><span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tracks = <span
style="color:#996600;">`dcop amarok collection query 'SELECT url, deviceid FROM tags;'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; devices = get_devices</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; withMusic = <span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">`dcop amarok script readConfig MoodsWithMusic`</span>.<span
style="color:#CC0066; font-weight:bold;">chomp</span> == <span
style="color:#996600;">"true"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#006666;color:#800000;">0</span>.<span
style="color:#9900CC;">step</span><span
style="color:#006600; font-weight:bold;">&#40;</span>tracks.<span
style="color:#9900CC;">length</span>-<span
style="color:#006666;color:#800000;">1</span>, <span
style="color:#006666;color:#800000;">2</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span> |i|</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; url&nbsp; &nbsp; &nbsp; = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i<span
style="color:#006600; font-weight:bold;">&#93;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; deviceid = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i+<span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#9900CC;">to_i</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; moodfile = <span
style="color:#996600;">""</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; songpath = url.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\./, ''<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">if</span> devices.<span
style="color:#9900CC;">has_key</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; songpath = devices<span
style="color:#006600; font-weight:bold;">&#91;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#93;</span> + songpath</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">if</span> withMusic</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moodfile = songpath.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\.<span
style="color:#006600; font-weight:bold;">&#91;</span>^\.<span
style="color:#006600; font-weight:bold;">&#93;</span>*$/, '.<span
style="color:#9900CC;">mood</span>'<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moodfile = File.<span
style="color:#9900CC;">dirname</span><span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span> + <span
style="color:#996600;">"/."</span> + File.<span
style="color:#9900CC;">basename</span><span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">else</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moodfile = $moodbar_folder \</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + mood_name<span
style="color:#006600; font-weight:bold;">&#40;</span>url.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\.<span
style="color:#006600; font-weight:bold;">&#91;</span>^\.<span
style="color:#006600; font-weight:bold;">&#93;</span>*$/, '.<span
style="color:#9900CC;">mood</span>'<span
style="color:#006600; font-weight:bold;">&#41;</span>, deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">next</span> <span
style="color:#9966CC; font-weight:bold;">if</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; FileTest.<span
style="color:#9900CC;">size</span><span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span
style="color:#006666;color:#800000;">0</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">next</span> <span
style="color:#9966CC; font-weight:bold;">unless</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>songpath<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Saving moodbar for "</span>, songpath, <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"&nbsp; &nbsp;to file "</span>, moodfile, <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">system</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"moodbar"</span>, <span
style="color:#996600;">"-o"</span>, moodfile, songpath<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$mode = ARGV<span
style="color:#006600; font-weight:bold;">&#91;</span><span
style="color:#006666;color:#800000;">0</span><span
style="color:#006600; font-weight:bold;">&#93;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">if</span> !check_amarok_running</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Amarok is not running!&nbsp; Please start Amarok and re-run "</span> \</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#996600;">"this script.<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">if</span> $mode == <span
style="color:#996600;">"-rename"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; rename</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">elsif</span> $mode == <span
style="color:#996600;">"-calcall"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; calcall</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">else</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; usage</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li></ol></div></div></div><p></p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F10%2Fgenerate-mood-moodbar-files-for-your-whole-music-collection.html&amp;title=Generate%20.mood%20moodbar%20files%20for%20your%20whole%20music%20collection" id="wpa2a_16"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>rtorrent-enhanced with ipfilter and GeoIP: Debian Squeeze amd64 package</title><link>http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html</link> <comments>http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html#comments</comments> <pubDate>Thu, 31 Mar 2011 23:15:49 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[amd64]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[geoip]]></category> <category><![CDATA[ipfilter]]></category> <category><![CDATA[package]]></category> <category><![CDATA[rtorrent]]></category> <category><![CDATA[squeeze]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1530</guid> <description><![CDATA[rtorrent is an excellent ncurses rtorrent client. There are a few highly-popular patches, which haven't yet made it into the Squeeze's rtorrent version 0.8.6. Note: ArchLinux already has an rtorrent-extended package, so you may want to look at that one (instead of my Debian package below). I might use Arch's patchset next time to generate [...]]]></description> <content:encoded><![CDATA[<p><img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/shot.png" alt="rtorrent-eyecandy" title="rtorrent-eyecandy (from http://karabaja.pondi.hr/packages/rtorrent-mod/shot.png)" width="698" height="380" class="alignnone size-full wp-image-1533" /><br
/> rtorrent is an excellent ncurses <del
datetime="2011-03-31T21:25:09+00:00">r</del>torrent client.</p><p>There are a few highly-popular patches, which haven't yet made it into the Squeeze's rtorrent version 0.8.6.</p><p><strong>Note</strong>: ArchLinux already has an <a
href="http://aur.archlinux.org/packages.php?ID=33756" rel="nofollow" >rtorrent-extended package</a>, so you may want to look at that one (instead of my Debian package below). I might use Arch's patchset next time to generate a truly extended rtorrent package.</p><p>I've incorporated 3 of such patches (<a
href="http://libtorrent.rakshasa.no/ticket/239" rel="nofollow" >#239</a> ipfilter, <a
href="http://libtorrent.rakshasa.no/ticket/2064" rel="nofollow" >#2064</a> GeoIP support, and <a
href="http://libtorrent.rakshasa.no/ticket/2171" rel="nofollow" >#2171</a> colours/eyecandy), and built a <a
href="/wp-content/uploads/2011/04/rtorrent_0.8.6-1_amd64.deb" rel="nofollow" >squeeze amd64 rtorrent-enhanced package</a>.</p><p><img
src="http://bogdan.org.ua/wp-content/uploads/2011/04/rtorrent-features.png" alt="" title="rtorrent-features" width="675" height="107" class="alignnone size-full wp-image-1537" /></p><p>A few excerpts to explain how these extra features are to be configured and used (all come from the above-mentioned trac tickets, some were edited/extended).</p><p><strong>ipfilter</strong></p><blockquote><p>ipfilter allows to selectively blacklist/whitelist peers - based on IP address range files (so-called ipfilter files). The ipfilter files may, for example, come from bluetack.co.uk. Each line of the file contains a record in this format: <strong>range_description:start_IP-end_IP</strong>, where <em>start_IP</em> should be less than or equal to <em>end_IP</em>. Multiple files can be used. Overlapping ranges are merged automatically. Both incoming and outgoing connections are checked against the filter. Exclusions are not supported, so connection to/from IPs in all the loaded ranges will be disallowed and dropped.</p></blockquote><blockquote><p>Include "ip_filter=<file,...>" directive in .rtorrent.rc. For example (paths are specified relative to user's home directory):<br
/> <strong>ip_filter=ipfilter/level1,ipfilter/level2</strong></p></blockquote><blockquote><p>It is probably a good idea to reload ipfilter files once in a while, so you can also include "reload_ip_filter" directive on schedule to refresh the filter. The same files named in "ip_filter" will be reloaded.</p><p><strong>schedule = filter,18:30:00,24:00:00,reload_ip_filter=</strong></p></blockquote><blockquote><p>To support the feature you may want to setup cron job to reload and unzip files from bluetack. Examples <a
href="http://libtorrent.rakshasa.no/ticket/239#comment:26" rel="nofollow" >here</a> and <a
href="http://pastebin.com/jLqT3qxL" rel="nofollow" >here</a>.</p></blockquote><p><strong>GeoIP</strong></p><blockquote><p>In the Peers view of each torrent a new column - CC, country code - is added, which shows peer's country code. When examining each peer, you will see more data from the GeoIP database (if you have the relevant files installed): AS num and city. At the very least, you need to have <strong>geoip-database</strong> installed. You can get free "lite" versions of <a
href="http://www.maxmind.com/app/geolitecity" rel="nofollow" >city</a>/<a
href="http://geolite.maxmind.com/download/geoip/database/asnum/" rel="nofollow" >AS</a>-databases, rename them (removing "lite") and put into an appropriate location to make rtorrent+geoip use them as well. Geop-isp data support isn't integrated into this rtorrent package.</p></blockquote><p><strong>Colours</strong></p><blockquote><p>This patch somewhat changes the way rtorrent shows torrents. Seeding torrents have bold titles, there are no half-displayed torrents at the top/bottom when scrolling, and you can configure colours for active/done torrents (ticket libtorrent.rakshasa.no/ticket/1382, which seems to be gone now). Source code and testing hint at these configurable colours: <em>done_fg_color, done_bg_color, active_fg_color, active_bg_color</em>, and at these possible values: 1 (red), 2 (green), 3 (yellow).</p></blockquote><p><strong>Geek's cellar</strong><br
/> A related (though not used in any way for the preparation of the package) resource is <a
href="https://calomel.org/rtorrent_mods.html" rel="nofollow" >rtorrent mods page</a>.</p><p>Relatively schematically, applying patches and building the package was performed in these steps (starting within some newly-created directory):</p><ol><li>sudo aptitude install cdbs devscripts [and whatever else you find you're missing]</li><li>apt-get source rtorrent</li><li>dpkg-source -x rtorrent_0.8.6-1.dsc</li><li>cd rtorrent-0.8.6</li><li>cdbs-edit-patch 01-ipfilter.patch</li><li>patch -p1 < /path/to/patch/239</li><li>exit 0</li><li>cdbs-edit-patch 02-geoip.patch</li><li>patch -p1 < /path/to/patch/2064-after-ipfilter</li><li>exit 0</li><li>cdbs-edit-patch 03-eyecandy.patch</li><li>patch -p1 < /path/to/patch/2171-mod-with-canvas</li><li>exit 0 [you could do all 3 patches together, but I prefer cleaner and manageable approaches]</li><li>[some weird operation to be explained below]</li><li>dpkg-buildpackage</li></ol><p>Weird operation: I didn't know how to make dpkg-buildpackage run autorun.sh (which is required for one of the patches I've used) before configure (could someone enlighten me how to do that?), so I started a new patch with cdbs-edit-patch, then ran one by one `autoreconf -if`, `./autorun.sh`, `./configure`, exited with zero status and was done with that problem. The resulting "patch" was 2MB large <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F01%2Frtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html&amp;title=rtorrent-enhanced%20with%20ipfilter%20and%20GeoIP%3A%20Debian%20Squeeze%20amd64%20package" id="wpa2a_20"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to easily install any PyPi/easy_install python module on Debian</title><link>http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html</link> <comments>http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html#comments</comments> <pubDate>Wed, 16 Feb 2011 17:22:20 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[debianize]]></category> <category><![CDATA[easy_install]]></category> <category><![CDATA[pycassa]]></category> <category><![CDATA[PyPi]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1430</guid> <description><![CDATA[Imagine you need to install pycassa (which uses easy_install). Here are the 2 (at maximum) very simple steps to have it properly debianized and installed on your Debian/Ubuntu: if you don't have the python-stdeb package: sudo aptitude install python-stdeb pypi-install pycassa That's it. Refer to stdeb readme for more information. You will need that if [...]]]></description> <content:encoded><![CDATA[<p>Imagine you need to install <a
href="https://github.com/pycassa/pycassa" rel="nofollow" >pycassa</a> (which uses easy_install). Here are the 2 (at maximum) very simple steps to have it properly debianized and installed on your Debian/Ubuntu:</p><ul><li>if you don't have the python-stdeb package: <strong>sudo aptitude install python-stdeb</strong></li><li><strong>pypi-install pycassa</strong></li></ul><p>That's it.</p><p>Refer to <a
href="https://github.com/astraw/stdeb#readme" rel="nofollow" >stdeb readme</a> for more information. You will need that if there are dependencies - which might not be resolved automatically by stdeb.</p><p>Before stdeb, it wasn't exactly trivial to <a
href="http://showmedo.com/videotutorials/video?name=linuxJensMakingDeb" rel="nofollow" >make a .deb from python module</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F02%2F16%2Fhow-to-easily-install-any-pypi-easy_install-python-module-on-debian.html&amp;title=How%20to%20easily%20install%20any%20PyPi%2Feasy_install%20python%20module%20on%20Debian" id="wpa2a_24"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>My favourite command line for mirroring with wget</title><link>http://bogdan.org.ua/2011/01/09/my-favourite-command-line-for-mirroring-with-wget.html</link> <comments>http://bogdan.org.ua/2011/01/09/my-favourite-command-line-for-mirroring-with-wget.html#comments</comments> <pubDate>Sun, 09 Jan 2011 12:30:27 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[mirror]]></category> <category><![CDATA[wget]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1237</guid> <description><![CDATA[wget &#8211;&#8211;continue &#8211;&#8211;mirror &#8211;&#8211;page-requisites &#8211;&#8211;adjust-extension &#8211;&#8211;convert-links &#8211;&#8211;backup-converted &#8211;&#8211;limit-rate=500k &#8211;&#8211;wait=2 URL (short form: wget -cmpEkK &#8211;&#8211;limit-rate=500k -w 2 URL) &#8211;&#8211;continue does no harm on initial run, but when run again this instructs wget to pick up where it was interrupted the previous time &#8211;&#8211;mirror turns on several options useful for mirroring (read wget manual for details) [...]]]></description> <content:encoded><![CDATA[<p>wget &ndash;&ndash;continue &ndash;&ndash;mirror &ndash;&ndash;page-requisites &ndash;&ndash;adjust-extension &ndash;&ndash;convert-links &ndash;&ndash;backup-converted &ndash;&ndash;limit-rate=500k &ndash;&ndash;wait=2 URL</p><p>(short form: wget -cmpEkK &ndash;&ndash;limit-rate=500k -w 2 URL)<br
/> <span
id="more-1237"></span></p><ul><li><strong>&ndash;&ndash;continue</strong> does no harm on initial run, but when run again this instructs wget to pick up where it was interrupted the previous time</li><li><strong>&ndash;&ndash;mirror</strong> turns on several options useful for mirroring (read wget manual for details)</li><li><strong>&ndash;&ndash;page-requisites</strong> instructs wget to also fetch linked resources, which would otherwise be skipped</li><li><strong>&ndash;&ndash;adjust-extension</strong> (or <strong>&ndash;&ndash;html-extension</strong> in older wget versions) will append the .html extension to files without it, but with document type text/html or equivalent</li><li><strong>&ndash;&ndash;convert-links</strong> will convert the links for convenient local viewing</li><li><strong>&ndash;&ndash;backup-converted</strong> helps to avoid re-downloading some files, especially when &ndash;&ndash;convert-links is specified</li><li><strong>&ndash;&ndash;limit-rate=500k</strong> and <strong>&ndash;&ndash;wait=2</strong> prevent overloading the target website (being nice to someone offering information you need is a must)</li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/01/09/my-favourite-command-line-for-mirroring-with-wget.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/01/09/my-favourite-command-line-for-mirroring-with-wget.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F01%2F09%2Fmy-favourite-command-line-for-mirroring-with-wget.html&amp;title=My%20favourite%20command%20line%20for%20mirroring%20with%20wget" id="wpa2a_28"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/01/09/my-favourite-command-line-for-mirroring-with-wget.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to relay outgoing postfix emails via another mail server (e.g. your ISP)</title><link>http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html</link> <comments>http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html#comments</comments> <pubDate>Sat, 04 Dec 2010 18:01:37 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[postfix]]></category> <category><![CDATA[relay]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1218</guid> <description><![CDATA[Here's a simple and clear guide for gmail, which also definitely works with other relay hosts. I've used it to configure my ISP's mail relay (they block outgoing port 25) on a Debian Squeeze laptop.]]></description> <content:encoded><![CDATA[<p>Here's a <a
href="http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/" rel="nofollow" >simple and clear guide for gmail</a>, which also definitely works with other relay hosts. I've used it to configure my ISP's mail relay (they block outgoing port 25) on a Debian Squeeze laptop.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F12%2F04%2Fhow-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html&amp;title=How%20to%20relay%20outgoing%20postfix%20emails%20via%20another%20mail%20server%20%28e.g.%20your%20ISP%29" id="wpa2a_32"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to replace newlines with commas, tabs etc (merge lines)</title><link>http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html</link> <comments>http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html#comments</comments> <pubDate>Tue, 16 Nov 2010 08:20:45 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Bioinformatics]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[awk]]></category> <category><![CDATA[grep]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[paste]]></category> <category><![CDATA[sed]]></category> <category><![CDATA[sort]]></category> <category><![CDATA[tr]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1208</guid> <description><![CDATA[Imagine you need to get a few lines from a group of files with missing identifier mappings. I have a bunch of files with content similar to this one: ENSRNOG00000018677 1368832_at 25233 ENSRNOG00000002079 1369102_at 25272 ENSRNOG00000043451 25353 ENSRNOG00000001527 1388013_at 25408 ENSRNOG00000007390 1389538_at 25493 In the example above I need '25353', which does not have corresponding [...]]]></description> <content:encoded><![CDATA[<p>Imagine you need to get a few lines from a group of files with missing identifier mappings. I have a bunch of files with content similar to this one:</p><blockquote><p> ENSRNOG00000018677      1368832_at      25233<br
/> ENSRNOG00000002079      1369102_at      25272<br
/> ENSRNOG00000043451                            25353<br
/> ENSRNOG00000001527      1388013_at      25408<br
/> ENSRNOG00000007390      1389538_at      25493</p></blockquote><p>In the example above I need '25353', which does not have corresponding affy_probeset_id in the 2nd column.</p><p>It is clear how to do that:</p><div
class="igBar"><span
id="lcode-13"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-13'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-13"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span></div></li></ol></div></div></div><p></p><p>This outputs a column of required IDs (EntrezGene in this example):</p><blockquote><p> 116720<br
/> 679845<br
/> 309295<br
/> 364867<br
/> 298220<br
/> 298221<br
/> 25353</p></blockquote><p>However, I need these IDs as a comma-separated list, not as newline-separated list.</p><p>There are several ways to achieve the desired result (only the last pipe commands differ):</p><div
class="igBar"><span
id="lcode-14"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-14'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-14"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | gawk <span
style="color:#CC0000;">'$1=$1'</span> ORS=<span
style="color:#CC0000;">', '</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-15"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-15'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-15"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | tr <span
style="color:#CC0000;">'<span
style="color:#000099; font-weight:bold;">\n</span>'</span> <span
style="color:#CC0000;">','</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-16"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-16'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-16"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | sed <span
style="color:#CC0000;">':a;N;$!ba;s/<span
style="color:#000099; font-weight:bold;">\n</span>/, /g'</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-17"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-17'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-17"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | sed <span
style="color:#CC0000;">':q;N;s/<span
style="color:#000099; font-weight:bold;">\n</span>/, /g;t q'</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-18"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-18'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-18"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | paste -s -d <span
style="color:#CC0000;">","</span></div></li></ol></div></div></div><p></p><p>These solutions differ in efficiency and (slightly) in output. <strong>sed</strong> will read all the input into its buffer to replace newlines with other separators, so it might not be best for large files. <strong>tr</strong> might be the most efficient, but I haven't tested that. <strong>paste</strong> will re-use delimiters, so you cannot really get comma-space ", " separation with it.</p><p>Sources: <a
href="http://www.linuxquestions.org/questions/programming-9/sed-how-do-you-replace-end-of-line-with-a-space-637013/" rel="nofollow" >linuxquestions 1 (explains used sed commands)</a>, <a
href="http://www.linuxquestions.org/questions/programming-9/merge-lines-in-a-file-using-sed-191121/" rel="nofollow" >linuxquestions 2</a>, <a
href="http://www.cyberciti.biz/faq/linux-unix-sed-replace-newline/" rel="nofollow" >nixcraft</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F11%2F16%2Fhow-to-replace-newlines-with-commas-tabs-etc-merge-lines.html&amp;title=How%20to%20replace%20newlines%20with%20commas%2C%20tabs%20etc%20%28merge%20lines%29" id="wpa2a_36"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to record Skype calls on Linux: use free Skype Call Recorder</title><link>http://bogdan.org.ua/2010/11/11/how-to-record-skype-calls-on-linux-use-free-skype-call-recorder.html</link> <comments>http://bogdan.org.ua/2010/11/11/how-to-record-skype-calls-on-linux-use-free-skype-call-recorder.html#comments</comments> <pubDate>Thu, 11 Nov 2010 13:06:53 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[skype]]></category> <category><![CDATA[skype call recorder]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1205</guid> <description><![CDATA[Just came across Skype Call Recorder - an awesome in its functionality+simplicity tool to record skype calls. Highly recommended! It worked immediately for me, and default settings are good enough not to bother tweaking. Well, I know that because I did tweak a few to get more nerdiness, but normal people don't need that. SCR [...]]]></description> <content:encoded><![CDATA[<p>Just came across <a
href="http://atdot.ch/scr/" rel="nofollow" >Skype Call Recorder</a> - an awesome in its functionality+simplicity tool to record skype calls. Highly recommended!</p><p>It worked immediately for me, and default settings are good enough not to bother tweaking. Well, I know that because I did tweak a few to get more nerdiness, but normal people don't need that.</p><p><a
href="http://atdot.ch/scr/download/" rel="nofollow" >SCR download page</a> has packages for Ubuntu, Debian/i386, Xandros, RPM-based distributions, Gentoo - and as its free, you can of course just use the <del
datetime="2010-11-11T12:48:13+00:00">f</del>source<del
datetime="2010-11-11T12:48:13+00:00">, Luke</del>!</p><p>At the time of writing, a package for Debian/amd64 was not available, but it is really easy to build one.<br
/> Here's mine: <a
href="http://bogdan.org.ua/wp-content/uploads/2010/11/skype-call-recorder-debian_0.8_amd64.deb">skype-call-recorder-debian_0.8_amd64.deb</a></p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/11/11/how-to-record-skype-calls-on-linux-use-free-skype-call-recorder.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/11/11/how-to-record-skype-calls-on-linux-use-free-skype-call-recorder.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F11%2F11%2Fhow-to-record-skype-calls-on-linux-use-free-skype-call-recorder.html&amp;title=How%20to%20record%20Skype%20calls%20on%20Linux%3A%20use%20free%20Skype%20Call%20Recorder" id="wpa2a_40"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/11/11/how-to-record-skype-calls-on-linux-use-free-skype-call-recorder.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Linux server remote backup options</title><link>http://bogdan.org.ua/2010/10/03/linux-server-remote-backup-options.html</link> <comments>http://bogdan.org.ua/2010/10/03/linux-server-remote-backup-options.html#comments</comments> <pubDate>Sun, 03 Oct 2010 19:40:37 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[backup]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[dirvish]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[remote]]></category> <category><![CDATA[server]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1111</guid> <description><![CDATA[Recently I finally managed to configure remote (aka off-site) backup for my Debian server. As always, I started with a comparison of existing solutions. Debian has a number of packages enabling remote (over the network) backup: backupPC, backupninja, backup-manager, dirvish, duplicity, luckybackup, rdiff-backup, and some others. In my setup I wanted backups to be initiated [...]]]></description> <content:encoded><![CDATA[<p>Recently I finally managed to configure remote (aka <em>off-site</em>) backup for my Debian server. As always, I started with a comparison of existing solutions.</p><p>Debian has a number of packages enabling remote (over the network) backup: <a
href="http://packages.debian.org/en/lenny/backuppc" rel="nofollow" >backupPC</a>, <a
href="http://packages.debian.org/en/lenny/backupninja" rel="nofollow" >backupninja</a>, <a
href="http://packages.debian.org/en/lenny/backup-manager" rel="nofollow" >backup-manager</a>, <a
href="http://packages.debian.org/en/squeeze/dirvish" rel="nofollow" >dirvish</a>, <a
href="http://packages.debian.org/en/lenny/duplicity" rel="nofollow" >duplicity</a>, <a
href="http://packages.debian.org/en/squeeze/luckybackup" rel="nofollow" >luckybackup</a>, <a
href="http://packages.debian.org/lenny/rdiff-backup" rel="nofollow" >rdiff-backup</a>, and some others.</p><p><span
id="more-1111"></span>In my setup I wanted backups to be initiated by the external backup server (as opposed to <em>internal</em>, production server initiated backup). Also, I was going to backup linux server to another linux box. Thus, it would be preferable to have support for rsync on both boxes and hardlinks on the backup box. I needed backup to be run regularly, I didn't need any kind of GUI, and I would prefer to keep a bunch of older backups around (in case the most recent backup is of a compromised system, for example). Also, having an incremental backup of SQL databases was yet another requirement.</p><p>A few tools more or less matched my requirements: backupPC, duplicity, rdiff-backup, and dirvish.</p><p><a
href="http://backuppc.sourceforge.net/" rel="nofollow" >backupPC</a>, judging from its description and a few tutorial articles, is a cool piece of software. I think I might use it next time. But this time I really had no need for over-SMB backups (intended for Windows boxes), and no need for a nice administrative web-interface to backupPC. If not these extra features (which I don't currently need) I'd go for backupPC. Here's a <a
href="https://help.ubuntu.com/community/BackupPC" rel="nofollow" >guide for Ubuntu</a>.</p><p><a
href="http://duplicity.nongnu.org/" rel="nofollow" >Duplicity</a> claims to still be in beta, thus I haven't given it a try. <a
href="http://www.nongnu.org/rdiff-backup/" rel="nofollow" >rdiff-backup</a> seemed a bit too simple (and with no ready templates to get working regular backups faster), so I skipped that one as well.</p><p><a
href="http://www.dirvish.org/" rel="nofollow" >Dirvish</a> really caught my attention, partially thanks to a good and relatively <em>short</em> <a
href="http://dtcsupport.gplhost.com/PmWiki/Backup-With-Dirvish-And-Automysqlbackup" rel="nofollow" >quick-start tutorial</a>. That tutorial also mentions <a
href="http://packages.debian.org/en/squeeze/automysqlbackup" rel="nofollow" >automysqlbackup</a> - a nice, almost no-configuration tool to take regular dumps of MySQL databases. In combination, these two now regularly backup up my whole server to another linux box.</p><p>I would definitely recommend using dirvish+automysqlbackup for remote/off-site backup needs. However, other solutions might be as good or better for your use case.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/10/03/linux-server-remote-backup-options.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/10/03/linux-server-remote-backup-options.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F10%2F03%2Flinux-server-remote-backup-options.html&amp;title=Linux%20server%20remote%20backup%20options" id="wpa2a_44"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/10/03/linux-server-remote-backup-options.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Linux: how to label swap partition w/o losing swap UUID</title><link>http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html</link> <comments>http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html#comments</comments> <pubDate>Fri, 16 Jul 2010 12:41:13 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[partition]]></category> <category><![CDATA[swap]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1082</guid> <description><![CDATA[In short: sudo mkswap -L new_swap_label -U old_swap_UUID /dev/sd_swap_device. If you don't care about the UUID: just sudo mkswap -L new_swap_label /dev/sd_swap_device. Step-by-step: Identify current swap UUID: grep swap /etc/fstab ; you should see a line starting with UUID=b4e6e... - note that UUID; let us assume our UUID is b4e6e5d8-8854-4a3e-8edb-f423ded31e2a Identify swap partition device. If [...]]]></description> <content:encoded><![CDATA[<p>In short: <strong>sudo mkswap -L new_swap_label -U old_swap_UUID /dev/sd_swap_device</strong>.<br
/> If you don't care about the UUID: just <strong>sudo mkswap -L new_swap_label /dev/sd_swap_device</strong>.</p><p>Step-by-step:<br
/> <span
id="more-1082"></span></p><ol><li>Identify current swap UUID: <strong>grep swap /etc/fstab</strong> ; you should see a line starting with <strong>UUID=</strong>b4e6e... - note that UUID; let us assume our UUID is <em>b4e6e5d8-8854-4a3e-8edb-f423ded31e2a</em></li><li>Identify swap partition device. If you are using Debian or Ubuntu, device might have been shown to you when running command #1 as a comment of the form<br
/><blockquote># /dev/sdX4       none            swap    sw              0       0</p></blockquote><p> Just to be sure, run <strong>cat /proc/swaps</strong> (or <strong>sudo swapon -s</strong>), to be shown something like this:</p><p><code>Filename                                Type            Size    Used    Priority<br
/> /dev/sdX4                               partition       2104504 0       -1<br
/> </code><br
/> You can also use partition managers to identify swap device, e.g. <strong>sudo fdisk -l</strong>. Let us assume our partition device is <em>sdX4</em>.</li><li>If that swap partition is in use, you need to disable it first: <strong>sudo swapoff /dev/sdX4</strong></li><li>Now that you have both the UUID and the device, run<br
/> <strong>sudo mkswap -L new_swap_label -U b4e6e5d8-8854-4a3e-8edb-f423ded31e2a /dev/sdX4</strong><br
/> Do not forget replacing sample values above (label, UUID and device) with your actual values.</li><li>Enable swap: <strong>sudo swapon /dev/sdX4</strong></li></ol><p>Now, if you wish so, you may proceed to edit /etc/fstab and replace UUID=.... with LABEL=your_new_swap_label, leaving all other spaces and values in that line untouched.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F07%2F16%2Flinux-how-to-label-swap-partition-without-losing-swap-uuid.html&amp;title=Linux%3A%20how%20to%20label%20swap%20partition%20w%2Fo%20losing%20swap%20UUID" id="wpa2a_48"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Best Linux software to import still images from a digital camera</title><link>http://bogdan.org.ua/2010/05/02/best-linux-software-to-import-still-images-from-a-digital-camera.html</link> <comments>http://bogdan.org.ua/2010/05/02/best-linux-software-to-import-still-images-from-a-digital-camera.html#comments</comments> <pubDate>Sat, 01 May 2010 22:08:01 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[digikam]]></category> <category><![CDATA[digital camera]]></category> <category><![CDATA[f-spot]]></category> <category><![CDATA[gThumb]]></category> <category><![CDATA[gtkam]]></category> <category><![CDATA[photo]]></category> <category><![CDATA[picasa]]></category> <category><![CDATA[still image]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1037</guid> <description><![CDATA[Back in the times when Windows was my OS more than 75% of the time in front of the computer, I really liked a simple photos import utility, supplied for Canon digital still image cameras. It allowed the import of all the new media items (photos and movies) from a camera into a pre-configured location [...]]]></description> <content:encoded><![CDATA[<p><img
src="http://bogdan.org.ua/wp-content/uploads/2010/05/digikam.jpg" alt="digikam" title="digikam" width="100" height="76" class="alignleft size-full wp-image-1040" />Back in the times when Windows was my OS more than 75% of the time in front of the computer, I really liked a simple photos import utility, supplied for Canon digital still image cameras. It allowed the import of all the <em>new</em> media items (photos and movies) from a camera into a pre-configured location in one click, and it also automatically created date-based directories for new photos. Given the removable media autoplay feature, after connecting the camera it was really a matter of one click (or one button press) to have everything copied.</p><p>Today, I decided to have a look at what the FOSS community has to match that simple and useful Canon utility. Here's my "rating":</p><ol><li><strong>digikam</strong>: nice and easy import; supports date-based auto-creation of albums (directories); feature-reach, suitable as a primary images-viewing application; my personal "number one" for now.</li><li><strong>f-spot</strong>: easy import; has nice date-based photos browser; on import, converts photo filenames to lower case; my second choice, will have a closer look at its features.</li><li><strong>gThumb</strong>: good import, but haven't found a way to configure/create target directory during import.</li><li><strong>gtkam</strong>: <em>unusual</em> interface; while testing, it died once unexpectedly; otherwise easy to use.</li><li><strong>picasa</strong>: haven't tried to import with a recent version, but I generally dislike the idea of using software which requires an extra layer to run (wine in this case), unless it is unique. Picasa is not unique, and thus looses (in my opinion) to digikam.</li></ol><p>Related: list of <a
href="http://ubuntulinuxhelp.com/top-100-of-the-best-useful-opensource-applications/" rel="nofollow" >100 most useful open-source software tools</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/05/02/best-linux-software-to-import-still-images-from-a-digital-camera.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/05/02/best-linux-software-to-import-still-images-from-a-digital-camera.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F05%2F02%2Fbest-linux-software-to-import-still-images-from-a-digital-camera.html&amp;title=Best%20Linux%20software%20to%20import%20still%20images%20from%20a%20digital%20camera" id="wpa2a_52"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/05/02/best-linux-software-to-import-still-images-from-a-digital-camera.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The list of Linux music players with CUE sheet support</title><link>http://bogdan.org.ua/2010/04/30/the-list-of-linux-music-players-with-cue-sheet-support.html</link> <comments>http://bogdan.org.ua/2010/04/30/the-list-of-linux-music-players-with-cue-sheet-support.html#comments</comments> <pubDate>Fri, 30 Apr 2010 18:45:02 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[CUE]]></category> <category><![CDATA[FLAC]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[music]]></category> <category><![CDATA[player]]></category> <category><![CDATA[sheet]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1033</guid> <description><![CDATA[Last updated: 2011-12-13 Clementine music player DeaDBeeF (as in 0xDEADBEEF) is an audio player for GNU/Linux systems with X11 (though now it also runs in plain console without X, in FreeBSD, and in OpenSolaris) with CUE sheets support AudioPlayer51 is a free, open-source, cross-platform audio player written to handle FLAC files and CUE sheets (exclusively). [...]]]></description> <content:encoded><![CDATA[<p><ins
datetime="2011-12-13T13:18:00+00:00">Last updated: 2011-12-13</ins></p><ul><li><a
href="http://www.clementine-player.org/" rel="nofollow" >Clementine</a> music player</li><li><a
href="http://deadbeef.sourceforge.net/" rel="nofollow" >DeaDBeeF</a> (as in 0xDEADBEEF) is an audio player for GNU/Linux systems with X11 (though now it also runs in plain console without X, in FreeBSD, and in OpenSolaris) with CUE sheets support</li><li><a
href="http://audioplayer51.org/features.php" rel="nofollow" >AudioPlayer51</a> is a free, open-source, cross-platform audio player written to handle FLAC files and CUE sheets (exclusively). If you don't use FLAC files and CUE sheets, you won't find AudioPlayer51 very useful.</li><li><a
href="http://amarok.kde.org/" rel="nofollow" >Amarok</a>: only for WAV+CUE, doesn't currently support FLAC+CUE; <a
href="http://amarok.kde.org/blog/archives/1172-Something-for-Amarok-2.3.1+.html" rel="nofollow" >version 2.3.1 is promised to fully support CUE sheets</a></li><li><a
href="http://audacious-media-player.org/" rel="nofollow" >Audacious</a> (through the .cue plugin)</li><li><a
href="http://qmmp.ylsoftware.com/index_en.php" rel="nofollow" >QMMP</a> (haven't tested this one)</li><li>XMMS through <a
href="http://brianvictor.tripod.com/mp3cue.htm" rel="nofollow" >mp3cue</a> (also untested)</li><li><a
href="http://www.foobnix.com/welcome?lang=en" rel="nofollow" >foobnix</a> (untested, suggested in <a
href="http://bogdan.org.ua/2010/10/16/installing-deadbeef-music-player-on-debian.html#comment-130026">this comment</a>)</li><li><a
href="http://cueplay.sf.net/" rel="nofollow" >cueplay</a></li></ul><p>Some extra links:</p><ul><li><a
href="http://aidanjm.wordpress.com/2007/02/15/split-lossless-audio-ape-flac-wv-wav-by-cue-file/" rel="nofollow" class="broken_link">split lossless multiple-track files by CUE sheets</a></li><li><a
href="http://mp3splt.sourceforge.net/mp3splt_page/home.php" rel="nofollow" >mp3split</a></li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/04/30/the-list-of-linux-music-players-with-cue-sheet-support.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/04/30/the-list-of-linux-music-players-with-cue-sheet-support.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F04%2F30%2Fthe-list-of-linux-music-players-with-cue-sheet-support.html&amp;title=The%20list%20of%20Linux%20music%20players%20with%20CUE%20sheet%20support" id="wpa2a_56"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/04/30/the-list-of-linux-music-players-with-cue-sheet-support.html/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>screen mastery with only 3 keyboard shortcuts</title><link>http://bogdan.org.ua/2010/03/01/screen-mastery-with-only-3-keyboard-shortcuts.html</link> <comments>http://bogdan.org.ua/2010/03/01/screen-mastery-with-only-3-keyboard-shortcuts.html#comments</comments> <pubDate>Mon, 01 Mar 2010 17:11:57 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[screen]]></category> <category><![CDATA[screenie]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1003</guid> <description><![CDATA[screen is a must-use for anyone familiar with SSH sessions; it saves your time by keeping your console apps running even after (an unexpected) disconnect from the remote session. The easiest way to start with screen is screenie - an interface to screen. To use it, you only need to memorize a single keyboard shortcut: [...]]]></description> <content:encoded><![CDATA[<p><strong>screen</strong> is a must-use for anyone familiar with SSH sessions; it saves your time by keeping your console apps running even after (an unexpected) disconnect from the remote session.</p><p>The easiest way to start with screen is <strong>screenie</strong> - an interface to screen. To use it, you only need to memorize a single keyboard shortcut: <strong>C-a d</strong> (<strong>Ctrl+a, d</strong>). This shortcut detaches (hides) your current screen session, allowing to resume later - either with the help of <strong>screenie</strong>, or by issuing <strong>screen -r</strong> command.</p><p>After a while, with increased screen (and screenie) usage, you will find it inconvenient detaching every time you need a new screen session. Here comes the second keyboard shortcut: <strong>C-a c</strong> (<strong>Ctrl+a, c</strong>), which creates a new window within a current screen session, and switches to it.</p><p>Finally, you will find it tiresome detaching to then re-attach to a different screen. <strong>C-a "</strong> (<strong>Ctrl+a, Shift+'</strong>) will display a list of screen windows for you to select and switch to.</p><p><strong>Screenie</strong>, an excellent beginner's interface to screen, is no longer needed after you memorize these 3 keyboard shortcuts.</p><p>Many will say that <em>this is a bare minimum</em>, and also <em>there is much more to screen than what you present here</em>, and that will be true. However, these 3 shortcuts are sufficient for simple but convenient everyday screen sessions management.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/03/01/screen-mastery-with-only-3-keyboard-shortcuts.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/03/01/screen-mastery-with-only-3-keyboard-shortcuts.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fscreen-mastery-with-only-3-keyboard-shortcuts.html&amp;title=screen%20mastery%20with%20only%203%20keyboard%20shortcuts" id="wpa2a_60"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/03/01/screen-mastery-with-only-3-keyboard-shortcuts.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>ntfstruncate binary for Debian (resetting NTFS bad clusters counter)</title><link>http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html</link> <comments>http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html#comments</comments> <pubDate>Mon, 01 Mar 2010 16:55:56 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[bad clusters]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[linux-ntfs]]></category> <category><![CDATA[NTFS]]></category> <category><![CDATA[ntfsprogs]]></category> <category><![CDATA[ntfstruncate]]></category> <category><![CDATA[partition]]></category> <category><![CDATA[pending sectors]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1000</guid> <description><![CDATA[There is an excellent step-by-step instruction on resetting the bad clusters counter of an NTFS partition with linux-ntfs tools. I've checked - it works as expected: Back up important data from partition just in case Find out size of '$Bad' attribute in $Badclus using ntfsinfo -i 8 partition (partition is for example /dev/sda1). It will [...]]]></description> <content:encoded><![CDATA[<p>There is an <a
href="http://www.linux-ntfs.org/doku.php?id=ntfsclone#reseting_the_bad_sectors_list_after_cloning" rel="nofollow" >excellent step-by-step instruction</a> on resetting the bad clusters counter of an NTFS partition with linux-ntfs tools. I've checked - it works as expected:</p><blockquote><ol><li>Back up important data from partition just in case</li><li>Find out size of '$Bad' attribute in $Badclus using <strong>ntfsinfo -i 8 <em>partition</em></strong> (<em>partition</em> is for example /dev/sda1). It will be the “Allocated size” value in the “Dumping attribute $DATA (0<code>x</code>80)” (there will be two 0<code>x</code>80 attributes. Only one has an “Allocated size” line). Let us write down (remember) this size as <em>ntfs_size</em>.</li><li>Use <strong>ntfstruncate <em>partition</em> 8 0<code>x</code>80 '$Bad' 0</strong> to set $Bad's attribute length to zero.</li><li>Use <strong>ntfstruncate <em>partition</em> 8 0<code>x</code>80 '$Bad' <em>ntfs_size</em></strong> to set $Bad's attribute length back to proper value <em>ntfs_size</em> which was recorded in step 2.</li><li>Boot into Windows and run <strong>chkdsk -f <em>diskname</em></strong>. It will find errors and should fix them.</li></ol></blockquote><p>However, Debian's <strong>ntfsprogs</strong> package does not have the <strong>ntfstruncate</strong> binary.</p><p>Here's how you can easily build one yourself (you may need a few extra packages with build tools for that):<br
/> <span
id="more-1000"></span></p><ol><li><strong>apt-get source ntfsprogs</strong></li><li><strong>cd linux-ntfs-2.0.0</strong></li><li><strong>./configure &#038;& make extra</strong></li><li><strong>cd ntfsprogs &#038;& ./ntfstruncate</strong></li></ol><p>You can also install ntfstruncate system-wide, but I have no idea if that will interfere with the already-installed ntfsprogs package, so I just used this binary directly from linux-ntfs-2.0.0/ntfsprogs.</p><p>Bad clusters happen not only when cloning an NTFS partition between 2 physical hard disk drives. Once, after a brief blackout (with a turned on PC, and not on a UPS), the SMART status of my new HDD started showing 1 'Pending sector'. Correspondingly, all the SMART tests (performed with a <strong>smartctl</strong> utility) reported read errors. To help my HDD examine and fix the problem itself, I performed a write operation to that single unreadable sector, which restored it (and reset the 'Pending sector' counter back to zero). It was possible, because not the physical sector itself, but the hidden CRC field had errors after power failure; modern hard drives can detect and fix this kind of errors upon write operations (read operations only mark the sector as 'pending', because data read is not consistent with the stored CRC).</p><p>However, NTFS partition still had 4096 bytes in 'bad clusters'. A little research revealed the presence of internal NTFS bad clusters counter, which can be reset following the procedures above.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;title=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" id="wpa2a_64"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Chandler 1.0.3 package for Debian testing amd64</title><link>http://bogdan.org.ua/2010/01/25/chandler-1-0-3-package-for-debian-testing-amd64.html</link> <comments>http://bogdan.org.ua/2010/01/25/chandler-1-0-3-package-for-debian-testing-amd64.html#comments</comments> <pubDate>Mon, 25 Jan 2010 08:52:26 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[amd64]]></category> <category><![CDATA[Chandler]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[package]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=976</guid> <description><![CDATA[Recently, I have come across the Chandler project. Chandler is a sophisticated organizer, including tasks, calendar, appointments, invitations, and many more. The project does provide a 64-bit package for Ubuntu 8.10 "Intrepid Ibex", but it has a dependency on python-zope-interface - which in Debian testing is a virtual package, currently provided by python-zope.interface. That single [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://chandlerproject.org/" rel="nofollow" ><img
src="http://bogdan.org.ua/wp-content/uploads/2010/01/chandler-project-logo.png" alt="" title="chandler-project-logo" width="192" height="39" class="alignleft size-full wp-image-979" /></a>Recently, I have come across the <a
href="http://chandlerproject.org/" rel="nofollow" >Chandler project</a>. Chandler is a sophisticated organizer, including tasks, calendar, appointments, invitations, and many more.</p><p>The project does provide a <a
href="http://downloads.osafoundation.org/chandler/releases/1.0.3/#enduserlinux" rel="nofollow" >64-bit package</a> for Ubuntu 8.10 "Intrepid Ibex", but it has a dependency on python-zope-interface - which in Debian testing is a virtual package, currently provided by python-zope.interface. That single dependency made my aptitude complain all the time, so I edited the .deb-file, renaming depends/python-zope-interface to depends/python-zope.interface (following <a
href="http://thedarkmaster.wordpress.com/2008/05/24/how-to-create-manipulate-a-deb-file-of-a-compiled-application/" rel="nofollow" >nice and simple instructions</a>). After that - no more aptitude complaints, and Chandler works fine.</p><p>Download the <a
href="http://bogdan.org.ua/wp-content/uploads/2010/01/chandler-1.0.3-amd64-Debian-testing.deb">modified Chandler 1.0.3 Debian testing amd64 package</a> (md5: 239071715977bea2eb75f3bb54491a02).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/01/25/chandler-1-0-3-package-for-debian-testing-amd64.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/01/25/chandler-1-0-3-package-for-debian-testing-amd64.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F01%2F25%2Fchandler-1-0-3-package-for-debian-testing-amd64.html&amp;title=Chandler%201.0.3%20package%20for%20Debian%20testing%20amd64" id="wpa2a_68"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/01/25/chandler-1-0-3-package-for-debian-testing-amd64.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>fail2ban and Google translate: how to easily cut your WP blog traffic</title><link>http://bogdan.org.ua/2009/11/14/fail2ban-and-google-translate-how-to-easily-cut-your-wp-blog-traffic.html</link> <comments>http://bogdan.org.ua/2009/11/14/fail2ban-and-google-translate-how-to-easily-cut-your-wp-blog-traffic.html#comments</comments> <pubDate>Sat, 14 Nov 2009 00:11:08 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[WP PlugIns]]></category> <category><![CDATA[blog]]></category> <category><![CDATA[fail2ban]]></category> <category><![CDATA[fopen]]></category> <category><![CDATA[global trasnlator]]></category> <category><![CDATA[google translate]]></category> <category><![CDATA[maxretry]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[php-url-fopen]]></category> <category><![CDATA[regex]]></category> <category><![CDATA[rule]]></category> <category><![CDATA[traffic]]></category> <category><![CDATA[URL]]></category> <category><![CDATA[whitelist]]></category> <category><![CDATA[wordpress]]></category> <category><![CDATA[WP]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=935</guid> <description><![CDATA[fail2ban has a php-url-fopen rule. WordPress has a Global Translator plugin, which - among others - uses Google Translate service. If someone uses Google Translate (e.g. using Global Translate's mini-language-flags), and goes back to your blog - that someone might get banned by fail2ban (especially if you have set maxretry to 1), as the referrer [...]]]></description> <content:encoded><![CDATA[<p><img
src="http://bogdan.org.ua/wp-content/uploads/2009/11/translate_logo.gif" alt="translate_logo" title="translate_logo" width="205" height="40" class="alignleft size-full wp-image-937" /><a
href="http://www.fail2ban.org/" rel="nofollow" >fail2ban</a> has a php-url-fopen rule.</p><p><a
href="http://wordpress.org/" rel="nofollow" >WordPress</a> has a <a
href="http://www.nothing2hide.net/wp-plugins/wordpress-global-translator-plugin/" rel="nofollow" >Global Translator plugin</a>, which - among others - uses <a
href="http://translate.google.com/" rel="nofollow" >Google Translate</a> service.</p><p>If someone uses Google Translate (e.g. using Global Translate's mini-language-flags), and goes back to your blog - that someone might get banned by fail2ban (especially if you have set maxretry to 1), as the referrer will contain the php-URL-fopen attack signature. The bad thing is that you will not realize that until after you check one or several translations yourself, as a random site visitor experiencing the problem is highly unlikely to bother reporting this problem - especially when your blog's Contact page is also inaccessible.</p><p>Clearly, Google Translate is not the only legitimate service which will trigger that rule.</p><p>Solution: The only solution I have found is to specify the whitelist regex for the php-URL-fopen rule.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/11/14/fail2ban-and-google-translate-how-to-easily-cut-your-wp-blog-traffic.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/11/14/fail2ban-and-google-translate-how-to-easily-cut-your-wp-blog-traffic.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F11%2F14%2Ffail2ban-and-google-translate-how-to-easily-cut-your-wp-blog-traffic.html&amp;title=fail2ban%20and%20Google%20translate%3A%20how%20to%20easily%20cut%20your%20WP%20blog%20traffic" id="wpa2a_72"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/11/14/fail2ban-and-google-translate-how-to-easily-cut-your-wp-blog-traffic.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>R under Debian testing/i386: permanently set pdfviewer option</title><link>http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html</link> <comments>http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html#comments</comments> <pubDate>Wed, 21 Oct 2009 14:06:37 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[pdfviewer]]></category> <category><![CDATA[R]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=909</guid> <description><![CDATA[If you get this message when opening vignettes: Error in openPDF(vif) : getOption('pdfviewer') is ''; please use 'options(pdfviewer=...)' and you are tired of running this command every time: > options(pdfviewer="okular") then you should check if your system-wide Renviron file has proper PDF viewer set: grep -i pdf /etc/R/Renviron R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'/usr/bin/pdflatex'}} R_RD4PDF=${R_RD4PDF-'times,hyper'} ## Default PDF viewer R_PDFVIEWER=${R_PDFVIEWER-''} [...]]]></description> <content:encoded><![CDATA[<p>If you get this message when opening vignettes:</p><blockquote><p>Error in openPDF(vif) :<br
/> getOption('pdfviewer') is ''; please use 'options(pdfviewer=...)'</p></blockquote><p>and you are tired of running this command every time:</p><blockquote><p>> options(pdfviewer="okular")</p></blockquote><p>then you should check if your system-wide <strong>Renviron</strong> file has proper PDF viewer set:<br
/> <span
id="more-909"></span><br
/> <strong>grep -i pdf /etc/R/Renviron</strong></p><blockquote><p>R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'/usr/bin/pdflatex'}}<br
/> R_RD4PDF=${R_RD4PDF-'times,hyper'}<br
/> ## Default PDF viewer<br
/> R_PDFVIEWER=${R_PDFVIEWER-''}</p></blockquote><p>It wasn't in my case.</p><p>To set one, either edit the system-wide Renviron (e.g. by editing the <strong>R_PDFVIEWER=${R_PDFVIEWER-''}</strong> line to look like <strong>R_PDFVIEWER=${R_PDFVIEWER-'/usr/bin/xdg-open'}</strong> - this will use MIME types to open your preferred PDF viewer), or one of the per-user/per-directory Renviron files to fix this minor annoyance (format is the same, e.g. R_PDFVIEWER=okular ).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F10%2F21%2Fr-under-debian-testingi386-permanently-set-pdfviewer-option.html&amp;title=R%20under%20Debian%20testing%2Fi386%3A%20permanently%20set%20pdfviewer%20option" id="wpa2a_76"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Convenient design and debugging of regular expressions under Linux</title><link>http://bogdan.org.ua/2009/10/10/convenient-design-and-debugging-of-regular-expressions-under-linux-tools-comparison.html</link> <comments>http://bogdan.org.ua/2009/10/10/convenient-design-and-debugging-of-regular-expressions-under-linux-tools-comparison.html#comments</comments> <pubDate>Sat, 10 Oct 2009 15:51:18 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[debugging]]></category> <category><![CDATA[kodos]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[RE]]></category> <category><![CDATA[redet]]></category> <category><![CDATA[regexp]]></category> <category><![CDATA[regular expression]]></category> <category><![CDATA[txt2regexp]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=890</guid> <description><![CDATA[Regular expressions (regexps) are powerful indeed. But debugging non-trivial regexps is a burden even if you understand how regexps work, and remember most (if not all) regexp syntax. Miscellaneous tools exist to ease this task. This post was inspired by redet's comparison of regexp helper tools - it could be sufficient to read only that, [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://bogdan.org.ua/wp-content/uploads/2009/10/redet-supported-languages.png"><img
src="http://bogdan.org.ua/wp-content/uploads/2009/10/redet-supported-languages-199x171.png" alt="redet-supported languages" title="redet-supported languages" width="199" height="171" class="alignleft size-thumbnail wp-image-896" /></a>Regular expressions (regexps) are powerful indeed. But debugging non-trivial regexps is a burden even if you understand how regexps work, and remember most (if not all) regexp syntax.</p><p>Miscellaneous tools exist to ease this task. This post was inspired by <a
href="http://billposer.org/Software/redet.html#comparison" rel="nofollow" >redet's comparison of regexp helper tools</a> - it could be sufficient to read only that, if you're going to try the mentioned tools yourself. Otherwise, read on.<br
/> <span
id="more-890"></span><br
/> <a
href="http://kodos.sourceforge.net/" rel="nofollow" >Kodos</a> is an easy-to-use (but powerful enough) Python tool to verify regular expressions against sample user-provided strings. Available for both Linux and Windows. Generates ready-to-use Python regexp code.</p><p><a
href="http://billposer.org/Software/redet.html" rel="nofollow" >redet</a> <a
href="http://billposer.org/Software/redet.html#comparison" rel="nofollow" >assumes some knowledge</a> of REs. Unlike all the other helper tools, it has the widest code generation coverage - just go to "Tools->Save command information" to generate code (Python, Perl, C, grep - just to name a few of the <strong>57 (!)</strong> languages/tools/editors supported). At the same time, redet does not depend on specific versions of all supported RE engines - instead, redet automatically tests for features in available versions.</p><p><a
href="http://laurent.riesterer.free.fr/regexp/" rel="nofollow" >visual-regexp</a> is similar to kodos in features.</p><p><a
href="http://txt2regex.sourceforge.net/" rel="nofollow" >txt2regex</a> is a regex wizard written in bash, capable of generating code for <strong>24</strong> languages/editors/programs (by default, these are enabled: perl, php, postgres, python, sed and vim). It is really simple and convenient, though some understanding of "groups" and "character ranges" is highly recommended.</p><p><a
href="http://websvn.kde.org/trunk/playground/utils/kregexpeditor/" rel="nofollow" class="broken_link">KRegExpEditor</a> was a part of kde3-utils, and seems to be missing from current KDE 4.3. It is similar to kodos and visual-regexp in its philosophy and features.</p><p>I would recommend using one of kodos/visual-regexp/kregexpeditor to quickly test or design your regular expression, then use redet to generate appropriate source code. As an alternative (and when working in a console), just use txt2regexp to generate the code you need.</p><p>Tools I haven't tried include <a
href="http://www.weitz.de/regex-coach/" rel="nofollow" >regex coach</a> and <a
href="http://freshmeat.net/projects/regexpviewer/" rel="nofollow" >regexpviewer</a>.</p><p>Please also see this extensive <a
href="http://billposer.org/Linguistics/Computation/Resources.html#patterns" rel="nofollow" >list of regular expression and pattern-matching related</a> software.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/10/convenient-design-and-debugging-of-regular-expressions-under-linux-tools-comparison.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/10/convenient-design-and-debugging-of-regular-expressions-under-linux-tools-comparison.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F10%2F10%2Fconvenient-design-and-debugging-of-regular-expressions-under-linux-tools-comparison.html&amp;title=Convenient%20design%20and%20debugging%20of%20regular%20expressions%20under%20Linux" id="wpa2a_80"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/10/10/convenient-design-and-debugging-of-regular-expressions-under-linux-tools-comparison.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
