<?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>cat brain.stuff &#62; wordpress &#187; General</title>
	<atom:link href="http://famvdploeg.com/blog/category/general/feed/" rel="self" type="application/rss+xml" />
	<link>http://famvdploeg.com/blog</link>
	<description>A simple look on things</description>
	<lastBuildDate>Fri, 30 Jul 2010 13:01:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>The paperless office</title>
		<link>http://famvdploeg.com/blog/2008/08/the-paperless-office/</link>
		<comments>http://famvdploeg.com/blog/2008/08/the-paperless-office/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 19:52:18 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[paper scan scanning ocr optical character recognition d]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=62</guid>
		<description><![CDATA[Well here we are once again. This time to conquer the pile of paper laying besides, on and under your desk. My girlfriend went nuts by the sheer load of paper laying around everywhere. I&#8217;m kind of messy but when I start to organize things I&#8217;m kind of a perfectionist. So here I went and [...]]]></description>
			<content:encoded><![CDATA[<p>Well here we are once again. This time to conquer the pile of paper laying besides, on and under your desk. My girlfriend went nuts by the sheer load of paper laying around everywhere. I&#8217;m kind of messy but when I start to organize things I&#8217;m kind of a perfectionist. So here I went and put all the papers in one big pile.</p>
<p>After going through the pile I realized that there were a lot of papers worth trowing away but at the same time we&#8217;re worth keeping. A dilemma. So I had a good cold beer and started thinking about the situation. The beer worked like oil on the brains and I came up with a good solution. &#8216;Let&#8217;s scan this pile of toiletpaper!&#8217; and so I provided my HP 7310 with some juice and put all the paperwork on the automatic paper input of the device. I inserted an empty SD-Card and started gaming while the HP started to do what it was made for.</p>
<p>After a few hours ( well actually the scanner was long done before that&#8230; plz don&#8217;t tell my girlfriend <img src='http://famvdploeg.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) the scans were complete and I put the files on my debian server. So far so good. Now at least I had a backup of all the paper versions. After that I was rather satisfied and threw away a large pile of paper I no longer needed as I had a digital backup now.</p>
<p>But a real geek doesn&#8217;t stop here. What I wanted next was to be able to search through my digital paperwork fast and get the papers that I need. So I had a look and found that there is a great open source ocr package called <a title="Tesseract-OCR" href="http://code.google.com/p/tesseract-ocr/" target="_blank">tesseract</a>. I downloaded some packages and started trying out some things. I found out that it was only capable of handling tiff images at this point and that it was best to avoid color in the images. To get the required images I installed ImageMagick to do the converting from jpg to grayscale uncompressed tiffs.</p>
<p>So far so good. This will result in a txt file containing the text in the file. Pretty neat. Now I can use grep to look for any string matches and then open the matching jpg. Easy as 1,2,3. <img src='http://famvdploeg.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>After this I created the following script that will parse any new images automatically with the ocr software.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">basedir</span>=<span style="color: #ff0000;">&quot;/share/downloads/Scans&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Parses a scan if not already processed</span>
<span style="color: #666666; font-style: italic;"># $1 = JPG file</span>
parse_scan<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #007800;">jpg_file</span>=$<span style="color: #000000;">1</span>
        <span style="color: #007800;">base_name</span>=<span style="color: #800000;">${jpg_file:0:(${#jpg_file}</span>-<span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
        <span style="color: #007800;">tif_file</span>=<span style="color: #007800;">$base_name</span>.TIF
        <span style="color: #007800;">txt_file</span>=<span style="color: #007800;">$base_name</span>.txt
&nbsp;
        <span style="color: #666666; font-style: italic;"># If tiff file does not exist, use imagemagick to convert</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$txt_file</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Converting: <span style="color: #007800;">$jpg_file</span> into <span style="color: #007800;">$tif_file</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#               echo $base_name</span>
<span style="color: #666666; font-style: italic;">#               echo $tif_file</span>
<span style="color: #666666; font-style: italic;">#               echo $txt_file</span>
&nbsp;
                <span style="color: #666666; font-style: italic;"># Convert jpg into tiff file</span>
                convert <span style="color: #007800;">$jpg_file</span> <span style="color: #660033;">-format</span> tiff <span style="color: #660033;">-colorspace</span> gray <span style="color: #660033;">-depth</span> <span style="color: #000000;">8</span> <span style="color: #660033;">-compress</span> none <span style="color: #007800;">$tif_file</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
&nbsp;
                <span style="color: #666666; font-style: italic;"># Use tesseract for ocr on tiff file</span>
                tesseract <span style="color: #007800;">$tif_file</span> <span style="color: #007800;">$base_name</span> <span style="color: #660033;">-l</span> nld <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
&nbsp;
                <span style="color: #666666; font-style: italic;"># Remove tiff file</span>
                <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$tif_file</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$basedir</span><span style="color: #000000; font-weight: bold;">/*</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">filename</span>=<span style="color: #007800;">$file</span>
        <span style="color: #007800;">length</span>=<span style="color: #800000;">${#filename}</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$filename</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-q</span> <span style="color: #ff0000;">'.jpg$'</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #666666; font-style: italic;"># Create TIF filename</span>
                parse_scan <span style="color: #007800;">$filename</span>
        <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$filename</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-q</span> <span style="color: #ff0000;">'.JPG$'</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #666666; font-style: italic;"># Create TIF filename</span>
                parse_scan <span style="color: #007800;">$filename</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>You can of course make the basedir an argument which can be passed into the shell script. But that is a personal choice. Now you can get rid of your pile of paper too. Let&#8217;s start recycling that pile of paper. <img src='http://famvdploeg.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/08/the-paperless-office/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion (SVN) Server Startup Script</title>
		<link>http://famvdploeg.com/blog/2008/02/subversion-svn-server-startup-script/</link>
		<comments>http://famvdploeg.com/blog/2008/02/subversion-svn-server-startup-script/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 12:27:55 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[subversion svn startup script debian]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=37</guid>
		<description><![CDATA[To be able to start and stop my subversion server nicely I created the following script to startup and shutdown under debian. #! /bin/sh # /etc/init.d/svnserve: start and stop svnserve &#160; # Exit immediately if a command exits with a nonzero exit status. set -e &#160; # svnserve exists and is executable test -x /usr/bin/svnserve [...]]]></description>
			<content:encoded><![CDATA[<p>To be able to start and stop my subversion server nicely I created the following script to startup and shutdown under debian.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/sh</span>
<span style="color: #666666; font-style: italic;"># /etc/init.d/svnserve: start and stop svnserve</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Exit immediately if a command exits with a nonzero exit status.</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># svnserve exists and is executable</span>
<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnserve</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Directory Where the Repository is located, created with svnadmin create</span>
<span style="color: #007800;">REPOS_DIR</span>=<span style="color: #ff0000;">&quot;/opt/svn&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># The pid-file</span>
<span style="color: #007800;">PIDFILE</span>=<span style="color: #ff0000;">&quot;/var/run/svnserve.pid&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
  start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Starting Subversion (SVN) Server&quot;</span>
        start-stop-daemon <span style="color: #660033;">--start</span> <span style="color: #660033;">--quiet</span> \
                <span style="color: #660033;">--exec</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnserve</span> <span style="color: #660033;">--</span> <span style="color: #660033;">-dr</span> <span style="color: #007800;">$REPOS_DIR</span>
        <span style="color: #666666; font-style: italic;"># Also tried the following line but it didn't work ok</span>
        <span style="color: #666666; font-style: italic;">#       --make-pidfile --pidfile $PIDFILE</span>
        <span style="color: #007800;">PID</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> <span style="color: #c20cb9; font-weight: bold;">svnserve</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #c20cb9; font-weight: bold;">true</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$PID</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$PIDFILE</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
  stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Stopping Subversion (SVN) Server&quot;</span>
        start-stop-daemon <span style="color: #660033;">--stop</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--oknodo</span> <span style="color: #660033;">--pidfile</span> <span style="color: #007800;">$PIDFILE</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$PIDFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
        <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$PIDFILE</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: /etc/init.d/svnserve {start|stop}&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Place the script in /etc/init.d/svnserve and run the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-rc.d <span style="color: #c20cb9; font-weight: bold;">svnserve</span> defaults</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/02/subversion-svn-server-startup-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tomcat behind reverse proxy on Apache</title>
		<link>http://famvdploeg.com/blog/2008/01/tomcat-behind-reverse-proxy-on-apache/</link>
		<comments>http://famvdploeg.com/blog/2008/01/tomcat-behind-reverse-proxy-on-apache/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 10:23:47 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[apache tomcat reverse proxy]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=33</guid>
		<description><![CDATA[If you have apache installed as your main http server you might want all requests to be handled by apache. But what if you want to have a standalone tomcat install? Well this is still possible by using apache&#8217;s mod_proxy. You might need to install it if you are running debian. Do some &#8216;apt-cache search [...]]]></description>
			<content:encoded><![CDATA[<p>If you have apache installed as your main http server you might want all requests to be handled by apache. But what if you want to have a standalone tomcat install? Well this is still possible by using apache&#8217;s mod_proxy. You might need to install it if you are running debian. Do some &#8216;apt-cache search apache proxy&#8217; abracadbra and install mod_proxy if it is not already installed. You might even need to enable it with &#8216;a2enmod proxy&#8217;.</p>
<p>Edit your configuration (I added it to the sites-available/default) and add something  like this:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;"># Tomcat Proxy</span>
    RedirectMatch <span style="color: #339933;">^/</span>tomcat$ <span style="color: #009966; font-style: italic;">/tomcat/</span>
    ProxyRequests Off
    ProxyVia Off
    ProxyPass <span style="color: #009966; font-style: italic;">/tomcat/</span> http<span style="color: #339933;">://</span>localhost<span style="color: #339933;">:</span><span style="color: #cc66cc;">8082</span><span style="color: #339933;">/</span>
    ProxyPassReverse <span style="color: #009966; font-style: italic;">/tomcat/</span> http<span style="color: #339933;">://</span>localhost<span style="color: #339933;">:</span><span style="color: #cc66cc;">8082</span><span style="color: #339933;">/</span></pre></div></div>

<p>You also might want add some access rules to make sure noone will be able to abuse your proxy (especially when running a forward proxy).</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>proxy <span style="color: #339933;">*:</span><span style="color: #cc66cc;">80</span><span style="color: #339933;">&gt;</span>
Order deny<span style="color: #339933;">,</span>allow
Deny from all
<span style="color: #339933;">&lt;/</span>proxy<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>proxy <span style="color: #339933;">*:</span><span style="color: #cc66cc;">8080</span><span style="color: #339933;">&gt;</span>
Order deny<span style="color: #339933;">,</span>allow
Deny from all
Allow from 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1
<span style="color: #339933;">&lt;/</span>proxy<span style="color: #339933;">&gt;</span></pre></div></div>

<p>This should do the trick (after reloading apache of course, /etc/init.d/apache2 reload). The redirectmatch will make sure that users that reach http://serveraddress/tomcat will be redirected to http://serveraddress/tomcat/ because otherwise they would not reach the page.<br />
The proxypass points to /tomcat/ note the trailing slash. If you omit the trailing slash your images will not load correctly. port 8082 is tomcat&#8217;s proxy port which will allow proxied connect calls.</p>
<p>You can use the same trick for any other webserver you have running on another port. (webmin, azureus web html, etc)</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/01/tomcat-behind-reverse-proxy-on-apache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up an apache2 proxy server</title>
		<link>http://famvdploeg.com/blog/2008/01/setting-up-an-apache2-proxy-server/</link>
		<comments>http://famvdploeg.com/blog/2008/01/setting-up-an-apache2-proxy-server/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 07:53:06 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[ssh proxy firewall apache2]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=32</guid>
		<description><![CDATA[note: I found out that you can also use the ssh -D option to have ssh function as a SOCKS server to get similar behaviour without the hassle of configuring apache. Are you at work behind a big bad evil proxy? Afraid of your privacy? Set up a proxy on your local home server so [...]]]></description>
			<content:encoded><![CDATA[<p>note: I found out that you can also use the ssh -D option to have ssh function as a SOCKS server to get similar behaviour without the hassle of configuring apache.</p>
<p>Are you at work behind a big bad evil proxy? Afraid of your privacy? Set up a proxy on your local home server so you can browse safely.</p>
<p>What are we going to use:</p>
<ul>
<li>Putty</li>
<li>Apache 2</li>
</ul>
<p>Is that all we need? Yes that&#8217;s all. <img src='http://famvdploeg.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Ok let&#8217;s set up our apache 2 proxy first. It is a good idea to add some security to your proxy server so not everyone can reach it. You might want to restrict it to the localhost only.  This tutorial is based on debian install of apache 2. So hang on and let&#8217;s go.</p>
<p>First change the ports apache2 is listening in to. Edit /etc/apache2/ports.conf for this purpose and add the line:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Listen 8080</pre></div></div>

<p>This will make the apache2 server listen to port 8080. If there is a line that makes apache2 listen on port 443 (https) you might want to disable it. We are going to use putty to connect to this port.</p>
<p>You might need to download mod_proxy for apache2 to be able to use proxying.  If it is not already enabled use:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">a2enmod proxy
a2enmod proxy_connect
a2enmod proxy_html
a2enmod proxy_ftp</pre></div></div>

<p>This will enable it. If mod proxy is not yet installed at all use an apt-cache search mod proxy to locate and install it through apt.<br />
the mod <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#allowconnect" title="Why we need mod proxy_connect" target="_blank">proxy_connect</a> is required to be able to handle SSL calls through your proxy.</p>
<p>Create a new entry in /etc/apache/sites-available and name it &#8216;proxy&#8217; for example. Insert something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>virtualhost <span style="color: #339933;">*:</span><span style="color: #cc66cc;">8080</span><span style="color: #339933;">&gt;</span>
        ServerAdmin webmaster<span style="color: #0000ff;">@localhost</span>
&nbsp;
        ProxyRequests On
        ProxyVia On
&nbsp;
        <span style="color: #666666; font-style: italic;">#Add ports you want to be able to connect to through your proxy here</span>
        AllowCONNECT <span style="color: #cc66cc;">443</span> <span style="color: #cc66cc;">563</span> <span style="color: #cc66cc;">1863</span> <span style="color: #cc66cc;">10000</span>
        <span style="color: #666666; font-style: italic;">#443   = SSL</span>
        <span style="color: #666666; font-style: italic;">#563   = TLS</span>
        <span style="color: #666666; font-style: italic;">#1863  = MSN Messenger</span>
        <span style="color: #666666; font-style: italic;">#10000 = Webmin</span>
&nbsp;
        DocumentRoot <span style="color: #339933;">/</span>var<span style="color: #339933;">/</span>www<span style="color: #339933;">/</span>
        <span style="color: #339933;">&lt;</span>Directory <span style="color: #339933;">/&gt;</span>
                Options FollowSymLinks
                AllowOverride None
        <span style="color: #339933;">&lt;/</span>Directory<span style="color: #339933;">&gt;</span>
&nbsp;
        ErrorLog <span style="color: #339933;">/</span>var<span style="color: #339933;">/</span><span style="color: #000066;">log</span><span style="color: #339933;">/</span>apache2<span style="color: #339933;">/</span>proxy<span style="color: #339933;">-</span>error<span style="color: #339933;">.</span><span style="color: #000066;">log</span>
        TransferLog <span style="color: #339933;">/</span>var<span style="color: #339933;">/</span><span style="color: #000066;">log</span><span style="color: #339933;">/</span>apache2<span style="color: #339933;">/</span>proxy<span style="color: #339933;">-</span>transfer<span style="color: #339933;">.</span><span style="color: #000066;">log</span>
        <span style="color: #666666; font-style: italic;"># Possible values include: debug, info, notice, warn, error, crit,</span>
        <span style="color: #666666; font-style: italic;"># alert, emerg.</span>
        LogLevel notice
<span style="color: #339933;">&lt;/</span>virtualhost<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Enable this new site by typing:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">a2ensite proxy</pre></div></div>

<p>It would be really wise to limit the access to your forward proxy.<br />
edit the proxy.conf file in /mods-available/proxy.conf.<br />
Add something like this to allow only connections from localhost:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>proxy <span style="color: #339933;">*:</span><span style="color: #cc66cc;">80</span><span style="color: #339933;">&gt;</span>
    Order Deny<span style="color: #339933;">,</span>Allow
    Deny from all
<span style="color: #339933;">&lt;/</span>proxy<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>proxy <span style="color: #339933;">*:</span><span style="color: #cc66cc;">8080</span><span style="color: #339933;">&gt;</span>
    Order Deny<span style="color: #339933;">,</span>Allow
    Deny from all
    Allow from 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1
<span style="color: #339933;">&lt;/</span>proxy<span style="color: #339933;">&gt;</span></pre></div></div>

<p>reload the webserver after this by running:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">/etc/init.d/apache2 reload</pre></div></div>

<p>Add 443 to your ssh listen ports by opening /etc/ssh/sshd_config.<br />
Edit it so it reads:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"># What ports, IPs and protocols we listen for
Port 22
Port 443</pre></div></div>

<p>Restart the ssh daemon by calling:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">/etc/init.d/ssh restart</pre></div></div>

<p>Now you are ready to go. You can try your proxy now by using putty to connect to your server and tunnel port 8080 to another port on your local machine. It might also be a good idea to enable zip compression on your connection (Putty:Connection-&gt;SSH-&gt;Enable Compression) to speed things up a bit.<br />
Now you can use firefox or another app and connect on localhost:[bound putty port] to connect to your proxy.</p>
<p>If you want firefox to do the dns lookups on the remote end you should open your about:config page by typing this in the address bar. Lookup the value:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">network.proxy.socks_remote_dns</pre></div></div>

<p>Set the value to true to do remote dns lookups.</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/01/setting-up-an-apache2-proxy-server/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Setting up Rsync</title>
		<link>http://famvdploeg.com/blog/2008/01/setting-up-rsync/</link>
		<comments>http://famvdploeg.com/blog/2008/01/setting-up-rsync/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 08:37:29 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=31</guid>
		<description><![CDATA[I was getting fed up with having to synchronize several folders containing photos. So I was looking for a good way to synchronize these images across the network. I first tried to put the images into Subversion but this turned out to be overkill. So that&#8217;s why I put my focus on Rsync. Rsync has [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting fed up with having to synchronize several folders containing photos. So I was looking for a good way to synchronize these images across the network. I first tried to put the images into Subversion but this turned out to be overkill. So that&#8217;s why I put my focus on <a href="http://samba.anu.edu.au/rsync/" title="Rsync homepage" target="_blank">Rsync</a>.</p>
<p>Rsync has  support for incremental file exchange. Not that I am going to use it but it still is cool. I will only use Rsync to keep my photo directories synched with the server. So lets install it.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">apt<span style="color: #66cc66;">-</span>get install rsync</pre></div></div>

<p>Edit the rsyncd.conf file in the /etc directory and create some entries here. Example is my photos entry here.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#/etc/rsyncd.conf</span>
<span style="color: #808080; font-style: italic;">#file containing username+passwords in the form &lt;name&gt;:</span>
<span style="color: #66cc66;">&lt;</span>password<span style="color: #66cc66;">&gt;</span> the file should be readable only <span style="color: #993333; font-weight: bold;">BY</span> user <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">GROUP</span><span style="color: #66cc66;">.</span>
<span style="color: #808080; font-style: italic;">#so chmod 660 or 600 would be necessary.</span>
secrets file <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">/</span>etc<span style="color: #66cc66;">/</span>rsyncd<span style="color: #66cc66;">.</span>secrets
motd file <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">/</span>etc<span style="color: #66cc66;">/</span>rsyncd<span style="color: #66cc66;">.</span>motd 
&nbsp;
<span style="color: #808080; font-style: italic;">#Below are actually defaults, but to be on the safe side...</span>
<span style="color: #993333; font-weight: bold;">READ</span> only <span style="color: #66cc66;">=</span> yes
list <span style="color: #66cc66;">=</span> yes
<span style="color: #808080; font-style: italic;"># with what user permissions should rsync handle directories?</span>
uid <span style="color: #66cc66;">=</span> nobody
<span style="color: #808080; font-style: italic;">#gid = nobody</span>
<span style="color: #808080; font-style: italic;">#On debian group nobody is mapped to nogroup</span>
gid <span style="color: #66cc66;">=</span> nogroup
<span style="color: #808080; font-style: italic;">#if stricts mode is true secrets file should not be readable by all. To disable this turn stricts mode to off. (built in for cygwin users)</span>
strict modes <span style="color: #66cc66;">=</span> true
&nbsp;
<span style="color: #66cc66;">&#91;</span>photos<span style="color: #66cc66;">&#93;</span>
comment <span style="color: #66cc66;">=</span> Family Photos
path <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">/</span>share<span style="color: #66cc66;">/</span>photos
auth users <span style="color: #66cc66;">=</span> wytze<span style="color: #66cc66;">,</span>wytske
<span style="color: #993333; font-weight: bold;">READ</span> only <span style="color: #66cc66;">=</span> no
hosts allow <span style="color: #66cc66;">=</span> 192<span style="color: #66cc66;">.</span>168<span style="color: #66cc66;">.*</span>
hosts deny <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">*</span>
list <span style="color: #66cc66;">=</span> false
<span style="color: #66cc66;">&lt;/</span>password<span style="color: #66cc66;">&gt;&lt;/</span>name<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>Start the rsync daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">rsync <span style="color: #808080; font-style: italic;">--daemon</span></pre></div></div>

<p>Now you can start synchronizing. Synchronizing works like copying files with scp. So it&#8217;s fairly straightforward.</p>
<p>To retrieve a list of entries if listing is enabled:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">rsync <span style="color: #66cc66;">-</span>avz wytze@debian::</pre></div></div>

<p>To synchronize files from server:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">rsync <span style="color: #66cc66;">-</span>avz wytze@debian::photos <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>my<span style="color: #66cc66;">-</span>local<span style="color: #66cc66;">-</span>photos</pre></div></div>

<p>To synchronize files to the server:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">rsync <span style="color: #66cc66;">-</span>avz <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>my<span style="color: #66cc66;">-</span>local<span style="color: #66cc66;">-</span>photos<span style="color: #66cc66;">/</span> wytze@debian::photos</pre></div></div>

<p>Please mind the trailing slashes. Try out the difference with and without the trailing slash. Pretty straightforward there.</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2008/01/setting-up-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending commands to detached screens</title>
		<link>http://famvdploeg.com/blog/2007/11/sending-commands-to-detached-screens/</link>
		<comments>http://famvdploeg.com/blog/2007/11/sending-commands-to-detached-screens/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 12:40:22 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[execute]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=26</guid>
		<description><![CDATA[For running Azureus headless on my linux machine I use screen so it runs in a separate screen. The command to do this is the following: screen -d -m -S azureus su -p azureus -c &#34;/opt/azureus/azureus.sh&#34; This will create a detached screen with the name &#8220;azureus&#8221; which will run the command &#8220;su -p azureus -c [...]]]></description>
			<content:encoded><![CDATA[<p>For running Azureus headless on my linux machine I use screen so it runs in a separate screen.</p>
<p>The command to do this is the following:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">screen -d -m -S azureus su -p azureus -c &quot;/opt/azureus/azureus.sh&quot;</pre></div></div>

<p>This will create a detached screen with the name &#8220;azureus&#8221; which will run the command &#8220;su -p azureus -c &#8220;/opt/azureus/azureus.sh&#8221;</p>
<p>To send a command to this detached screen we can use the following command structure: (Which I use to tidily close the process)</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">screen -S azureus -p 0 -X eval 'stuff quit\015'</pre></div></div>

<p>-p 0 tells screen to use window 0 on the specified screen. Using the eval function makes sure the \015 char will be evaluated back into an enter character. The stuff command is used to fill the input buffer of the screen program.</p>
<p>After this the command &#8220;quit&#8221; is sent to the azureus client which will cause it to quit and close the attached screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2007/11/sending-commands-to-detached-screens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MoBlock and Hamachi</title>
		<link>http://famvdploeg.com/blog/2007/10/moblock-and-hamachi/</link>
		<comments>http://famvdploeg.com/blog/2007/10/moblock-and-hamachi/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 11:45:00 +0000</pubDate>
		<dc:creator>Wytze</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://famvdploeg.com/blog/?p=22</guid>
		<description><![CDATA[After installing moblock (a p2p guardian program) I found that my hamachi was no longer working. To fix this I had to modify the moblock.conf file in the /etc/moblock directory. I did so by specifying a network address with a netmask. Hamachi&#8217;s ip-range starts with a 5. So the address would be 5.0.0.0 The netmask [...]]]></description>
			<content:encoded><![CDATA[<p>After installing moblock (a p2p guardian program) I found that my hamachi was no longer working. <img src='http://famvdploeg.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>To fix this I had to modify the moblock.conf file in the /etc/moblock directory.<br />
I did so by specifying a network address with a netmask.</p>
<p>Hamachi&#8217;s ip-range starts with a 5. So the address would be 5.0.0.0<br />
The netmask is 255.0.0.0 to allow all hamachi ip&#8217;s to connect. Because 255.0.0.0 means we have 8 bits on 1. The line becomes: 5.0.0.0/8</p>
<p>Add this line to the  IP_TCP_IN line for example and restart moblock with <em>moblock-control restart. </em>After I did this I was able to reconnect with my linux server from hamachi. Hurray!</p>
<p>[update]Ok, maybe you also want to add LOGMEIN to your ignore block list. :S<br />
Do so by changing the IP_REMOVE line into IP_REMOVE=&#8221;LOGMEIN&#8221;.<br />
Do a moblock-control reload after this to reload the new configuration[/update]</p>
]]></content:encoded>
			<wfw:commentRss>http://famvdploeg.com/blog/2007/10/moblock-and-hamachi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
