<?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>Vita di un sys-admin &#187; Linux</title>
	<atom:link href="http://blog.angelofailla.com/category/informatica/9/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.angelofailla.com</link>
	<description>Storie, esperienze e pensieri da Dublino.</description>
	<lastBuildDate>Sun, 14 Aug 2011 22:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Highlight text on the fly thanks to terminfo and sed.</title>
		<link>http://blog.angelofailla.com/2011/06/27/highlight-text-on-the-fly-thanks-to-terminfo-and-sed/</link>
		<comments>http://blog.angelofailla.com/2011/06/27/highlight-text-on-the-fly-thanks-to-terminfo-and-sed/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 18:36:02 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[terminfo]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=2337</guid>
		<description><![CDATA[A colleague today was looking for a way to pipe something to a command that highlights particular strings of text, keeping intact the stdin, similar to what you can see on some modern distros, ie Gentoo. Grep is not the way as it only prints the lines which contain the pattern that we are looking [...]]]></description>
			<content:encoded><![CDATA[<p>A colleague today was looking for a way to pipe something to a command that highlights particular strings of text, keeping intact the stdin, similar to what you can see on some modern distros, ie Gentoo.</p>
<p>Grep is not the way as it only prints the lines which contain the pattern that we are looking for.</p>
<p>While there are a bunch of tools that can do that, like supercat, etc. I felt no need to install additional packages for something you can do with few lines of bash and knowing terminal capabilities.</p>
<p>Therefore I wrote this small script, put it in the PATH env variable. The script uses sed and makes use of the terminfo database and of the terminal capabilities to color the text, here it is in case you find it useful:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">red</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tput bold;tput setaf <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">normal</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tput sgr0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> line; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$line</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/\($1\)/<span style="color: #007800;">$red</span>\1<span style="color: #007800;">$normal</span>/&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>If you don&#8217;t like red just read `man tput` and read <a href="http://wiki.bash-hackers.org/scripting/terminalcodes">this link</a> about terminal codes.</p>
<p>Example of usage:</p>
<p><a href="http://blog.angelofailla.com/wp-content/uploads/2011/06/highlight.jpg"><img src="http://blog.angelofailla.com/wp-content/uploads/2011/06/highlight.jpg" alt="" title="highlight" width="607" height="284" class="aligncenter size-full wp-image-2343" /></a></p>
<p>It also accept regexps (in sed syntax, not perl syntax), for example:</p>
<p><code><br />
$ sudo tail -f /var/log/system.log | highlight [Ss]potify<br />
</code></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=2337&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2011%2F06%2F27%2Fhighlight-text-on-the-fly-thanks-to-terminfo-and-sed%2F&amp;title=Highlight%20text%20on%20the%20fly%20thanks%20to%20terminfo%20and%20sed." id="wpa2a_2"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2011/06/27/highlight-text-on-the-fly-thanks-to-terminfo-and-sed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Setting up WordPress Multisite on Debian 5.0 (lenny)</title>
		<link>http://blog.angelofailla.com/2010/12/29/setting-up-wordpress-multisite-on-debian-5-0-lenny/</link>
		<comments>http://blog.angelofailla.com/2010/12/29/setting-up-wordpress-multisite-on-debian-5-0-lenny/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 18:09:35 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[multisite]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp3]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=2095</guid>
		<description><![CDATA[This post explains how to install WordPress 3.x on a Debian lenny and to set up a multisite installation on your Debian server. All the blogs will log into the same file /var/log/apache2/access.log; the first column will be the blog host and port (see the LogFormat configured below). This chapter is based on information collected [...]]]></description>
			<content:encoded><![CDATA[<p>This post explains how to install WordPress 3.x on a Debian lenny and to set up a multisite installation on your Debian server.</p>
<p>All the blogs will log into the same file <code>/var/log/apache2/access.log</code>; the first column will be the blog host and port (see the LogFormat configured below).</p>
<p>This chapter is based on information collected at http://codex.wordpress.org/Create_A_Network and in <code>/usr/share/doc/wordpress/README.Debian</code>.</p>
<p>All WordPress blogs will use the same shared PHP code in <code>/usr/share/wordpress</code>.</p>
<p><strong>Assumptions</strong></p>
<ul>
<li>Main website will be http://domain.com</li>
<li>Blogs will be under http://${blogname}.domain.com</li>
</ul>
<p>File uploaded into the main blog (www.domain.com) will be stored in <code>/srv/www/wp-uploads/domain.com/%year/%month/</code></p>
<p>Files uploaded into the <code>*.domain.com</code> blogs will be stored in <code>/usr/share/wordpress/wp-content/blogs.dir/${blog_id}/files/%year/%month/</code>, where <code>${blog_id}</code> is the numeric id of the blog, as managed by the Multisite feature.</p>
<p><strong>Configuration of Debian lenny-backports repository and installation</strong></p>
<p>WordPress 3.x is not in lenny so we have to use the backport repository.<br />
Excute this as root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;deb http://backports.debian.org/debian-backports lenny-backports main&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&lt;&lt;</span>EOF <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>preferences
Package: <span style="color: #000000; font-weight: bold;">*</span>
Pin: release <span style="color: #007800;">a</span>=lenny-backports
Pin-Priority: <span style="color: #000000;">200</span>
EOF
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">-t</span> lenny-backports <span style="color: #c20cb9; font-weight: bold;">install</span> wordpress</pre></div></div>

<p><strong>Installation of non free swf plugin</strong></p>
<p>As stated in <code>/usr/share/doc/wordpress/README.Debian</code> WordPress originally comes with a Flash-based tool that allows to upload files. However, that tool violates the Debian Policy, as stated in the<br />
bug #591195. That is why this tool is not shipped with the Debian package anymore. If you want to enable this feature, you need to install the Flash file yourself with the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-includes<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>swfupload<span style="color: #000000; font-weight: bold;">/</span>swfupload.swf http:<span style="color: #000000; font-weight: bold;">//</span>core.svn.wordpress.org<span style="color: #000000; font-weight: bold;">/</span>branches<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3.0</span><span style="color: #000000; font-weight: bold;">/</span>wp-includes<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>swfupload<span style="color: #000000; font-weight: bold;">/</span>swfupload.swf</pre></div></div>

<p><strong>Configure your DNS server</strong></p>
<p>Add the following records in your zone (I suppose you know how to deal with your DNS zone):</p>

<div class="wp_syntax"><div class="code"><pre class="bind" style="font-family:monospace;">; wp multisite
$ORIGIN        IN A       ${IP}
www            IN A       ${IP}
*.domain.com.  IN CNAME   www</pre></div></div>

<p><strong>Apache configuration</strong></p>
<p>Configure the <code>vhost_combined</code> log format in <code>/etc/apache2/apache2.conf</code> modifying the default one:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">LogFormat</span> <span style="color: #7f007f;">&quot;%{Host}i:%p %h %l %u %t <span style="color: #000099; font-weight: bold;">\&quot;</span>%r<span style="color: #000099; font-weight: bold;">\&quot;</span> %&gt;s %O <span style="color: #000099; font-weight: bold;">\&quot;</span>%{Referer}i<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>%{User-Agent}i<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> vhost_combined</pre></div></div>

<p>Configure apache in <code>/etc/apache2/sites-available/wordpress-multisite</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;
<span style="color: #00007f;">UseCanonicalName</span>    <span style="color: #0000ff;">Off</span>
&nbsp;
<span style="color: #00007f;">ServerAlias</span> *.domain.com domain.com
<span style="color: #00007f;">ServerName</span> www.domain.com
<span style="color: #00007f;">DocumentRoot</span> /srv/www/domain.com/
&nbsp;
<span style="color: #00007f;">Options</span> <span style="color: #0000ff;">All</span>
<span style="color: #00007f;">ServerAdmin</span> you@domain.com
&nbsp;
<span style="color: #adadad; font-style: italic;"># Store uploads of www.domain.com in /srv/www/wp-uploads/$0</span>
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteRule</span> ^/wp-uploads/(.*)$ /srv/www/wp-uploads/%{HTTP_HOST}/$1
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">Directory</span> /&gt;
        <span style="color: #00007f;">Options</span> <span style="color: #0000ff;">FollowSymLinks</span>
        <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span>
&lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;
&nbsp;
<span style="color: #00007f;">CustomLog</span> /var/log/apache2/access.log vhost_combined
&nbsp;
<span style="color: #adadad; font-style: italic;"># this is needed when activating multisite, WP needs to to a </span>
<span style="color: #adadad; font-style: italic;"># fopen(&quot;http://randomname.domain.com&quot;) to verify</span>
<span style="color: #adadad; font-style: italic;"># that apache is correctly configured</span>
<span style="color: #00007f;">php_admin_flag</span> allow_url_fopen <span style="color: #0000ff;">on</span>
&nbsp;
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

<p>Configure <code>/etc/wordpress/htaccess</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">IfModule</span> mod_rewrite.c&gt;
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteBase</span> /
<span style="color: #00007f;">RewriteRule</span> ^index\.php$ - [L]
<span style="color: #adadad; font-style: italic;">## uploaded files</span>
<span style="color: #00007f;">RewriteRule</span> ^files/(.+) wp-<span style="color: #0000ff;">includes</span>/ms-files.php?file=$1 [L]
<span style="color: #adadad; font-style: italic;">## real files dealt directly</span>
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -f [OR]
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -d
<span style="color: #00007f;">RewriteRule</span> ^ - [L]
<span style="color: #adadad; font-style: italic;">## other go through index.php</span>
<span style="color: #00007f;">RewriteRule</span> . index.php [L]
&lt;/<span style="color: #000000; font-weight:bold;">IfModule</span>&gt;</pre></div></div>

<p>Enable the config executing this as root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2ensite wordpress-multisite
a2enmod rewrite <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> a2enmod vhost_alias
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p><strong>Setting some permissions</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># required to allow the main site to upload content</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> www-data <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> www-data <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># required to allow subdomains site to upload content</span>
<span style="color: #c20cb9; font-weight: bold;">chgrp</span> www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>blogs.dir<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> g+<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>blogs.dir<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># required in order to be able to install/update themes/plugins </span>
<span style="color: #666666; font-style: italic;"># from the webgui (only on the main site)</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-admin<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p><strong>Creating main site</strong></p>
<p>At this stage we can create the main site using this bash script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>examples<span style="color: #000000; font-weight: bold;">/</span>setup-mysql <span style="color: #660033;">-n</span> main domain.com</pre></div></div>

<p>This script creates the DB &#038; tables and it also creates a file called <code>/etc/wordpress/config-domain.com.php</code>.</p>
<p>You should end up with the following files:</p>
<ul>
<li><code>/etc/wordpress/config-domain.com.php</code>
</li>
<li><code>/srv/www/domain.com</code> symlink to -> <code>/usr/share/wordpress</code>
</li>
<li><code>/srv/www/wp-uploads/domain.com/</code></li>
</ul>
<p><strong>Activating Network (aka multisite)</strong></p>
<p>At this stage you should log into http://domain.com and follow the on screen instructions.<br />
Once you are in the backend you can than click into the &#8220;Tools -> Network&#8221; link and enable the mulsite, this will create some tables in your db and it will ask you to copy&#038;paste some lines into <code>/etc/wordpress/config-domain.com.php</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SUBDOMAIN_INSTALL'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'DOMAIN_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'domain.com'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'PATH_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SITE_ID_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'BLOG_ID_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SECURE_AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'LOGGED_IN_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'NONCE_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'AUTH_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SECURE_AUTH_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'LOGGED_IN_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'NONCE_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'MULTISITE'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># for debugging purposes only
</span><span style="color: #666666; font-style: italic;"># define('WP_DEBUG', true);</span></pre></div></div>

<p>After that you&#8217;re ready to go <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Logging as super admin and going into the SuperAdmin webgui area you can create new subdomains (blogs), and users, when you can create blogs an email is sent to the owner, you can personalize templates, decide how much storage space you want to assign to every single blog, etc, etc.</p>
<p>At this point you should be able to also install/upgrade plugins and themes straight from the web gui.<br />
Note that <code>define('WP_CORE_UPDATE', false);</code> in your config file will disable the auto update, your wordpress update cycle will be managed using Debian apt tool.</p>
<p>That&#8217;s it folks, any question please comment <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=2095&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F12%2F29%2Fsetting-up-wordpress-multisite-on-debian-5-0-lenny%2F&amp;title=Setting%20up%20WordPress%20Multisite%20on%20Debian%205.0%20%28lenny%29" id="wpa2a_4"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/12/29/setting-up-wordpress-multisite-on-debian-5-0-lenny/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SPQR</title>
		<link>http://blog.angelofailla.com/2010/12/18/spqr/</link>
		<comments>http://blog.angelofailla.com/2010/12/18/spqr/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 00:09:52 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[romans]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=2040</guid>
		<description><![CDATA[I&#8217;ve been programming Perl for a while now, but I&#8217;ve seen lot of people around me (even Perl enthusiasts) getting very excited about Python. In Newbay it&#8217;s used mainly for automated and performance tests, but some times also for some system engineering automation. I can understand them, Python seems to be a pretty cool language, very clear and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been programming Perl for a while now, but I&#8217;ve seen lot of people around me (even Perl enthusiasts) getting very excited about Python.</p>
<p>In Newbay it&#8217;s used mainly for automated and performance tests, but some times also for some system engineering automation.</p>
<p>I can understand them, Python seems to be a pretty cool language, very clear and rigorous when compared to Perl, which tend to be messy (depending on the coder).</p>
<p>Python seems also to have more stuff into the default distribution which comes pre-installed on every Linux/Unix box. You already have http and xml libraries without the necessity of installing stuff (with Perl for example you don&#8217;t have LWP or any XML dom library by default and you have to install them through CPAN or your packaging system).</p>
<p>Also, with Jython is easier to interface with Java based stuff like JMS, etc. In the pat I&#8217;ve used some awful hacks using <a href="http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod">Inline::Java</a> , they were working but, you know, they looked really scary.</p>
<p>I still do like Perl though, for doing simple and quick hacks, one-liners, etc.And I will probably continue to use it.</p>
<p>I&#8217;m currently reading this <a href="http://diveintopython.org/">Diving into Python</a> book, which is free to download or view online.</p>
<p>My colleague Brano has always tried to evangelize me, with no success so far (because of my chronic laziness), but today he gave me a nice puzzle which took me a couple of hours to solve <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>I&#8217;m sharing it with you just in case you fancy the idea to solve it too. Feel free to send me the result at<br />
pallotron (at) freaknet (dot) org <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>It&#8217;s called <strong>roman.py</strong>, it contains two functions called <strong>roman2dec</strong> and <strong>dec2roman</strong>, they should convert integers into roman numbers and viceversa.</p>
<p>Brano gave it to me with the excuse that, because I&#8217;m Italian, I should be pretty used with romans numbers and it wouldn&#8217;t take too much to solve it <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>I started in the afternoon while at work, it took a 1 hour and half to me to figure out the algo for the dec2roman function, I don&#8217;t consider myself a math genius so excuse me if I was slow <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>The roman2dec was a bit of a challenge, but after 3 glasses of nice white wine (<a href="http://www.vinicorvo.it/vinibianchi/glicine.htm">Corvo Glicine</a>) I started seen the pattern and I&#8217;ve nailed it <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In vino veritas! ahaha!</p>
<p>You have to write the code of the two functions so that the all unit tests pass (there are also negatives tests that you should take care of), here is the code. Just copy paste in a file called <strong>roman.py</strong> and execute it with <strong>python roman.py</strong>, enjoy!</p>
<p>I&#8217;ll publish my script in a week or so (just to give you the time to play with it, PLEASE DO NOT CHEAT <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">unittest</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># your global variables can go here, too ;)</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> roman2dec<span style="color: black;">&#40;</span>roman<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: #008000;">isinstance</span><span style="color: black;">&#40;</span>roman, <span style="color: #008000;">str</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'Expected string argument'</span>
    <span style="color: #808080; font-style: italic;"># your code goes here</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">None</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> dec2roman<span style="color: black;">&#40;</span>dec<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: #008000;">isinstance</span><span style="color: black;">&#40;</span>dec, <span style="color: #008000;">int</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'Expected integer argument'</span>
    <span style="color: #808080; font-style: italic;"># your code goes here</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">None</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> RomanTests<span style="color: black;">&#40;</span><span style="color: #dc143c;">unittest</span>.<span style="color: black;">TestCase</span><span style="color: black;">&#41;</span>:
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> testSimple<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">assertEqual</span><span style="color: black;">&#40;</span>roman2dec<span style="color: black;">&#40;</span><span style="color: #483d8b;">'XXIV'</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">24</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertEqual</span><span style="color: black;">&#40;</span>roman2dec<span style="color: black;">&#40;</span><span style="color: #483d8b;">'mcmxcix'</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">1999</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertEqual</span><span style="color: black;">&#40;</span>dec2roman<span style="color: black;">&#40;</span><span style="color: #ff4500;">13</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'XIII'</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertEqual</span><span style="color: black;">&#40;</span>dec2roman<span style="color: black;">&#40;</span><span style="color: #ff4500;">78</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'LXXVIII'</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> testInvalid<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">assertRaises</span><span style="color: black;">&#40;</span><span style="color: #008000;">ValueError</span>, roman2dec, <span style="color: #483d8b;">'IIII'</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertRaises</span><span style="color: black;">&#40;</span><span style="color: #008000;">ValueError</span>, roman2dec, <span style="color: #483d8b;">'VX'</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertRaises</span><span style="color: black;">&#40;</span><span style="color: #008000;">ValueError</span>, roman2dec, <span style="color: #483d8b;">'VV'</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertRaises</span><span style="color: black;">&#40;</span><span style="color: #008000;">ValueError</span>, roman2dec, <span style="color: #483d8b;">'IC'</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">assertRaises</span><span style="color: black;">&#40;</span><span style="color: #008000;">ValueError</span>, dec2roman, -<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> testExhaustive<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">4000</span><span style="color: black;">&#41;</span>:
            <span style="color: #008000;">self</span>.<span style="color: black;">assertEqual</span><span style="color: black;">&#40;</span>roman2dec<span style="color: black;">&#40;</span>dec2roman<span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, i<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> testExhaustive2<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        letters = <span style="color: black;">&#40;</span><span style="color: #483d8b;">'I'</span>, <span style="color: #483d8b;">'V'</span>, <span style="color: #483d8b;">'X'</span>, <span style="color: #483d8b;">'L'</span>, <span style="color: #483d8b;">'C'</span>, <span style="color: #483d8b;">'D'</span>, <span style="color: #483d8b;">'M'</span><span style="color: black;">&#41;</span>
        first_example = <span style="color: #008000;">None</span>
        count = <span style="color: #ff4500;">0</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">8</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">8</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">8</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">8</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>:
            rom = <span style="color: #483d8b;">''</span>
            <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:             <span style="color: #808080; font-style: italic;"># do { ... } while i&gt;0</span>
                rom += letters<span style="color: black;">&#91;</span>i <span style="color: #66cc66;">%</span> <span style="color: #ff4500;">7</span><span style="color: black;">&#93;</span>
                i /= <span style="color: #ff4500;">7</span>
                <span style="color: #ff7700;font-weight:bold;">if</span> i<span style="color: #66cc66;">&lt;</span>=<span style="color: #ff4500;">0</span>: <span style="color: #ff7700;font-weight:bold;">break</span>
&nbsp;
            <span style="color: #ff7700;font-weight:bold;">try</span>:
                dec = roman2dec<span style="color: black;">&#40;</span>rom<span style="color: black;">&#41;</span>
                roman = dec2roman<span style="color: black;">&#40;</span>dec<span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">if</span> rom <span style="color: #66cc66;">&lt;&gt;</span> roman:
                    <span style="color: #ff7700;font-weight:bold;">if</span> first_example <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:
                        first_example = <span style="color: #483d8b;">'%s != %s (decimal %d)'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>rom, roman, dec<span style="color: black;">&#41;</span>
                    count += <span style="color: #ff4500;">1</span>
            <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">ValueError</span>, e:
                <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">assertEqual</span><span style="color: black;">&#40;</span>count, <span style="color: #ff4500;">0</span>, <span style="color: #483d8b;">'Accepted %d invalid roman numbers (e.g. %s)'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>count, first_example<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    <span style="color: #dc143c;">unittest</span>.<span style="color: black;">main</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p><strong>[Update]:</strong></p>
<p>There much more invalid roman numbers that you have to check, the quiz has been updated above <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ﻿</p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=2040&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F12%2F18%2Fspqr%2F&amp;title=SPQR" id="wpa2a_6"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/12/18/spqr/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Streammare musica da casa ovunque siate via ssh tunnel</title>
		<link>http://blog.angelofailla.com/2010/08/09/streammare-musica-da-casa-ovunque-siate-via-ssh-tunnel/</link>
		<comments>http://blog.angelofailla.com/2010/08/09/streammare-musica-da-casa-ovunque-siate-via-ssh-tunnel/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 10:06:57 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[daap]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Musica]]></category>
		<category><![CDATA[ssh tunnel]]></category>
		<category><![CDATA[stream]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1906</guid>
		<description><![CDATA[A lavoro ho da poco migrato tutte le mie robe su un portatile nuovo. Mi sono accorto che l&#8217;80% dello spazio sul portatile era occupato da mp3 e musica varia, cosi&#8217; ho deciso di non mettere mai piu&#8217; musica nel suo hard disk, spreco di spazio inutile visto che viviamo nel mondo della connettivita&#8217; ormai dappertutto. [...]]]></description>
			<content:encoded><![CDATA[<p>A lavoro ho da poco migrato tutte le mie robe su un portatile nuovo. Mi sono accorto che l&#8217;80% dello spazio sul portatile era occupato da mp3 e musica varia, cosi&#8217; ho deciso di non mettere mai piu&#8217; musica nel suo hard disk, spreco di spazio inutile visto che viviamo nel mondo della connettivita&#8217; ormai dappertutto.</p>
<p>Cosi&#8217; mi sono detto, ho un bel mac mini a casa col wake-on-lan funzionante, zeppo di musica, questa ridondanza non ha senso, usiamo l&#8217;internet per streammare la musica dal computer di casa mentre sono a lavoro!</p>
<p>Mi sono documentato un po&#8217; e ho visto che in Linux si puo&#8217; installare un tool chiamato mt-daapd (<a href="http://www.fireflymediaserver.org/">http://www.fireflymediaserver.org</a>), ora conosciuto come FireFly media server; questo tool implementa il protocollo DAAP (<a href="http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol">http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol</a>), Digital Audio Access Protocol: e&#8217; un protocollo proprietario usato da Apple nel suo iTunes per streammare audio/video in una rete locale. Questo vuol dire che i media player che parlano DAAP (iTunes ed Amarok per esempio) sono in grado di fare l&#8217;autodiscovery di host daap-enabled nella rete locale in cui vi trovate perche&#8217; DAAP funziona in broadcast.</p>
<p>Per mettere su tutto questo ambaradam in Debian/Ubuntu basta installare il too:</p>
<pre>$ sudo aptitude install mt-daapd libid3tag0 avahi-utils</pre>
<p>Avahi-utils vi servira&#8217; solo se volete ascoltare la musica fuori da casa, altrimenti mt-daapd e&#8217; gia&#8217; ok se il vostro intento e&#8217; streammare musica da un altro host della vostra rete casalinga e niente piu&#8217;.</p>
<p>A questo punto configurate il daemon editando /etc/mt-daapd.conf. Io ho solo cambiato questa linea:</p>
<pre>mp3_dir = /home/pallotron/Music/</pre>
<p>Per puntare alla directory della mia home dove sta tutta la musica. Ma voi date un occhio al file per capire cosa altro potete cambiare a seconda delle vostre esigenze.</p>
<p>Avviate il daemon e fate in modo che parta al boot:</p>
<pre>
<div id="_mcePaste">$ sudo  /etc/init.d/mt-daapd start
$ sudo update-rc.d mt-daapd defaults</div>
</pre>
<p>A questo punto il vostro server ascoltera&#8217; sulla porta 3689:</p>
<pre>root@pallomac:~# netstat -tunap | grep LISTEN | grep mt-daapd
tcp        0      0 0.0.0.0:3689            0.0.0.0:*               LISTEN      18584/mt-daapd</pre>
<p>Questo tool ha una interfaccia web che potete usare per vari scopi: creare playlist, definire nuove directory dove trovare la musica, configurare il tool (password, etc). Basta puntare il proprio browser su <a href="http://localhost:6689/">http://localhost:6689/</a> o cambiare localhost con l&#8217;ip/hostname del vostro computer casalingo.</p>
<p>Ok, una volta che questo e&#8217; fatto viene il bello, un requisito importante e&#8217; che voi siate in grado di accedere al vostro host casalingo usando ssh, il vostro router casalingo deve essere configurato per redirigere la porta SSH (tcp/22) all&#8217;ip del vostro computer casalingo. Io a casa assegno due IP fissi ai mac address delle due interfaccie del computer (ethernet e wifi) tramite il DHCP server del router.</p>
<p>A questo punto dal vostro computer in ufficio o dovunque voi siate usate un bel ssh tunnel:</p>
<pre>$ ssh vostrouser@ip_pubblico_di_casa -L :6689:localhost:3689</pre>
<p>O se preferite potete configurare ~/.ssh/config per aggiungere qualcosa tipo:</p>
<pre>Host IP_CASA
   Username VOSTROUSER
   LocalForward *:3689  localhost:3689</pre>
<p>A questo punto potete connettere il vostro player preferito a localhost:3689 et voila&#8217;, potete vedere tutta la musica sul vostro computer a casa e iniziare ad ascoltare <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ho verificato che banshee ancora non supporta DAAP, mentre rhythmbox supporat DAAP ma senza autodiscovery, cioe&#8217; inserendo a mano la URL del server&#8230; mentre amarok e iTunes supportano l&#8217;autodisvovery.</p>
<p>L&#8217;autodiscovery funzionera&#8217; automaticamente se vi trovate a casa ma se vi trovate fuori dovete utilizzare questo comando Avahi (<a href="http://en.wikipedia.org/wiki/Avahi_(software)">http://en.wikipedia.org/wiki/Avahi_(software)</a>):</p>
<pre>$ avahi-publish-address -v -s "my daap share" _daap._tcp. 6689 &amp;</pre>
<p>Avahi e&#8217; una cosa che devo ancora approfondire meglio, potete verificare che il vostro computer sta esportando correttamente lo share usando il comando:</p>
<pre>$ avahi-browse _daap._tcp</pre>
<p>Dovreste vedere il nome del vostro share apparire.</p>
<p><strong>Se intendete esportare la musica ai vostri colleghi vi avviso che probabilmente questo e&#8217; contro le regole aziendali. Quindi meglio non usare AVAHI <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </strong></p>
<p>Buon ascolto!</p>
<p><strong>Edit</strong></p>
<p>Ho trovato un po&#8217; di info a queste URL:</p>
<p><a href="http://wiki.fireflymediaserver.org/SSH_Tunnel">http://wiki.fireflymediaserver.org/SSH_Tunnel</a></p>
<p><a href="http://wiki.fireflymediaserver.org/RemoteAccess">http://wiki.fireflymediaserver.org/RemoteAccess</a></p>
<p>Pare sia meglio usare una porta diversa da 3689 nel comando ssh, perche&#8217; pare banshee provi a bindare la 3689, io ho scelto 6689&#8230; Di conseguenza cambiare anche il comando avahi per usare la porta 6689&#8230; e pare anche che dovete utilizzare l&#8217;IP del vostro laptop a lavoro e non localhost, cosi&#8217; i comandi diventano:</p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></p>
<pre>$ ssh vostrouser@ip_pubblico_di_casa -L *:6689:localhost:3689</pre>
<p>oppure nel vostro ~/.ssh/config:</p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></p>
<pre>Host IP_CASA
   Username VOSTROUSER
   LocalForward *:6689  localhost:3689</pre>
<p>E poi lanciare avahi cosi&#8217;:</p>
<pre>$ avahi-publish-address -v -s "my daap share" _daap._tcp. 6689 &amp;</pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"><strong>Edit2</strong></span></pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">Potete aggiungere le opzioni -N e -f al comando ssh per evitare di mantenere una shell aperta tutto il tempo, ma poi vi dovete ricordare di killare il processo ssh connesso al vostro server casalingo:</span></pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">$ ssh vostrouser@ip_pubblico_di_casa -N -g -L *:6689:localhost:3689</pre>
<p></span></pre>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1906&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F08%2F09%2Fstreammare-musica-da-casa-ovunque-siate-via-ssh-tunnel%2F&amp;title=Streammare%20musica%20da%20casa%20ovunque%20siate%20via%20ssh%20tunnel" id="wpa2a_8"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/08/09/streammare-musica-da-casa-ovunque-siate-via-ssh-tunnel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>O2sms &#8211; mandare sms dalla console</title>
		<link>http://blog.angelofailla.com/2010/01/02/o2sms-mandare-sms-dalla-console/</link>
		<comments>http://blog.angelofailla.com/2010/01/02/o2sms-mandare-sms-dalla-console/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 18:32:38 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[o2sms]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1641&#038;langswitch_lang=en</guid>
		<description><![CDATA[Tutti noi abbiamo mandato almeno una volta un SMS dal sito del nostro operatore telefonico irlandese. Ok, e&#8217; comodo, non si spendono soldi, ma ci si deve sorbire pubblicita&#8217;, e in piu&#8217; l&#8217;interfaccia non e&#8217; proprio immediata&#8230; girovagando per la rete ho trovato questo progetto chiamato 02sms. Mi sento il Salvatore Aranzulla degli Irlandiani. Ricordate? Questo [...]]]></description>
			<content:encoded><![CDATA[<p>Tutti noi abbiamo mandato almeno una volta un SMS dal sito del nostro operatore telefonico irlandese. Ok, e&#8217; comodo, non si spendono soldi, ma ci si deve sorbire pubblicita&#8217;, e in piu&#8217; l&#8217;interfaccia non e&#8217; proprio immediata&#8230; girovagando per la rete ho trovato questo progetto chiamato <a href="http://o2sms.sourceforge.net/">02sms</a>.</p>
<p>Mi sento il Salvatore Aranzulla degli Irlandiani. <a href="/?s=aranzulla">Ricordate?</a></p>
<p>Questo non e&#8217; altro che un progetto scritto in <a href="http://www.perl.org/">Perl</a> che usa <a href="http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm">WWW::Mechanize</a> per esporre una comoda interfaccia verso tutti gli operatori di telefonia irlandesi (O2, Vodafone, 3, meteor, etc). Oltre al modulo vero e proprio c&#8217;e&#8217; anche una comoda utility command line per mandare sms dalla vostra console. Se avete una distribuzione debian e derivati potete installare cosi&#8217;:</p>
<pre># echo "deb http://apt.mackers.com/ unstable contrib" >> /etc/apt/sources.list
# curl http://www.mackers.com/about/gnupg.key.asc | apt-key add -
# apt-get update
# apt-get install o2sms</pre>
<p>Dopodiche potete creare il file di configurazione nella vostra home:</p>
<pre>pallotron@saridda ~ $ cat ~/.o2sms/config
username 086123456
password SECRET
carrier o2
alias mamma +353861234567
alias papa +353861234568
alias amici +353861234569 +353861234563</pre>
<p>A quel punto potete usare il comando come se fosse il comando mail mandanto in pipe l&#8217;output di echo o cat o quello che volete voi:</p>
<pre>pallotron@saridda ~ $ echo ciao | o2sms mamma
[ recipient : io (+353861234567) ]
[ logging in to 086123456@o2.ie ... ]
[ login successful ]
[ message sent to +353861234567, 247 remaining this month ]</pre>
<p>Per gli amanti del mouse ci sono anche widget per gnome e kde. Varie funzioni sono disponibili per ulteriori info guardate il sito e la documentazione.</p>
<p>Spread the word.</p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1641&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F01%2F02%2Fo2sms-mandare-sms-dalla-console%2F&amp;title=O2sms%20%26%238211%3B%20mandare%20sms%20dalla%20console" id="wpa2a_10"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/01/02/o2sms-mandare-sms-dalla-console/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Esempio pratico per limitare la banda in upload in Linux.</title>
		<link>http://blog.angelofailla.com/2009/07/12/esempio-pratico-per-limitare-la-banda-in-upload-in-linux/</link>
		<comments>http://blog.angelofailla.com/2009/07/12/esempio-pratico-per-limitare-la-banda-in-upload-in-linux/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 10:18:57 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[qos]]></category>
		<category><![CDATA[tc]]></category>
		<category><![CDATA[tcng]]></category>
		<category><![CDATA[traffic control]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1502</guid>
		<description><![CDATA[Ogni tanto in questo blog vanno messe un po&#8217; di robe tecniche altrimenti la mia geekness se ne va a farsi benedire e la gente smette di dirmi che sono nerd. Ultimamente ho messo su una scatoletta linux che funziona da media server per la XBOX (usando ushare) e da server samba/ssh/http. SSH e HTTP [...]]]></description>
			<content:encoded><![CDATA[<p>Ogni tanto in questo blog vanno messe un po&#8217; di robe tecniche altrimenti la mia geekness se ne va a farsi benedire e la gente smette di dirmi che sono nerd.</p>
<p>Ultimamente ho messo su una scatoletta linux che funziona da media server per la XBOX (usando ushare) e da server samba/ssh/http.</p>
<p>SSH e HTTP sono esposti su internet e li uso per trasferire files.</p>
<p>Alcuni amici hanno accesso solo che abusano della clemenza e scaricano file in maniera un po&#8217; troppo eccessiva <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cosicche&#8217; oggi ho messo mani a TC (traffic control) per configurare un tetto massimo di 20kbps in upload. <a href="http://linux.die.net/man/8/tc">TC e&#8217; una CLI</a> che permette di gestire il traffic shaping in Linux ma la sua sintassi e&#8217; troppo arcana&#8230; cosicche&#8217; un gruppo di giovini ha creato <a href="http://tcng.sourceforge.net/">tcng (TC new generation).</a></p>
<p>Cosicche&#8217; me ne sono uscito con queste poche righe di file di testo da eseguire a boot time:</p>
<pre>
root@linutop:/etc# cat /etc/rc.local
#!/bin/sh
tc qdisc del root dev eth0
tcng -q /etc/tcng > /tmp/tc
sh /tmp/tc
rm /tmp/tc

root@linutop:/etc# cat /etc/tcng
#define INTERFACE  eth0
#define IP 192.168.50.252

dev INTERFACE {
    egress { 

        class ( < $http> ) if ip_src == IP &#038;&#038; tcp_sport == PORT_HTTP ;
        class ( < $other> )  if 1 ;

        htb () {
            class ( rate 100Mbps, ceil 100Mbps) {
                $http  = class ( rate 100kbps, ceil 200kbps ) { sfq; } ;
                $other = class ( rate 128kbps, ceil 100Mbps) { sfq; } ;
            }
        }
    }
}
</pre>
<p>Enjoy, vi ho dato lo spunto per iniziare.<br />
Letture interessanti:</p>
<p>* <a href="http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html"> http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html</a></p>
<p>* <a href="http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html">http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html</a></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1502&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2009%2F07%2F12%2Fesempio-pratico-per-limitare-la-banda-in-upload-in-linux%2F&amp;title=Esempio%20pratico%20per%20limitare%20la%20banda%20in%20upload%20in%20Linux." id="wpa2a_12"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2009/07/12/esempio-pratico-per-limitare-la-banda-in-upload-in-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Lazyness</title>
		<link>http://blog.angelofailla.com/2009/03/13/lazyness/</link>
		<comments>http://blog.angelofailla.com/2009/03/13/lazyness/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 10:53:57 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[automazione]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1351</guid>
		<description><![CDATA[C&#8217;e&#8217; stata una migrazione qualche notte fa per $GRANDECLIENTE. Fortunatamente io non vi ho fatto parte, se no avrei dovuto passare la notte in ufficio. Uno step previsto per la migrazione consisteva nel disattivare tutti i check nagios della vecchia release ceh girava su una 20ina di server. La CGI Nagios e&#8217; notoriamente uno schifo. [...]]]></description>
			<content:encoded><![CDATA[<p>C&#8217;e&#8217; stata una migrazione qualche notte fa per $GRANDECLIENTE. Fortunatamente io non vi ho fatto parte, se no avrei dovuto passare la notte in ufficio.</p>
<p>Uno step previsto per la migrazione consisteva nel disattivare tutti i check nagios della vecchia release ceh girava su una 20ina di server. La CGI Nagios e&#8217; notoriamente uno schifo. Non c&#8217;e&#8217; nessuna funzionalita&#8217; tipo &#8220;select all&#8221; -&gt; click. Cosi&#8217; quei geni si sono messi <strong>a cliccare come pazzi, spendendo UN&#8217;ORA.</strong></p>
<p><strong>Ora, per me tu puoi fare quello che vuoi, ma siccome non si sa mai che in un futuro prossimo io debba essere al posto loro, ho rimediato con l&#8217;ennesimo script.<br />
</strong></p>
<p>Fossi io avrei preferito spendere un&#8217;ora a scrivermi uno script che non mi avrebbe fatto perdere un&#8217;ora ogni volta che avessi dovuto fare una cosa del genere. E cosi&#8217; ho fatto ieri sera dopo cena, non avendo un cazzo di molto interessante da fare.</p>
<p>Lo script e&#8217; <a href="http://www.pallotron.net/software/nagios_extcmd.sh">qui.</a></p>
<pre>
/home/pallotron/bin/nagios_extcmd.sh <-n | -N | -p | -P | -C | -c> host service_description <cmdfile_path>
/home/pallotron/bin/nagios_extcmd.sh -h

-n disable notification
-N enable notification

-p disable passive check
-P enable passive check

-c disable check
-C enable check</pre>
<p>Lo script scrive qualcosa nella pipe che il daemon Nagios piazza nel file system.</p>
<p>Ho preso la lista dei comandi da <a href="http://www.nagios.org/developerinfo/externalcommands/commandlist.php">qui.</a></p>
<p>Avrete bisogno di editarlo e cambiare il path della pipe in base al vostro sistema. Poi sbizzarrirvi con un robe del tipo:</p>
<pre>for i in web01de web02de web03de web04de
do
   nagios_extcmd.sh -n $i "SC Apache"
   nagios_extcmd.sh -p $i "SC Apache"
   nagios_extcmd.sh -c $i "SC Apache"
done</pre>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1351&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2009%2F03%2F13%2Flazyness%2F&amp;title=Lazyness" id="wpa2a_14"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2009/03/13/lazyness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Come ti estendo l&#8217;homebanking col Perl</title>
		<link>http://blog.angelofailla.com/2009/01/31/come-ti-estendo-lhomebanking-col-perl/</link>
		<comments>http://blog.angelofailla.com/2009/01/31/come-ti-estendo-lhomebanking-col-perl/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 15:32:21 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[moduli]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[www::mechanize]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1296</guid>
		<description><![CDATA[Ireland, 1 year. Sono al giro di boa del primo anno. Non faro&#8217; il solito post commemorativo del tipo &#8220;questo giorno un anno fa ero all&#8217;aeroporto ignaro del futuro&#8221;. Forse lo faro&#8217; dopo. Accontentati di quello che avevo scritto un mese fa. Piuttosto festeggio con un bel rilascio su CPAN.org dei miei sforzi informatici delle [...]]]></description>
			<content:encoded><![CDATA[<p>Ireland, <strong>1 year.</strong></p>
<p><strong>Sono al giro di boa del primo anno.</strong> Non faro&#8217; il solito post commemorativo del tipo &#8220;questo giorno un anno fa ero all&#8217;aeroporto ignaro del futuro&#8221;. Forse lo faro&#8217; dopo. Accontentati di quello che avevo scritto <a href="2008/11/25/riflessioni-a-ruota-libera-senza-uno-scopo-particolare/">un mese fa.</a> Piuttosto festeggio con un bel rilascio su <a href="http://www.cpan.org">CPAN.org</a> dei miei sforzi informatici delle ultime 2 settimane, per provare quanto sia sensato il fumetto di <a href="http://xkcd.com/519/">xkcd.com</a> : cioe&#8217; che <strong>abbia piu&#8217; senso una settimana incasinando col <a href="http://it.wikipedia.org/wiki/Perl">Perl</a> che 900 ore di corso universitario o 400 ore di compiti a casa <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p><a href="http://xkcd.com/519/"><img class="alignnone size-full wp-image-1297" title="11th_grade" src="http://blog.angelofailla.com/wp-content/uploads/2009/01/11th_grade.png" alt="11th_grade" width="535" height="333" /></a></p>
<p>Cosi&#8217;, dopo 2 settimane di programmazione piu&#8217; o meno autistica, ho rilasciato una prima release usabile: il modulo si chiama <a href="http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/">Finance::Bank::IE::PermanentTSB</a>, e si aggiunge al namespace Finance::Bank, accanto ad altri moduli dello stesso tipo.</p>
<p>Il modulo permette di stampare da riga di comando il saldo di tutti i conti correnti bancari collegato all&#8217;homebanking di PermanentTSB.</p>
<pre>pallotron@terminus ~ $ ptsb -b
Parsing configuration file...

You need a passphrase to unlock the secret key for
user: "Angelo Failla &lt;afailla@newbay.com&gt;"
2048-bit ELG-E key, ID F83D3FCA, created 2008-02-18 (main key ID B68B318D)

gpg: encrypted with 2048-bit ELG-E key, ID F83D3FCA, created 2008-02-18
      "Angelo Failla &lt;afailla@newbay.com&gt;"

Connecting...

-----------------------------------------------------------
|       Account name | Acc. # |     Balance |   Available |
-----------------------------------------------------------
| Switch Current A/C |   0220 |      135.35 |      235.35 |
|          Visa Card |   2667 |     -419.66 |       80.34 |
-----------------------------------------------------------</pre>
<p>Ovviamente i dati dell&#8217;output sono taroccati <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Lo script e&#8217; anche in grado di stampare l&#8217;estratto conto basandosi su range temporale, regular expression (per matchare la description), e condizioni matematiche (tipo &lt;300, &gt;=2000, etc).</p>
<p>L&#8217;idea del modulo mi e&#8217; venuta dopo che ho scoperto <strong>la potenza di <a href="http://search.cpan.org/~petdance/WWW-Mechanize-1.54/lib/WWW/Mechanize.pm">WWW::Mechanize.</a></strong> E&#8217; un modulo Perl che permette di <strong>automatizzare l&#8217;interazione con un sito web</strong>: gestisce la navigazione attraverso pagine, i click, la gestione delle form, il fill out delle form, etc. C&#8217;e&#8217;<strong> qualche pazzo che l&#8217;ha usato per scriversi bot che tengono d&#8217;occhio aste di Ebay</strong> o che effettuano <strong>operazioni periodiche su Ogame</strong> (famoso gioco alla Warcraft, ma online; ci giocavo 2 anni fa, ma poi ne sono uscito pulito!).</p>
<p>Il miglior modo per imparare qualcosa quando programmi e&#8217; di solito scrivere qualcosa che ti serva veramente. Cosi&#8217; mi sono detto: <em>«devo scrivere qualcosa che mi serva veramente e nel frattempo mi possa servire per imparare il modulo e rispolverare altre cose del Perl».</em></p>
<p><strong>Noi sistemisti siamo pigri e non amiamo fare le stesse cose ripetutamente</strong>, e, dove possibile (quasi dovunque!), ci piace automatizzare <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Se poi possiamo avere tool command line per fare le cose piu&#8217; disparate sicuramente non disdegniamo.</p>
<p>Il sito di PermanentTSB e&#8217; una chiavica, non fa grafici e istogrammi del conto, non salva/esporta gli estratti conto in file CSV, non tiene dati piu&#8217; vecchi di 6 mesi! Un invito a nozze per rimediare a cio&#8217; con WWW::Mechanize!</p>
<p>D&#8217;apprima ho iniziato scrivendo un modulo per familiarizare con le librerie, obiettivo: &#8220;inserire da command line, le ore lavorate nel sistema di time tracking aziendale&#8221;. Devo dire che lo script e&#8217; stato molto apprezzto a lavoro visto che per inserire anche un solo record nella interfaccia aziendale si devono cliccare milioni di volte, e il sistema non e&#8217; a prova di errore!</p>
<p>Queste due settimane mi sono servite a:</p>
<ul>
<li>rispolverare Perl;</li>
<li>imparare la programmazione dei package/moduli;</li>
<li>capire come funziona la comunita&#8217; CPAN;</li>
<li>imparare WWW::Mechanize;</li>
<li>imparare come funzionano le test unit in Perl usando <a href="http://search.cpan.org/~mschwern/Test-Simple/lib/Test/More.pm">Test::More</a> e <a href="http://search.cpan.org/~chromatic/Test-MockObject">Test::MockObject</a>;</li>
<li>imparare come funziona <a href="http://git-scm.com/">git</a>, il sistema di versioning creato da <a href="http://it.wikipedia.org/wiki/Linus_Torvalds">Linus Torvalds</a> usato dalla comunita&#8217; di sviluppo del <a href="http://it.wikipedia.org/wiki/Linux">Kernel Linux.</a> Veramente fico per velocita&#8217; e completezza di opzioni e feature. Meglio di subversion/cvs.</li>
</ul>
<p>In piu&#8217; e&#8217; servito a coprire anche un po&#8217; di spazi vuoti che ultimamente sto avendo a lavoro. <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Alla prossima!</p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1296&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2009%2F01%2F31%2Fcome-ti-estendo-lhomebanking-col-perl%2F&amp;title=Come%20ti%20estendo%20l%26%238217%3Bhomebanking%20col%20Perl" id="wpa2a_16"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2009/01/31/come-ti-estendo-lhomebanking-col-perl/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Sysadmin day, oggi come un anno fa.</title>
		<link>http://blog.angelofailla.com/2008/07/25/sysadmin-day-oggi-come-un-anno-fa/</link>
		<comments>http://blog.angelofailla.com/2008/07/25/sysadmin-day-oggi-come-un-anno-fa/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 12:33:03 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[apprezzamento]]></category>
		<category><![CDATA[sysadmin day]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=941&#038;langswitch_lang=en</guid>
		<description><![CDATA[Ecco, come un anno fa.]]></description>
			<content:encoded><![CDATA[<p>Ecco, come <a href="/2007/07/27/oggi-e-il-giorno-dei-sysadminoggi-e-il-giorno-dei-sysadmin/">un anno fa.</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/udhd9fmOdCs" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/udhd9fmOdCs"></embed></object></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=941&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2008%2F07%2F25%2Fsysadmin-day-oggi-come-un-anno-fa%2F&amp;title=Sysadmin%20day%2C%20oggi%20come%20un%20anno%20fa." id="wpa2a_18"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2008/07/25/sysadmin-day-oggi-come-un-anno-fa/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitoring SSL certificate expiration with Nagios</title>
		<link>http://blog.angelofailla.com/2008/07/17/monitoring-ssl-certificate-expiration-with-nagios/</link>
		<comments>http://blog.angelofailla.com/2008/07/17/monitoring-ssl-certificate-expiration-with-nagios/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 10:49:42 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[expiration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=873</guid>
		<description><![CDATA[Hi Lads, This is a post for nerds so I&#8217;m writing it in English. If you don&#8217;t understand English or technical stuff please close this page I&#8217;m at work and I&#8217;ve just finished to write a Nagios script to monitor expiration date of a SSL certificate. I wanna share it with you. To have the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Lads,</p>
<p>This is a post for nerds so I&#8217;m writing it in English. If you don&#8217;t understand English or technical stuff please close this page <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
I&#8217;m at work and I&#8217;ve just finished to write a Nagios script to monitor expiration date of a SSL certificate.</p>
<p>I wanna share it with you.</p>
<p>To have the script working properly you just need to install OpenSSL and let the <span>openssl</span><br />
command be in your PATH environment.</p>
<p>This is the usage:</p>
<pre>
Usage:
check_ssl_cert.sh hostname port [warningdays]
</pre>
<p>Warning days default value is 30 days.</p>
<p>Some examples:</p>
<pre>[afailla@terminus ~]$  /usr/local/nagios/bin/check_ssl_cert.sh google.com 443
OK: Certificate is valid for 289 days expires on May  2 17:02:55 2009 GMT

[afailla@terminus ~]$  /usr/local/nagios/bin/check_ssl_cert.sh google.com 443 400
CRITICAL: Certificate will expire in 289 days on May  2 17:02:55 2009 GMT</pre>
<p>Download the script <a href="http://blog.angelofailla.com/wp-content/uploads/2008/07/check_ssl_cert.sh">here</a> and enjoy it.</p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=873&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2008%2F07%2F17%2Fmonitoring-ssl-certificate-expiration-with-nagios%2F&amp;title=Monitoring%20SSL%20certificate%20expiration%20with%20Nagios" id="wpa2a_20"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2008/07/17/monitoring-ssl-certificate-expiration-with-nagios/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

