<?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>thehook</title>
	<atom:link href="http://thehook.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://thehook.eu</link>
	<description>My digital playground</description>
	<lastBuildDate>Fri, 05 Mar 2010 12:10:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Try 2.5GB online backup from Mozy today, for free!</title>
		<link>http://thehook.eu/2010/01/try-2-5gb-online-backup-from-mozy-today-for-free/</link>
		<comments>http://thehook.eu/2010/01/try-2-5gb-online-backup-from-mozy-today-for-free/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 14:38:03 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=210</guid>
		<description><![CDATA[A friend of mine told me about a online backup service that gives you 2 GB online storage for free, and an additional 512 MB if you use an referer link. After testing this for a day now I am very pleased with all the configuration options and that the service offers 448 bits blowfish [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine told me about a online backup service that gives you 2 GB online storage for free, and an additional 512 MB if you use an referer link. </p>
<p>After testing this for a day now I am very pleased with all the configuration options and that the service offers 448 bits blowfish encryption, or you could use your own key and get 256 bits AES encryption on all your files.</p>
<p>It was as simple as installing the backup client, and configure what files it should sync and how often. The rest is done by Mozy.</p>
<p>To get more free storage you get an referer link, wich will give not only you, but also your friend 512 MB extra storage each. To sign up now and get 512 MB extra storage yourself click on my referer link: <a href="https://mozy.com/?ref=XP5WY5">https://mozy.com/?ref=XP5WY5</a>.</p>
<p>It&#8217;s worth a try!</p>
<ul>
<li>Click on the link to visit <a href="https://mozy.com/?ref=XP5WY5">Mozy&#8217;s website</a>.</li>
<li>Navigate to <strong>Products</strong> &#8211;> <strong>MozyHome</strong> on the top menu.</li>
<li>On the next page click <strong>Try It Free</strong> or under <strong>2GB of 100% free backup space</strong></li>
<li>Click on <strong>Sign Up Now</strong> under MozyHome Free</li>
<li>Enter your credentials and your ready to enjoy safe automated online backup. With 2.5 GB totally free of charge!</li>
</ul>
<p>Enjoy, and thank you for using my referer link! =)</p>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2010/01/try-2-5gb-online-backup-from-mozy-today-for-free/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basic configuration of Cisco IOS with SSH from scratch</title>
		<link>http://thehook.eu/2009/11/basic-configuration-of-cisco-ios-with-ssh-from-scratch/</link>
		<comments>http://thehook.eu/2009/11/basic-configuration-of-cisco-ios-with-ssh-from-scratch/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 10:37:13 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=205</guid>
		<description><![CDATA[Here is my _very_ basic configuration of a Cisco router running IOS. Just remember to change all {VARIABLE} to the correct value including the {} part. This will result in an all basic configured router, running SSH and with a user you can use to log in through SSH. Router&#62; enable Router# configure terminal Router(config)# [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my _very_ basic configuration of a Cisco router running IOS. Just remember to change all {VARIABLE} to the correct value including the {} part.</p>
<p>This will result in an all basic configured router, running SSH and with a user you can use to log in through SSH.</p>
<pre>Router&gt; <strong>enable</strong>

Router# <strong>configure terminal</strong>

Router(config)# <strong>hostname {ROUTER_NAME}</strong>

Router(config)# <strong>enable secret 0 {ENABLE_PASSWORD}</strong>

Router(config)# <strong>interface fastEthernet 0/0</strong>

Router(config-if)# <strong>ip address {IP_ADDRESS} {SUBNET_MASK}</strong>

Router(config-if)# <strong>full-duplex</strong>

Router(config-if)# <strong>speed 100</strong>

Router(config-if)# <strong>no shutdown</strong>

Router(config-if)# <strong>exit</strong>

Router(config)# <strong>username {USERNAME} privilege {PRIVILEGE_LEVEL} secret 0 {USER_PASSWORD}</strong>

Router(config)# <strong>ip domain name {DOMAIN_NAME}</strong>

Router(config)# <strong>crypto key generate rsa</strong>
How many bits in the modulus [512]: <strong>2048</strong>

Router(config)# <strong>line vty 0 4</strong>

Router(config-line)# <strong>login local</strong>

Router(config-line)# <strong>transport input ssh</strong>

Router(config-line)# <strong>exit</strong>

Router(config)# <strong>ip routing</strong>

Router(config)# <strong>exit</strong>

Router# <strong>show running-config</strong>

Router# <strong>copy running-config startup-config</strong>
Destination filename [startup-config]? <strong>[PRESS_ENTER]</strong>

Router# <strong>exit</strong></pre>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/11/basic-configuration-of-cisco-ios-with-ssh-from-scratch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a &#8220;bash alias&#8221; with an argument</title>
		<link>http://thehook.eu/2009/09/creating-a-bash-alias-with-an-argument/</link>
		<comments>http://thehook.eu/2009/09/creating-a-bash-alias-with-an-argument/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 12:41:25 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=199</guid>
		<description><![CDATA[While setting up and testing the anti virus/spam filter of a mail server I usually send a lot of &#8220;test spam&#8221; to myself and that involves a pretty long line that needs to be typed in every time, and changed for every mail account i test. I want to make an alias for this using [...]]]></description>
			<content:encoded><![CDATA[<p>While setting up and testing the anti virus/spam filter of a mail server I usually send a lot of &#8220;test spam&#8221; to myself and that involves a pretty long line that needs to be typed in every time, and changed for every mail account i test. I want to make an alias for this using an argument containing the email address, but bash makes it hard if not impossible to do so with an alias. Fortunately it allows you to create an function instead.</p>
<p>The command for sending a &#8220;GTUBE&#8221; test spam message is</p>
<pre>sendmail <strong>john@example.com</strong> &lt; /usr/share/doc/spamassassin/examples/sample-spam.txt</pre>
<p>To make this easier I wanted to make an alias for it, so I can type <code>sendspam &lt;email -address&gt;</code> to send it. And as I mentioned earlier bash don&#8217;t allow you to use arguments in aliases. But making a function is just as easy. Add the following line in <strong>~/.bashrc</strong></p>
<pre>sendspam () { sendmail "$1"  &lt; /usr/share/doc/spamassassin/examples/sample-spam.txt; }</pre>
<p>After the next login you will now be able to use the following command to send a test spam message</p>
<pre>sendspam john@example.com</pre>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/09/creating-a-bash-alias-with-an-argument/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Check MD5 sums for all files in folder with one command</title>
		<link>http://thehook.eu/2009/09/check-md5-sums-for-all-files-in-folder-with-one-command/</link>
		<comments>http://thehook.eu/2009/09/check-md5-sums-for-all-files-in-folder-with-one-command/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 13:01:28 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=196</guid>
		<description><![CDATA[I came over a simple but genius one-liner for the Linux shell to check the MD5 sum of all files in a folder. It will create a file.md5 containing the checksum just like on the FTP servers. for c in ./*; do md5sum $c > $c.md5; done and to list all files with the checksum [...]]]></description>
			<content:encoded><![CDATA[<p>I came over a simple but genius one-liner for the Linux shell to check the MD5 sum of all files in a folder. It will create a file.md5 containing the checksum just like on the FTP servers.</p>
<pre>for c in ./*; do md5sum $c > $c.md5; done</pre>
<p>and to list all files with the checksum just use</p>
<pre>cat *.md5</pre>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/09/check-md5-sums-for-all-files-in-folder-with-one-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Check if string contains a value in array</title>
		<link>http://thehook.eu/2009/08/php-function-to-check-if-string-contains-a-value-in-array/</link>
		<comments>http://thehook.eu/2009/08/php-function-to-check-if-string-contains-a-value-in-array/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 16:56:14 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=191</guid>
		<description><![CDATA[I was writing a a very simple script to check if a visitor was a bot. Therefore I made an array of words used by bots, and soon found out that PHP got a function to check a string in an array, but not an array in a string. So I wrote a simple function, [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing a a very simple script to check if a visitor was a bot. Therefore I made an array of words used by bots, and soon found out that PHP got a function to check a string in an array, but not an array in a string. So I wrote a simple function, maybe someone else needs it?</p>
<pre>// PHP Function to check if any value in an array is in a string
//
function isin_string($string, $array) {
        foreach ($array as $value) {
                if (!stristr($string, $value) === FALSE) {
                        // value is found
                        return true;
                } else {
                        // value not found
                        return false;
                }
        }
}</pre>
<p>Or in a simpler way just implode() the array and use strrpos()</p>
<pre>
function string_in_array($string, $array) {
    $array = implode(" ", $array);
    if strrpos($array, $string) {
        // String is found
        return true;
    } else {
        // String was NOT found
        return false;
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/08/php-function-to-check-if-string-contains-a-value-in-array/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automatically remove deleted e-mails after 14 days</title>
		<link>http://thehook.eu/2009/08/automatically-remove-deleted-e-mails-after-14-days/</link>
		<comments>http://thehook.eu/2009/08/automatically-remove-deleted-e-mails-after-14-days/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 18:47:35 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=182</guid>
		<description><![CDATA[I have a email server using IMAP, and as you probably know you can mark a mail as deleted but it will still be on the server occupying space. There are usually a option to purge them, but most users doesn&#8217;t care.. To solve this problem, I will notify all my users that mails will [...]]]></description>
			<content:encoded><![CDATA[<p>I have a email server using IMAP, and as you probably know you can mark a mail as deleted but it will still be on the server occupying space. There are usually a option to purge them, but most users doesn&#8217;t care..</p>
<p>To solve this problem, I will notify all my users that mails will automatically be deleted after 14 days, and set up a cron job for the task.</p>
<p>To find and delete the mails I&#8217;ll use the following command</p>
<pre>find /var/vmail/ -name '*,ST' -ctime +14 | xargs rm -f</pre>
<p>Using <code>crontab -e</code> I will make it run every day at 15:00. So this is how my crontab looks after adding the line</p>
<pre># m h  dom mon dow   command
0 15 * * * find /var/vmail/ -name '*,ST' -ctime +14 | xargs rm -f</pre>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/08/automatically-remove-deleted-e-mails-after-14-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using keyfiles to log in with SSH in steps</title>
		<link>http://thehook.eu/2009/08/using-keyfiles-to-log-in-with-ssh-in-steps/</link>
		<comments>http://thehook.eu/2009/08/using-keyfiles-to-log-in-with-ssh-in-steps/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 02:11:41 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=170</guid>
		<description><![CDATA[If you have one or more servers you log in to very often like my self, you might get a bit bored of typing the same passwords when connecting through SSH. The solution is really simple, and as an bonus it&#8217;s even more secure than regular login. The following steps assumes you are using Linux. [...]]]></description>
			<content:encoded><![CDATA[<p>If you have one or more servers you log in to very often like my self, you might get a bit bored of typing the same passwords when connecting through SSH. The solution is really simple, and as an bonus it&#8217;s even more secure than regular login. The following steps assumes you are using Linux.</p>
<ol>
<li>
<p>On you workstation you will have to make a directory and generate a key pair. (This is only needed once, you can use the same key on more servers)</p>
<pre>mkdir ~/.ssh
ssh-keygen -t rsa</pre>
<p>This will create two files in your .ssh folder named <code>id_rsa</code> and <code>id_rsa.pub</code>. The last one is the public file and is what we are going to store on the server.</p>
<p>The other file is your private key. Never show, give away or keep this file on a public computer.</p>
</li>
<li>
<p>Copy the public file <code>id_rsa.pub</code> to the server using scp (secure copy).</p>
<pre>scp .ssh/id_rsa.pub user@domain.tld:/home/user/</pre>
</li>
<li>
<p>Then we log in to the server and setup everything with the right permissions.</p>
<pre>ssh user@domain.tld</pre>
</li>
<li>
<p>Create a .ssh directory if it doesn&#8217;t exist. And copy the content of the public key file into the authorized_keys. And delete the uploaded public file. The reason I copy the content and not the file itself is because you may have other keys stored in there.</p>
<pre>mkdir -p ~/.ssh
cat id_rsa.pub >> ~/.ssh/authorized_keys
rm id_rsa.pub</pre>
<p>And set the right permissions on the file and folder. (Remember to change user:user to reflect your username!)</p>
<pre>chown -R user:user ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys</pre>
</li>
<li>
<p>Now logout from the server using <code>exit</code>and try logging in again <img src='http://thehook.eu/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
</li>
</ol>
<p>And remember that the file id_rsa is your private key. Never show, give away or keep this file on a public computer. I cannot stress this enough!</p>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/08/using-keyfiles-to-log-in-with-ssh-in-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP plugin Download Monitor rewrite rule for nginx</title>
		<link>http://thehook.eu/2009/08/wp-plugin-download-monitor-rewrite-rule-for-nginx/</link>
		<comments>http://thehook.eu/2009/08/wp-plugin-download-monitor-rewrite-rule-for-nginx/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 08:14:14 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=135</guid>
		<description><![CDATA[I just wanted to post a simple rewrite rule for all the people that is using the WordPress plugin Download Monitor on Nginx. # Download folder rewrite # location /downloads/ { rewrite ^/downloads/(.*)$ /wp-content/plugins/download-monitor/download.php?id=$1 last; } The code assumes you have set the &#8220;Custom download URL&#8221; to downloads in the plugin configuration.]]></description>
			<content:encoded><![CDATA[<p>I just wanted to post a simple rewrite rule for all the people that is using the WordPress plugin Download Monitor on Nginx.</p>
<pre># Download folder rewrite
#
location /downloads/ {
    rewrite ^/downloads/(.*)$ /wp-content/plugins/download-monitor/download.php?id=$1 last;
}</pre>
<p>The code assumes you have set the &#8220;Custom download URL&#8221; to <strong>downloads</strong> in the plugin configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/08/wp-plugin-download-monitor-rewrite-rule-for-nginx/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Set up a temporary TFTP server on Linux</title>
		<link>http://thehook.eu/2009/07/set-up-a-temporary-tftp-server-on-linux/</link>
		<comments>http://thehook.eu/2009/07/set-up-a-temporary-tftp-server-on-linux/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 05:45:31 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tftp]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=104</guid>
		<description><![CDATA[Yesterday when I was going to flash a router I needed a TFTP server, and as I like my system as it is I don&#8217;t want to install a TFTP server just to uninstall it again since I&#8217;m only using it for half an hour. So I went searching for an TFTP server that didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday when I was going to flash a router I needed a TFTP server, and as I like my system as it is I don&#8217;t want to install a TFTP server just to uninstall it again since I&#8217;m only using it for half an hour.</p>
<p>So I went searching for an TFTP server that didn&#8217;t require installation and was easy to configure, a Linux counterpart for <a href="http://tftpd32.jounin.net/">tftpd32</a> for Windows. What I found was the <a href="http://sourceforge.net/projects/tftp-server/">Open TFTP Server</a> wich also comes with an precompiled binary for Linux/Intel. It was also a dream to configure.</p>
<ol>
<li>
<p>First we open up a terminal</p>
</li>
<li>
<p>Then we download the tftp server</p>
<pre>wget http://downloads.sourceforge.net/project/tftp-server/tftp%20server%20Unix/Unix%20Stable%201.6/tftpserverspV1.62.tar.gz</pre>
</li>
<li>
<p>Then we extract it and enter the directory and create a new tftp root folder</p>
<pre>tar xvfz tftpserverspV1.62.tar.gz
cd tftpserversp
mkdir tftproot</pre>
</li>
<li>
<p>Create a new file called <strong>config.ini</strong>, and inside it we put the following. Just remember to change the &lt;USERNAME&gt; to your username.</p>
<pre># Set the home directory where all files are stored
[HOME]
/home/&lt;USERNAME&gt;/tftpserversp/tftproot
# Set the username that the process will run under
[TFTP-OPTIONS]
username=&lt;USERNAME&gt;</pre>
<p>Look at the <strong>tftpserver.ini</strong> that came with the server for more configuration options and explanation.</p>
</li>
<li>
<p>Now were ready to run the server, and we use the following command</p>
<pre>sudo ./tftpserver -v -i config.ini</pre>
<p>The <strong>-v</strong> parameter makes it run in Verbatim mode and not as a daemon, and the <strong>-i</strong> specifies the config.ini file we just created.</p>
</li>
</ol>
<p>Now you just put all the files you want available in the /home/&lt;USERNAME&gt;/tftpserversp/tftproot/ folder and grab them through TFTP.</p>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/07/set-up-a-temporary-tftp-server-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx, php, upload and error 413: entity too large</title>
		<link>http://thehook.eu/2009/07/nginx-php-upload-and-error-413-entity-too-large/</link>
		<comments>http://thehook.eu/2009/07/nginx-php-upload-and-error-413-entity-too-large/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 15:04:43 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://thehook.eu/?p=94</guid>
		<description><![CDATA[The other day I was setting up a mail server and webmail for the users. I chose Nginx for task of course, and after installing everything and setting up Squirrelmail I took it for a test drive. I had already configured PHP to allow 64 MB uploads for the webmail users, and everything looked nice.. [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was setting up a mail server and webmail for the users. I chose Nginx for task of course, and after installing everything and setting up Squirrelmail I took it for a test drive.<img src="http://thehook.eu/wp-content/uploads/2009/07/413-entity-too-large-300x300.jpg" alt="413-entity-too-large" title="413-entity-too-large" width="300" height="300" class="alignright size-medium wp-image-95" /></p>
<p>I had already configured PHP to allow 64 MB uploads for the webmail users, and everything looked nice.. That was until I tried sending a mail with a 1.8 MB attachment.</p>
<p>After a little uploading the screen went blank and only displayed a <strong>413 &#8211; Entity too large</strong> error message.</p>
<p>What too large?? 1.8 MB it&#8217;s not even 2 MB&#8217;s and I get an error, when it&#8217;s supposed to accept up to 64 MB uploads..</p>
<p>After some searching and questioning it came for an day that Nginx has a parameter called <code>client_max_body_size</code> that by default is set to 1 MB, way less than 64 MB that I wanted.</p>
<p>To fix that you have to open the file /etc/nginx/nginx.conf in nano or whatever and add the following between the http { &#8230; }</p>
<pre>client_max_body_size 64m;</pre>
<p>Please note that the value is <strong>64m</strong> and not 64mb.</p>
<p>Then all you need is a restart of the nginx service</p>
<pre>/etc/init.d/nginx restart</pre>
]]></content:encoded>
			<wfw:commentRss>http://thehook.eu/2009/07/nginx-php-upload-and-error-413-entity-too-large/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

