<?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>subutux</title>
	<atom:link href="http://blog.subutux.be/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.subutux.be</link>
	<description>Life could be easy if its cli</description>
	<lastBuildDate>Mon, 27 Feb 2012 09:04:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>RESTProxy, a proxy for REST API&#8217;s</title>
		<link>http://blog.subutux.be/2012/02/27/restproxy-a-proxy-for-rest-apis/</link>
		<comments>http://blog.subutux.be/2012/02/27/restproxy-a-proxy-for-rest-apis/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 07:00:43 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[Opsview REST API]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[opsview]]></category>
		<category><![CDATA[REST api]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=372</guid>
		<description><![CDATA[So yeah, what&#8217;s the greatest disadvantage of using ajax calls in javascript? you must send your request to the same domain. That can be sometimes a pain in the ass. The same goes for my javascript REST API client for Opsview. I wanted to host my code on another server to keep de load to [...]]]></description>
			<content:encoded><![CDATA[
<p><img class="alignnone size-full wp-image-358" title="opsview-blog" src="http://blog.subutux.be/wp-content/uploads/2012/02/opsview-blog.png" alt="" width="500" /><br />
So yeah, what&#8217;s the greatest disadvantage of using ajax calls in javascript? <strong>you must send your request to the same domain. </strong>That can be sometimes a pain in the ass. The same goes for my<a title="Opsview REST API client for javascript" href="http://blog.subutux.be/2012/02/24/opsview-rest-api-client-for-javascript/" target="_blank"> javascript REST API client for Opsview</a>. I wanted to host my code on another server to keep de load to my opsview server as low as possible. so I wrote a RESTProxy. the functionality is quite simple. Let me explain it to you by using my javascript client:</p>
<pre class="brush: jscript; gutter: true; title: ; notranslate">
opsview = new opsviewrestapi('my.opsview.server',3000)
opsview.proxy('/RESTProxy.php');
status = new opsview.api('status');
status.ops.state = '2';
status.ops.filter = 'unhandled';
status.get(function(data){
  console.log(data);
});
</pre>
<p>So what did I do here?First, I defined my server in the opsviewrestapi and his port. Then I defined the Proxy page.What happens in the background?All request are send to the proxy php page instead of going directly to our opsview server. Everything is the same, except the client class adds 2 headers extra with the request. Take a look at the request:</p>
<pre class="brush: plain; gutter: true; highlight: [13,14]; title: ; notranslate">
request-URL:http://my.web.server/RESTProxy.php/rest/status/service?state=2&amp;filter=unhandled
requestmethod:GET
Statuscode:200 OK
request headers:
 Accept:application/json
 Content-Type:application/json
 DNT:1
 Referer:http://my.web.server/opsview/index.html
 User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10
 X-Opsview-Token:cdb5c6d0c66e3b7ff331d872ceecfaa3c9f7f62b
 X-Opsview-Username:admin
 X-Requested-With:XMLHttpRequest
 x-RESTProxy-Host:my.opsview.server
 x-RESTProxy-Port:3000
</pre>
<p>See what happened here? the REST API location path is just added to the RESTProxy.php location (apache supports this out of the box), the whole request is just the same as directly to the opsview server except for the last two headers:</p>
<pre>x-RESTProxy-Host
x-RESTProxy-Port</pre>
<p>These headers are captured by our php rest proxy, deleted of the header list and the whole request is forwarded to the defined server with curl.</p>
<p>The output of the curl request is then returned to our javascript client class just as we expect it with a few differences:</p>
<pre class="brush: plain; title: ; notranslate">
Connection:Keep-Alive
Content-Length:989
Content-Type:application/json
Date:Sun, 26 Feb 2012 11:48:19 GMT
Keep-Alive:timeout=15, max=98
Server:Apache/2.2.14 (Ubuntu)
X-Powered-By:RESTProxy - PHP/5.3.2-1ubuntu4.14
x-RESTProxy-connect-time:0.000108
x-RESTProxy-download-content-lenght:989
x-RESTProxy-namelookup-time:2.8E-5
x-RESTProxy-redirect-time:0
x-RESTProxy-size-download:989
x-RESTProxy-size-upload:0
x-RESTProxy-speed-download:5460
x-RESTProxy-speed-upload:0
x-RESTProxy-start-transfer-time:0.181103
x-RESTProxy-total-time:0.181115
x-RESTProxy-upload-content-lenght:0
x-RESTProxy-url:http://my.opsview.server:3000/rest/status/service?state=2&amp;filter=unhandled
</pre>
<p>There are some debug headers added if there is a problem with the proxy.</p>
<p>So there you go! take a look at the code on github: <a href="http://github.com/subutux/RESTProxy" target="_blank">http://github.com/subutux/RESTProxy</a></p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2012/02/27/restproxy-a-proxy-for-rest-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opsview REST API client for javascript</title>
		<link>http://blog.subutux.be/2012/02/24/opsview-rest-api-client-for-javascript/</link>
		<comments>http://blog.subutux.be/2012/02/24/opsview-rest-api-client-for-javascript/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 08:52:32 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[Opsview REST API]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=357</guid>
		<description><![CDATA[After moving our Opsview server to a &#8220;real&#8221; server (before it was a virtual machine, begging for more RAM), I started experimenting with the REST API of Opsview. First in PHP. Was fun but I wanted to load the data dynamically in javascript. So, I wrote a javascript client class for the Opsview REST API. It works [...]]]></description>
			<content:encoded><![CDATA[
<p><img class="alignnone size-full wp-image-358" title="opsview-blog" src="http://blog.subutux.be/wp-content/uploads/2012/02/opsview-blog.png" alt="" width="500" /></p>
<p>After moving our Opsview server to a &#8220;real&#8221; server (before it was a virtual machine, begging for more RAM), I started experimenting with the REST API of Opsview. First in PHP. Was fun but I wanted to load the data dynamically in javascript. So, I wrote a javascript client class for the Opsview REST API. It works pretty sweet! The usage is quite simple if I may say so:</p>
<pre class="brush: jscript; gutter: true; title: ; notranslate">
//first we declare our opsview server. !Note! Cross domain scripting is not allowed,
//so this code must run on the same server as Opsview!
opsview = new opsviewrestapi('../');
//authenticate
opsview.authenticate('admin','initial',function(data){
	// if authentication succeeded, execute this code

	// Create a new api call
	hosts = new opsview.api('status/host');
	// We set our options
	hosts.ops.host_state = '0'; // Only UP hosts
	hosts.ops.host_state_type = 'hard'; // With a hard state type
	//do the request
	host.get(function(data){
		for (host in data.list){
			// show the up hosts in the body
			$('body').append('&lt;div&gt;UP - ' + data.list[host].name + '&lt;/div&gt;');
		}
	});
});
</pre>
<p><strong>Explanation</strong></p>
<pre class="brush: jscript; gutter: true; title: ; notranslate">
opsview = new opsviewrestapi('../');
</pre>
<p>In this example our server is http://opsview with the html containing the above javascript at http://opsview/test/demo1.html. In the above example we define &#8216;../&#8217; as the server location of opsview. Why? because cross-domain scripting is not allowed by the browser. I&#8217;ve made a workaround for this but more on that later in another blogpost.</p>
<pre class="brush: jscript; gutter: true; title: ; notranslate">
opsview.authenticate(user,pass,success(data),fail(xhr));
</pre>
<p>Pretty straight forward I think? Success is executed when the request was successful and we got a login token. fail is run when there is an authentication error or request error.</p>
<pre class="brush: jscript; gutter: true; title: ; notranslate">
hosts = new opsview.api('status/host');
</pre>
<p>Now this is the fun part! See what i did here? the opsview.api parameter is acutally the url for the REST API after the &#8216;rest/&#8217; part. So what&#8217;s in this host variable now? Let&#8217;s see:</p>
<pre class="brush: jscript; gutter: true; title: ; notranslate">
hosts = {
'url' : '/rest/status/host', //the full url of the REST API. Can be used to add GET parameters to a POST method
'ops' : {}, // An object containing the request parameters. if the request method is GET, this will be used as url parameters, else it's used in the request body.
'method' : 'GET', // Informative default method
get(), // GET the results *
post(), // POST the results *
put(), // PUT the results *
delete() // DELETE the results *
}
</pre>
<p>the post(),put(),delet() functions are only available when the REST API supports it.</p>
<p>So  that&#8217;s about it then. I&#8217;ll upload the client soon. But first I need to explain you my REST API Proxy. that&#8217;s for another time.</p>
<p><strong>Update: </strong>here&#8217;s the GIT:<strong> <a href="https://github.com/subutux/opsviewrestapi-js">https://github.com/subutux/opsviewrestapi-js</a></strong></p>
<p><strong>Update2: </strong>Little side-note: I&#8217;m using the jQuery lib. Just a headsup!</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2012/02/24/opsview-rest-api-client-for-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Snipplet: PHP logging</title>
		<link>http://blog.subutux.be/2011/02/22/snipplet-php-logging/</link>
		<comments>http://blog.subutux.be/2011/02/22/snipplet-php-logging/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 10:48:23 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[snipplets]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[logger]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snipplet]]></category>
		<category><![CDATA[txt]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=341</guid>
		<description><![CDATA[I use this script often to debug my php applications &#38; scripts where console output/ web browser output can&#8217;t be done (like debugging ajax signals). This logging function has the following features: Custom log location: define the relative path for your logfile. Make sure the path is writable for the webserver user (under ubuntu this [...]]]></description>
			<content:encoded><![CDATA[
<p>I use this script often to debug my php applications &amp; scripts where console output/ web browser output can&#8217;t be done (like debugging ajax signals).</p>
<p>This logging function has the following features:</p>
<ul>
<li><strong>Custom log location</strong>:<br />
define the relative path for your logfile. Make sure the path is writable for the webserver user (under ubuntu this is www-data)</li>
<li><strong>Log levels:<br />
</strong>You can define from witch log level there should be logged.</li>
<li><strong>App names:<br />
</strong>define witch section/function this log line is from</li>
</ul>
<p>Examples:</p>
<pre class="brush: php; gutter: true; title: ; notranslate">
logger('ajaxPost-&gt;time',&quot;Time is set at&quot;.$time); //Default loglevel 1
logger('ajaxPost-&gt;time',&quot;Time is set at&quot;.$time,&quot;2&quot;); // loglevel 2
logger('ajaxPost-&gt;time',&quot;Time is set at&quot;.$time,&quot;3&quot;); //loglevel 3, will not be logged because smaller than $logger['LEVEL'].
</pre>
<p>Enjoy!</p>
<pre class="brush: php; gutter: true; title: ; toolbar: true; notranslate">
&lt;?
$logger['PATH'] = &quot;/var/www/logs/master.&quot;.date('Ymd').&quot;.log&quot;;
$logger['LEVEL'] = 2;
function logger($name,$mesg,$level = 1){
	if (isset($_SESSION['username'])){
		$u =&quot;[&quot;.$_SESSION['username'].&quot;]&quot;;
	} else  $u = &quot;&quot;;
        global $logger;
	//echo $level;
	if ($level &lt;= $logger['LEVEL']){
	        $line = date('M d Y H:i:s').&quot; [&quot;.$name.&quot;]&quot;.$u.&quot;: &quot;.$mesg.&quot;\n&quot;;
	               //Jan 07 2010 22:10:41 [MySection] :
	        $f['fh'] = fopen($logger['PATH'],'a')or die(&quot;can't open file &quot;.$logger['PATH'].&quot;!&quot;);
	        fwrite($f['fh'],$line);
	        fclose($f['fh']);
	}
}
?&gt;
</pre>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2011/02/22/snipplet-php-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Magic Mouse under Ubuntu [update]</title>
		<link>http://blog.subutux.be/2011/02/21/the-magic-mouse-under-ubuntu/</link>
		<comments>http://blog.subutux.be/2011/02/21/the-magic-mouse-under-ubuntu/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 09:12:51 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[dkpms]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[magic]]></category>
		<category><![CDATA[magic mouse]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=335</guid>
		<description><![CDATA[I recently bought myself a magic mouse. In the first place to use it with my MacBook Air (such a sweet laptop!) but why shouldn&#8217;t I use it on my ubuntu pc? The initial configuration is as easy as other bluetooth enabled hardware. Choose from the bluetooth applet drop down menu &#8220;Configure new device&#8230;&#8221;. Make [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: center;"><a href="http://blog.subutux.be/wp-content/uploads/2011/02/magic-mouse-ubuntu-638x300.png"><img class="size-full wp-image-336 aligncenter" title="magic-mouse-ubuntu-638x300" src="http://blog.subutux.be/wp-content/uploads/2011/02/magic-mouse-ubuntu-638x300.png" alt="" width="505" height="238" /></a></p>
<p>I recently bought myself a magic mouse. In the first place to use it with my MacBook Air (such a sweet laptop!) but why shouldn&#8217;t I use it on my ubuntu pc? <span id="more-335"></span>The initial configuration is as easy as other bluetooth enabled hardware. Choose from the bluetooth applet drop down menu &#8220;Configure new device&#8230;&#8221;. Make sure your mouse is turned on (the little switch at the bottom of the mouse). Choose your mouse from the list and use the PIN &#8220;0000&#8243;. When your magic mouse is paired, the little green light at the bottom of your magic mouse stops blinking and lights up green. Now you can use your magic mouse as a normal mouse but, multi-touch &amp; scrolling doesn&#8217;t work.</p>
<p>After some searching on the ubuntu fora, I&#8217;ve found this post : http://ubuntuforums.org/showthread.php?t=1534190<br />
Apparently, the magic mouse works out of the box in 10.10 :</p>
<blockquote><p>I just got my magic mouse and was expecting problems, but to my delight  scrolling works out of the box. I&#8217;m running an up to date 10.10 (alpha?)  with kernel 2.6.35-13. I guess all the drivers have been inserted into  the new kernel. Haven&#8217;t tried  any 2-finger zooming etc as yet.</p></blockquote>
<p>Some dude maintains the backports for Maverick (10.04) of the Magic Mouse drivers on his github:http://github.com/scottferg/multitouch</p>
<p>Head over there and download the tarball. unpack it and open an terminal and head over to the directory where the source of the drivers are. run the following:</p>
<pre class="brush: bash; title: ; notranslate">

sudo apt-get install cdbs

dpkg-buildpackage -rfakeroot -b

cd ..

sudo dpkg -i multitouch-kernel-source_1.5_all.deb
</pre>
<p dir="ltr">reboot your pc, connect your mouse (make sure bluetooth is active, power on the mouse, wait a few seconds and click the mouse) and enter the &#8220;0000&#8243; pin. Scrolling on the x &amp; y axes should work now.</p>
<p dir="ltr">Another dude made a python script for multitouch gestures on the gnome desktop:</p>
<blockquote><p>Hardcore hacks ahoy.  If you use my kernel driver and follow <a href="http://pymt.eu/wiki/DevGuide/InstallPymtUbuntu" target="_blank">these</a> <a href="https://wiki.ubuntu.com/Multitouch/PyMT" target="_blank">instructions</a> you can get PyMT up and running on Lucid.  PyMT requires an application  to be running on the desktop, but continues to accept input whether or  not the app has focus (or is minimized).  Because of this, I was able to  hack together a rough implementation of multitouch gestures for the  desktop.</p>
<p>Swiping left/right with two fingers will rotate the cube.  Swiping down  with three fingers will call up Expose.  In order to use this you will  need the Dbus, Scale, and Rotate Cube plugins enabled in Compiz.  I also  had to be a little dirty and apply:</p>
<div>
<div>Code:</div>
<pre dir="ltr">$ sudo chmod a+r /dev/input/event7</pre>
</div>
<p>in order to run the app as the current user.  Without this, Dbus can&#8217;t connect to the running session.</p>
<p>Here&#8217;s the Python file: <a href="http://gist.github.com/546779" target="_blank">http://gist.github.com/546779</a></p>
<p>PyMT installation instructions for Lucid: <a href="http://pymt.eu/wiki/DevGuide/InstallPymtUbuntu" target="_blank">http://pymt.eu/wiki/DevGuide/InstallPymtUbuntu</a><br />
PyMT configuration instructions for Ubuntu: <a href="https://wiki.ubuntu.com/Multitouch/PyMT" target="_blank">https://wiki.ubuntu.com/Multitouch/PyMT</a></p></blockquote>
<p>I haven&#8217;t tried this out. Let me know ( and the dudes on the forum post ) how it works for you!</p>
<p><strong>Update:</strong> Turns out PyMT stands for Python Multi Touch, and is kinda a python library for multi touch gestures. This dude above created a python script that uses multi touch gestures to interact with your (compiz) desktop.</p>
<ul>
<li>3 finger swipe up:<br />
show desktop</li>
<li>3 finger swipe down:<br />
exposé</li>
<li>2 finger swipe left:<br />
rotate desktop cube left</li>
<li>2 finger swipe right:<br />
rotate desktop cube right</li>
</ul>
<p>If you follow the instructions, it&#8217;s easy to install!</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2011/02/21/the-magic-mouse-under-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Handbrake Server &#8211; Development</title>
		<link>http://blog.subutux.be/2011/02/18/handbrake-server-development/</link>
		<comments>http://blog.subutux.be/2011/02/18/handbrake-server-development/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 10:05:02 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[Handbrake Server]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[airplay]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[handbrake]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[m4v]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=328</guid>
		<description><![CDATA[What the hell is Handrbrake Server ? Handbrake server wants to be a server version of the popular Handbrake application for video conversion. It allows to read video files from shares or uploaded files and converts these files to itunes compatible formats for you to enjoy. But why? Because there is a need for this. [...]]]></description>
			<content:encoded><![CDATA[
<h2>What the hell is Handrbrake Server ?</h2>
<p>Handbrake server wants to be a server version of the popular <a href="http://handbrake.fr/" target="_blank">Handbrake</a> application for video conversion. It allows to read video files from shares or uploaded files and converts these files to itunes compatible formats for you to enjoy.</p>
<h2>But why?</h2>
<p>Because there is a need for this. Why burden your pc when you got a home server running that can do the job for you? Just choose the movie you want to convert and the server will let you know when the conversion is complete. Also, this is where speed comes looking around the corner. Install this on a blade server and it flies m4v&#8217;s!</p>
<h2>What technology will you use?</h2>
<p>I&#8217;m thinking of using a basic apache2 server with php5. Some bash scripts and maybe some cgi coding to replace the bash scripts. I will use the cli version of <a href="http://handbrake.fr/" target="_blank">HandBrake</a>.</p>
<h2>hey, I&#8217;ve got an idea!</h2>
<p>tell me! (comments or mail)</p>
<h2>Hey, I&#8217;m a pro in &#8230; Do you need help?</h2>
<p>YES! Help is always welcome. If this project kicks off really well, I&#8217;ll put up a mailing list etc etc</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2011/02/18/handbrake-server-development/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The Ultimate Terminator config</title>
		<link>http://blog.subutux.be/2011/02/15/the-ultimate-terminator-config/</link>
		<comments>http://blog.subutux.be/2011/02/15/the-ultimate-terminator-config/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 10:44:15 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[cli]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=318</guid>
		<description><![CDATA[I&#8217;d just thought I&#8217;ll post my Terminator config here for others to enjoy. Just save it as ~/.config/terminator/config. but take a look first in the config to get to know the keyboard shortcuts.]]></description>
			<content:encoded><![CDATA[
<p><span id="more-318"></span>I&#8217;d just thought I&#8217;ll post my Terminator config here for others to enjoy. Just save it as ~/.config/terminator/config.<br />
but take a look first in the config to get to know the keyboard shortcuts.</p>
<pre class="brush: plain; light: false; title: ; notranslate">
[global_config]
[keybindings]
  toggle_zoom = &lt;Ctrl&gt;&lt;Alt&gt;Z
  split_vert = &lt;Ctrl&gt;&lt;Alt&gt;V
  split_horiz = &lt;Ctrl&gt;&lt;Alt&gt;H
[profiles]
  [[default]]
    use_system_font = False
    background_darkness = 0.82
    background_type = transparent
    scrollbar_position = hidden
    foreground_color = &quot;#00ff00&quot;
    icon_bell = False
    font = Monospace 9
    scrollback_infinite = True
[layouts]
  [[default]]
    [[[child1]]]
      type = Terminal
      parent = window0
    [[[window0]]]
      type = Window
      parent = &quot;&quot;
[plugins]
</pre>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2011/02/15/the-ultimate-terminator-config/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>install proftpd with web ui on ubuntu 10.04</title>
		<link>http://blog.subutux.be/2011/01/18/install-proftpd-with-web-ui-on-ubuntu-10-04/</link>
		<comments>http://blog.subutux.be/2011/01/18/install-proftpd-with-web-ui-on-ubuntu-10-04/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 10:52:26 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[cli]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[httpauth]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[proftftp]]></category>
		<category><![CDATA[proftpd administrator]]></category>
		<category><![CDATA[quota]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[ubuntu 10.04]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=281</guid>
		<description><![CDATA[Last night I was searching around for a good ftp server with good access control,quota support and logging and stumbled upon ProFTPD. ProFTPD is a advanced ftp server that is extendible with modules and the config is pretty straight  forward (markup us equal to that from apache.conf). I also found a good web ui for [...]]]></description>
			<content:encoded><![CDATA[
<p>Last night I was searching around for a good ftp server with good access control,quota support and logging and stumbled upon ProFTPD.</p>
<p>ProFTPD is a advanced ftp server that is extendible with modules and the config is pretty straight  forward (markup us equal to that from apache.conf). I also found a good web ui for ProFTPd with mysql logging,quota support, user management, group management, system resources, etc. named <a href="http://proftpd-adm.sourceforge.net/" target="_blank">ProFTPd Administrator</a>.</p>
<p>Because setting this up was a slight pain in the ass, here&#8217;s an howto for the ubuntu folks !<span id="more-281"></span></p>
<h2>Step 1: preparation</h2>
<p>make sure all the needed packages are installed:</p>
<p style="font-family: courier;">sudo apt-get install apache2 php5 mysql-server mysql-client proftpd proftpd-mysql phpmyadmin</p>
<ul>
<li>Choose a password for the root account in mysql and write it down somewhere (or remember it, even better!).<em><br />
quick tip: for easly &#8216;rememberable&#8217; passwords, use <a href="apt://pwgen">pwgen</a>. Pwgen generates hard to guess, but easy to remember passwords.</em></li>
</ul>
<ul>
<li>For phpmyadmin, choose apache2 configuration.</li>
</ul>
<p>Go to your www-root and download proftpd-adm:</p>
<p style="font-family: courier;">cd /var/www/<br />
wget http://sourceforge.net/projects/proftpd-adm/files/proFTPd%20Administrator/proFTPd%20Administrator%20v1.2/proftpd_admin_v1.2.tar.gz/<br />
tar vxzf proftpd_admin_v1.2.tar.gz<br />
mv proftpd_admin_v1.2 ftp</p>
<h2>Step 2: Installing the mysql user and table</h2>
<p>Go to /var/www/ftp/misc and edit the database file.</p>
<pre>cd /var/www/ftp/misc/database_structure_mysql
vi (or your favorite text editor) db_structure.sql</pre>
<p>and change the last lines as followed:</p>
<p style="font-family: courier;">GRANT ALL ON <span style="text-decoration: line-through;">usertable</span> <strong>proftpd_admin.*</strong> TO proftpd@localhost IDENTIFIED BY &#8216;<em><strong>SomePass</strong></em>&#8216;;<br />
<span style="text-decoration: line-through;">GRANT ALL ON grouptable TO proftpd@localhost IDENTIFIED BY &#8216;&lt;database_password&gt;&#8217;;<br />
GRANT ALL ON xfer_stat TO proftpd@localhost IDENTIFIED BY &#8216;&lt;database_password&gt;&#8217;;</span></p>
<p>Changes are displayed in bold, changes that needs your specific input are displayed in bold italic.<br />
Things that needs to be deleted are striketrough.</p>
<p>Now we need to create the database and fill it with the tables, like this.</p>
<p style="font-family: courier;">mysql -u root -p &lt; db_structure.sql</p>
<p>Test this by executing the following (you will be prompted for the proftpd password you changed above):</p>
<p style="font-family: courier;">mysql -u proftpd -p proftpd_admin<br />
mysql&gt; show tables;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Tables_in_proftpd_admin |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| ftpquotalimits          |<br />
| ftpquotatallies         |<br />
| grouptable              |<br />
| usertable               |<br />
| xfer_stat               |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
5 rows in set (0.00 sec)</p>
<h2>Step 3: configuring proFTPd</h2>
<p>make the ftp dirs and correct the rights:</p>
<p style="font-family: courier;">mkdir /ftp<br />
chown nobody:nogroup /ftp<br />
chmod 0660 /ftp<br />
mkdir /ftp/incoming<br />
chown nobody:nogroup /ftp/incoming<br />
chmod 0660 /ftp/incoming</p>
<p>Save the default config under another name:</p>
<p style="font-family: courier;">cd /etc/proftpd<br />
mv proftpd.conf proftpd.conf.default</p>
<p>and copy the one from the proFTPd Administrator package &amp; edit:</p>
<pre>cp /var/www/ftp/misc/sample_config/proftpd_quota.conf proftpd.conf
vi proftpd.conf</pre>
<p>As above, changes are displayed in bold, changes that needs your specific input are displayed in bold italic.<br />
Things that needs to be deleted are strikethrough.</p>
<p style="font-family: courier;">ServerName                      &#8220;<em><strong>Server</strong></em>&#8221;<br />
ServerType                      standalone<br />
ServerIdent                     on              &#8220;<em><strong>Server</strong></em>&#8221;<br />
DeferWelcome                    on<br />
DefaultServer                   on<br />
DisplayLogin                    .welcome        # Textfile to display on login<br />
DisplayConnect                  .connect        # Textfile to display on connection<br />
DisplayFirstChdir               .firstchdir     # Textfile to display on first changedir</p>
<p style="font-family: courier;">UseReverseDNS                   off<br />
IdentLookups                    off</p>
<p style="font-family: courier;">Port                            21<br />
Umask                           022<br />
MaxInstances                    15<br />
MaxClientsPerHost               3               &#8220;Only %m connections per host allowed&#8221;<br />
MaxClients                      10              &#8220;Only %m total simultanious logins allowed&#8221;<br />
MaxHostsPerUser                 1<br />
<strong>Include                         /etc/proftpd/modules.conf</strong><br />
User                            nobody<br />
Group                           <span style="text-decoration: line-through;">nobody</span><strong>nogroup</strong><br />
[...]<br />
# Set up authentication via SQL<br />
# ===========<br />
AuthOrder                       mod_sql.c<br />
SQLAuthTypes                    Backend<br />
SQLConnectInfo                  proftpd_admin@localhost proftpd <em><strong>SomePass</strong></em><br />
SQLUserInfo                     usertable userid passwd uid gid homedir shell<br />
SQLGroupInfo                    grouptable groupname gid members<br />
SQLUserWhereClause              &#8220;disabled=0 and (NOW()&lt;=expiration or expiration=-1 or expiration=0)&#8221;<br />
[...]</p>
<p>ProFTPd Should be configured right now with quota support &amp; authentication via a mysql back end.</p>
<p>try to start the service:</p>
<pre>service proftpd restart</pre>
<p>If it returns ok, you win! Else, post the errors you&#8217;ve got in the comments below.</p>
<h2>Step 4: Securing ProFTPd Administrator</h2>
<p>Security first! Whe are going to secure our /ftp webdirectory with use of apaches build in httpauth.</p>
<p>edit the default site:</p>
<p style="font-family: courier;">vi /etc/apache2/sites-available/default</p>
<p>Again, changes are displayed in bold, changes that needs your specific input are displayed in bold italic.<br />
Things that needs to be deleted are strikethrough.</p>
<p style="font-family: courier;">&lt;VirtualHost *:80&gt;<br />
ServerAdmin webmaster@localhost</p>
<p style="font-family: courier;">DocumentRoot /var/www<br />
&lt;Directory /&gt;<br />
Options FollowSymLinks<br />
AllowOverride None<br />
&lt;/Directory&gt;<br />
&lt;Directory /var/www/&gt;<br />
Options Indexes FollowSymLinks MultiViews<br />
AllowOverride <span style="text-decoration: line-through;">None</span><strong>All</strong><br />
Order allow,deny<br />
allow from all<br />
&lt;/Directory&gt;<br />
[...]</p>
<p>Now we create the .htpasswd file. For maximum security, I place this in my apache /etc/ dir</p>
<p style="font-family: courier;">htpasswd -c /etc/apache2/.htpasswd root</p>
<p>Enter your password as you wish.</p>
<p>Go to /var/www/ftp/ and create the .htaccess file</p>
<p style="font-family: courier;">cd /var/www/ftp/<br />
vi .htaccess</p>
<p>AuthType Basic<br />
AuthName &#8220;Restricted Area&#8221;<br />
AuthUserFile /etc/apache2/.htpasswd<br />
Require user root</p>
<p>Now restart apache2 to apply your changes;</p>
<p style="font-family: courier;">service apache2 restart</p>
<h2>Step 6: Make a little change to ProFTPd Administrator code</h2>
<p>edit the class_system.php file on line 196 to fix the module problem:</p>
<p style="font-family: courier;"><strong>#</strong>exec($GLOBALS['config_path_to_proftpd'] . &#8216; -l&#8217;, $modules);<br />
<strong>#Fix for ubuntu<br />
exec(&#8220;cat /etc/proftpd/modules.conf | egrep -v \&#8221;^#\&#8221; | egrep -v \&#8221;^ModuleControlsACLs\&#8221; | sed &#8216;s/LoadModule //g&#8217; | egrep -v \&#8221;^ModulePath\&#8221;",$modules);</strong></p>
<h2>Step 7: Configuring ProFTPd Administrator</h2>
<p>make sure <strong>configuration.xml </strong>is writable to apache:</p>
<p style="font-family: courier;">chown www-data:www-data /var/www/ftp/configuration.xml</p>
<p>in your webbrowser, go to [ip-server]/ftp/configure.php<br />
login with your credetials as mentioned above.</p>
<h3>Database</h3>
<p>Enter the information as followed:</p>
<ul>
<li>username: proftpd</li>
<li>password: <em><strong>SomePass</strong></em></li>
<li>Hostname: localhost</li>
<li>Database: proftpd_admin</li>
<li>Database server : mysql</li>
<li>Subtype: Standard</li>
</ul>
<h3>ProFTPd</h3>
<p>Enter the information as followed:</p>
<ul>
<li>FTP root: /ftp</li>
<li>Default home directory: /ftp</li>
<li>Create user command: <em>empty</em></li>
<li>Delete user command: /bin/bash /var/www/ftp/misc/user_script/delete_user.sh</li>
<li>Default shell: # /etc/shells: valid login shells</li>
</ul>
<h3>Filepaths</h3>
<p>Enter the information as followed:</p>
<ul>
<li>who: /usr/bin/who</li>
<li>df: /bin/df</li>
<li>ps: /bin/ps</li>
<li>sysctl: /sbin/sysctl</li>
<li>ftpwho: /usr/bin/ftpwho</li>
<li>Kernel configuration file: /boot/config-2.6.32-25-generic <em>(check in your /boot the latest config file)</em></li>
<li>proftpd: /usr/sbin/proftpd</li>
</ul>
<h3>Extentions</h3>
<ul>
<li>Quota: enabled<br />
(<em>if you can&#8217;t select enabled, check if you entered the above hack correct and include /etc/proftpd/modules.conf is present in your /etc/proftpd/proftpd.conf file</em>.)</li>
</ul>
<h2>Step 9: Success!</h2>
<p>Done! try to create a user in <strong>Users &gt; Create User</strong> and try to login. Set some quotas, etc. Play with it and get to know the interface!</p>
<p>If you&#8217;re stuck somewhere, leeave a comment and I&#8217;ll try to help you out.</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2011/01/18/install-proftpd-with-web-ui-on-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ney year, new projects!</title>
		<link>http://blog.subutux.be/2011/01/03/ney-year-new-projects/</link>
		<comments>http://blog.subutux.be/2011/01/03/ney-year-new-projects/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 11:06:10 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=277</guid>
		<description><![CDATA[First of all, Happy freakin&#8217; new year! I hope that 2011 as some awesome suprises for you,a good health, and other stuff you&#8217;re wishing for Second, For this new year i&#8217;ve got some new years resolutions I would like to talk about. Projects,projects,projects After all, this is a coding blog I&#8217;ve got some projects &#8220;running&#8221; [...]]]></description>
			<content:encoded><![CDATA[
<p>First of all, Happy freakin&#8217; new year!<br />
I hope that 2011 as some awesome suprises for you,a good health, and other stuff you&#8217;re wishing for <img src='http://blog.subutux.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Second, For this new year i&#8217;ve got some new years resolutions I would like to talk about.<span id="more-277"></span></p>
<h4>Projects,projects,projects</h4>
<p>After all, this is a coding blog <img src='http://blog.subutux.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I&#8217;ve got some projects &#8220;running&#8221; that are never/allmost worked out or stalled that i like to finnish.</p>
<h5>Copycat</h5>
<p>For those who&#8217;ve got the dev url and experimented with our latest build, i&#8217;m pleased to announce that the dev build will be the last build. All things are in place (and working) so I&#8217;m proud to say, <strong>Copycat is finnished!</strong> The new version will be pushed to you when i activate the new build. More on that later on.</p>
<h5>handbrake-server</h5>
<p>Yes, i&#8217;m building a handbrake server! thanks to a friend of my (stephsd3) i&#8217;ve now access to a cloud based enviroment build on some blade servers, perfectly for converting movies rapidly &amp; pure testing. I&#8217;ve started to work things out, designing the freakin&#8217; thing, background coding and it looks good! There will be a server and a client based app. The client, coded in Adobe AIR, will upload your movie, allows you to alter the convertion setttings, covert the movie and notifies you when it&#8217;s done. A lot of coding needs to be done so, this could take a while. (especially on the server side).</p>
<h4>Cli tools &amp; commands &amp; shell scripts</h4>
<p>Yep, I will keep posting some command line tools etc. for you to hack on/use.</p>
<h4>Reviews</h4>
<p>Oh yes! There will be reviews of apps/plugins/scripts/code/methods/&#8230; this year.</p>
<p>So this is what i&#8217;m up to for this year. The only difference from last year is that i&#8217;ll try more to finnish my running projects/ideas.</p>
<p>Happy 2011!</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2011/01/03/ney-year-new-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly obtain your public IP</title>
		<link>http://blog.subutux.be/2010/11/29/quickly-obtain-your-public-ip/</link>
		<comments>http://blog.subutux.be/2010/11/29/quickly-obtain-your-public-ip/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 13:47:12 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[cli]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[dyndns]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[public ip]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=268</guid>
		<description><![CDATA[Whenever I&#8217;m at a customer for work, I sometimes need to know the public ip. I always went with a browser to checkip.dyndns.org to get the current public ip of the customer. lauching the browser, typing in the website url.. takes time. I always have my terminal window open, so I tought, can&#8217;t we script [...]]]></description>
			<content:encoded><![CDATA[
<p>Whenever I&#8217;m at a customer for work, I sometimes need to know the public ip. I always went with a browser to checkip.dyndns.org to get the current public ip of the customer. lauching the browser, typing in the website url.. takes time. I always have my terminal window open, so I tought, can&#8217;t we script this? Yes we can: <span id="more-268"></span></p>
<pre class="brush: php">#!/bin/bash
publicip_=`curl -s --connect-timeout 3 checkip.dyndns.org | sed 's/[^0-9\.]//g'`
echo $publicip_
</pre>
<p>
save it as publicip under /usr/local/sbin/ and execute chmod +x /usr/local/sbin/publicip . whenever you need the public ip, just run &#8220;publicip&#8221; from the terminal and it shouts out your current public ip.
</p>
<p>
you&#8217;re welcome.</p>
<p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2010/11/29/quickly-obtain-your-public-ip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing IsoHunt Mobile, a PoC [Update2]</title>
		<link>http://blog.subutux.be/2010/11/15/introducing-isohunt-mobile-a-poc/</link>
		<comments>http://blog.subutux.be/2010/11/15/introducing-isohunt-mobile-a-poc/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 17:37:05 +0000</pubDate>
		<dc:creator>subutux</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[isohunt]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquerymobile]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.subutux.be/?p=265</guid>
		<description><![CDATA[Whenever I need do download a torrent, I go to isohunt. Isohunt is a torrent site that catalogs a wide range of torrent sites all in one place. And they have a public API. Also, I&#8217;ve always wanted to test out jQuery Mobile, It&#8217;s a universal theming/javascript platform/class that works with a wide range of [...]]]></description>
			<content:encoded><![CDATA[
<p>Whenever I need do download a torrent, I go to <a title="isoHunt" href="http://www.isohunt..com" target="_blank">isohunt</a>. Isohunt is a torrent site that catalogs a wide range of torrent sites all in one place. And they have a public API. Also, I&#8217;ve always wanted to test out <a title="Jquery Mobile" href="http://www.jquerymobile.com" target="_blank">jQuery Mobile</a>, It&#8217;s a universal theming/javascript platform/class <strong>that works with a wide range of mobile devices out of the box! (android,iPhone,blackberry,&#8230;)</strong>. Here was my chance to make somthing usefull. I started coding a simple mobile interface for Isohunt. A searchbar. Results where fetched via the public API (json whohoow!) and drawed in a nice list layout. Then I tought, hey, let&#8217;s combine this with <a title="Transmission" href="http://www.transmissionbt.com" target="_blank">transmission</a> ! It also has a public API (also json, Double Wohoow!) so after 4 hours of coding, I&#8217;ve got my PoC (Proof of Concept).</p>
<p>It works. Test it out!</p>
<p><a title="isoHunt Mobile" href="http://ihm.subutux.be" target="_blank">http://ihm.subutux.be</a> (open in this browser, or your mobile device)</p>
<p>Don&#8217;t forget to configure your transmission settings (Saved in local cookies, no data is kept on my server)</p>
<p>Leave a comment and lemme know what you think!</p>
<p><strong>Update: </strong>Apparently isohunt has blocked me from their api <img src='http://blog.subutux.be/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Not cool dudes, NOT COOL!</p>
<p><strong>Update2: </strong>Apparently isohunt changed there API and uses a header redirect now. Fixed it!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

]]></content:encoded>
			<wfw:commentRss>http://blog.subutux.be/2010/11/15/introducing-isohunt-mobile-a-poc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

