<?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>Alex Ballas</title>
	<atom:link href="https://www.alex.ballas.org/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.alex.ballas.org</link>
	<description>Blog about anything :)</description>
	<lastBuildDate>Sat, 11 Feb 2017 18:59:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.2.11</generator>
	<item>
		<title>Slowly dockerizing my WP site &#8211; HTTP server &#8220;in a box&#8221;</title>
		<link>https://www.alex.ballas.org/2017/02/11/slowly-dockerizing-my-wp-site-part-1/</link>
				<comments>https://www.alex.ballas.org/2017/02/11/slowly-dockerizing-my-wp-site-part-1/#respond</comments>
				<pubDate>Sat, 11 Feb 2017 18:58:39 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=524</guid>
				<description><![CDATA[So after 4 years of using a bare-metal dedicated server where I would manually configure every single thing, I decided that it was time to move on. I was paying more than I was using and a potential migration to a new server would take hours / days to configure again. Just before I pull &#8230; <a href="https://www.alex.ballas.org/2017/02/11/slowly-dockerizing-my-wp-site-part-1/" class="more-link">Continue reading <span class="screen-reader-text">Slowly dockerizing my WP site &#8211; HTTP server &#8220;in a box&#8221;</span></a>]]></description>
								<content:encoded><![CDATA[<p>So after 4 years of using a bare-metal dedicated server where I would manually configure every single thing, I decided that it was time to move on. I was paying more than I was using and a potential migration to a new server would take hours / days to configure again.</p>
<p><span id="more-524"></span></p>
<p>Just before I pull the plug, I spinned an EC2 amazon instance and started thinking how I could make that work. I needed a way to have everything ready in minutes. So I went with docker. Docker would help me have the 3 main wordpress components packaged and configured in no time. The DB (just MySQL), the files and the HTTP server. I also needed a way to deploy things fast. Should I go with Ansible? Should I go with Terraform? I didn&#8217;t need a configuration management tool, I needed an orchestration tool but at the same time I didn&#8217;t want to over complicate things.</p>
<p>I understand that the Internet is full of HOW-to guides on how to dockerize a WP site and how to use docker-compose for that job. There is even an official docker <a href="https://hub.docker.com/_/wordpress/" target="_blank">image</a> for wordpress. I needed something simple and modular.</p>
<p>I slowly started preparing a HTTP docker container that would respect my wordpress caching configurations and would also support SSL (Let&#8217;s encrypt). So I went with nginx. Nobody ever complained about nginx :). Nginx will serve the supercache generated static files much faster than apache. My wordpress configuration and file structure is pretty plain, so the Nginx docker container would have to be as generic as possible so that anyone can re-use it.</p>
<p>And here is it: <a href="https://github.com/alexballas/php-fpm-nginx-wp-super-cache-docker" target="_blank">https://github.com/alexballas/php-fpm-nginx-wp-super-cache-docker</a><br />
The repo name is bad, i know..</p>
<p>And a simple example:</p>
<pre><code>$ git clone https://github.com/alexballas/php-fpm-nginx-wp-super-cache-docker.git
$ cd php-fpm-nginx-wp-super-cache-docker
$ sudo docker build -t mynginx .
$ mkdir -p www
$ echo "This is a test HTML file" &gt; www/test.html
$ sudo docker run --name nginx -it -d -p 80:80 -p 443:443 -v `pwd`/www:/var/www/html mynginx
$ curl http://localhost/test.html
This is a test HTML file</code></pre>
<p>So the HTTP part is ready. The only issue I had with it so far, were the incorrect file permissions. This is a known docker issue when using volumes and the host machine UIDs don&#8217;t match the container&#8217;s UIDs.</p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2017/02/11/slowly-dockerizing-my-wp-site-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Stream any local video file to a UPnP/DLNA MediaRenderer</title>
		<link>https://www.alex.ballas.org/2016/08/09/stream-any-local-video-file-to-a-upnpdlna-mediarenderer/</link>
				<comments>https://www.alex.ballas.org/2016/08/09/stream-any-local-video-file-to-a-upnpdlna-mediarenderer/#respond</comments>
				<pubDate>Tue, 09 Aug 2016 16:28:45 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[streaming]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=497</guid>
				<description><![CDATA[A node script to stream local video files to UPnP/DLNA media renderers like smart TVs, Chromecast, BubbleUPnP (Android) or Kodi boxes. https://github.com/alexballas/stream2tv]]></description>
								<content:encoded><![CDATA[<p>A node script to stream local video files to UPnP/DLNA media renderers like smart TVs, Chromecast, BubbleUPnP (Android) or Kodi boxes.</p>
<p><a href="https://github.com/alexballas/stream2tv" target="_blank">https://github.com/alexballas/stream2tv</a></p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2016/08/09/stream-any-local-video-file-to-a-upnpdlna-mediarenderer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Redirecting all your traffic though ssh for the lazy (1 copy paste) &#8211; Debian / Ubuntu</title>
		<link>https://www.alex.ballas.org/2014/10/12/redirecting-all-your-traffic-though-ssh-for-the-lazy-1-copy-paste-debian-ubuntu/</link>
				<comments>https://www.alex.ballas.org/2014/10/12/redirecting-all-your-traffic-though-ssh-for-the-lazy-1-copy-paste-debian-ubuntu/#respond</comments>
				<pubDate>Sun, 12 Oct 2014 11:17:54 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[redsocks]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=477</guid>
				<description><![CDATA[As root, copy paste the following to your terminal: apt-get -q -y install git $(apt-cache search libevent &#124; grep ^libevent-dev &#124; sort &#124; head -n1 &#124; awk '{print $1}') git clone http://github.com/darkk/redsocks.git cd redsocks/ make echo 'base{log_debug = on; log_info = on; log = "file:/tmp/reddi.log"; daemon = on; redirector = iptables;} redsocks { local_ip = &#8230; <a href="https://www.alex.ballas.org/2014/10/12/redirecting-all-your-traffic-though-ssh-for-the-lazy-1-copy-paste-debian-ubuntu/" class="more-link">Continue reading <span class="screen-reader-text">Redirecting all your traffic though ssh for the lazy (1 copy paste) &#8211; Debian / Ubuntu</span></a>]]></description>
								<content:encoded><![CDATA[<p>As root, copy paste the following to your terminal:</p>
<p><span id="more-477"></span></p>
<pre><code>apt-get -q -y install git $(apt-cache search libevent | grep ^libevent-dev | sort | head -n1 | awk '{print $1}')
git clone http://github.com/darkk/redsocks.git
cd redsocks/
make
echo 'base{log_debug = on; log_info = on; log = "file:/tmp/reddi.log";
daemon = on; redirector = iptables;}
redsocks { local_ip = 127.0.0.1; local_port = 60001; ip = 127.0.0.1;
port = 60002; type = socks5; }' &gt; redsocks.conf
./redsocks -c redsocks.conf
iptables -t nat -N REDSOCKS
iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 60001
iptables -t nat -A OUTPUT -p tcp -j REDSOCKS
echo -n "Enter Your Username: ";read myusername;echo -n "Enter Your SSH server hostname/IP: ";read sshhostname; ssh $myusername@$sshhostname -N -D 60002

</code></pre>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2014/10/12/redirecting-all-your-traffic-though-ssh-for-the-lazy-1-copy-paste-debian-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Dump a linux process&#8217;s memory to file &#8211; Server Fault</title>
		<link>https://www.alex.ballas.org/2014/09/12/dump-a-linux-processs-memory-to-file-server-fault/</link>
				<comments>https://www.alex.ballas.org/2014/09/12/dump-a-linux-processs-memory-to-file-server-fault/#respond</comments>
				<pubDate>Thu, 11 Sep 2014 22:02:41 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=475</guid>
				<description><![CDATA[Dump a linux process&#8217;s memory to file &#8211; Server Fault.]]></description>
								<content:encoded><![CDATA[<p><a href="http://serverfault.com/questions/173999/dump-a-linux-processs-memory-to-file">Dump a linux process&#8217;s memory to file &#8211; Server Fault</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2014/09/12/dump-a-linux-processs-memory-to-file-server-fault/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>algorithm &#8211; Explaining computational complexity theory &#8211; Stack Overflow</title>
		<link>https://www.alex.ballas.org/2013/07/04/algorithm-explaining-computational-complexity-theory-stack-overflow/</link>
				<comments>https://www.alex.ballas.org/2013/07/04/algorithm-explaining-computational-complexity-theory-stack-overflow/#respond</comments>
				<pubDate>Thu, 04 Jul 2013 10:15:56 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[complexity theory]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=456</guid>
				<description><![CDATA[algorithm &#8211; Explaining computational complexity theory &#8211; Stack Overflow.]]></description>
								<content:encoded><![CDATA[<p><a href="http://stackoverflow.com/questions/308213/explaining-computational-complexity-theory#309507">algorithm &#8211; Explaining computational complexity theory &#8211; Stack Overflow</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2013/07/04/algorithm-explaining-computational-complexity-theory-stack-overflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Using Flume to Collect Apache 2 Web Server Logs &#124; Apache Hadoop for the Enterprise &#124; Cloudera</title>
		<link>https://www.alex.ballas.org/2013/07/02/using-flume-to-collect-apache-2-web-server-logs-apache-hadoop-for-the-enterprise-cloudera/</link>
				<comments>https://www.alex.ballas.org/2013/07/02/using-flume-to-collect-apache-2-web-server-logs-apache-hadoop-for-the-enterprise-cloudera/#respond</comments>
				<pubDate>Tue, 02 Jul 2013 17:43:40 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[flume]]></category>
		<category><![CDATA[hadoop]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=455</guid>
				<description><![CDATA[Using Flume to Collect Apache 2 Web Server Logs &#124; Apache Hadoop for the Enterprise &#124; Cloudera.]]></description>
								<content:encoded><![CDATA[<p><a href="http://blog.cloudera.com/blog/2010/09/using-flume-to-collect-apache-2-web-server-logs/">Using Flume to Collect Apache 2 Web Server Logs | Apache Hadoop for the Enterprise | Cloudera</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2013/07/02/using-flume-to-collect-apache-2-web-server-logs-apache-hadoop-for-the-enterprise-cloudera/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Flume Cookbook</title>
		<link>https://www.alex.ballas.org/2013/07/02/flume-cookbook/</link>
				<comments>https://www.alex.ballas.org/2013/07/02/flume-cookbook/#respond</comments>
				<pubDate>Tue, 02 Jul 2013 17:42:47 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[flume]]></category>
		<category><![CDATA[hadoop]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=454</guid>
				<description><![CDATA[Flume Cookbook.]]></description>
								<content:encoded><![CDATA[<p><a href="http://archive.cloudera.com/cdh/3/flume-0.9.1+1/Cookbook.html">Flume Cookbook</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2013/07/02/flume-cookbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Quick file upload to HDFS</title>
		<link>https://www.alex.ballas.org/2013/06/27/quick-file-upload-to-hdfs/</link>
				<comments>https://www.alex.ballas.org/2013/06/27/quick-file-upload-to-hdfs/#respond</comments>
				<pubDate>Thu, 27 Jun 2013 09:32:18 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[coffee]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[hdfs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell scripts]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=450</guid>
				<description><![CDATA[{ pv -bfp FILE 2&#62;&#38;3 &#124; ssh HDFS_USER@REMOTE_HOST "hadoop dfs -put - /path/to/hdfs/FILE" 2&#62; /dev/null ;} 3&#62;&#38;1 &#124; tr '\015' '\012' Example: $ touch file.txt $ { pv -bfp file.txt 2&#62;&#38;3 &#124; ssh hdfs@ff1 "hadoop dfs -put - /user/admin/file.txt" 2&#62; /dev/null ;} 3&#62;&#38;1 &#124; tr '\015' '\012']]></description>
								<content:encoded><![CDATA[<pre><code>{ pv -bfp <strong>FILE</strong> 2&gt;&amp;3 | ssh <strong>HDFS_USER</strong>@<strong>REMOTE_HOST</strong> "hadoop dfs -put - <strong>/path/to/hdfs/FILE</strong>" 2&gt; /dev/null ;} 3&gt;&amp;1 | tr '\015' '\012'</code></pre>
<p><span id="more-450"></span>Example:</p>
<pre><code>
$ touch file.txt
$ { pv -bfp file.txt 2&gt;&amp;3 | ssh hdfs@ff1 "hadoop dfs -put - /user/admin/file.txt" 2&gt; /dev/null ;} 3&gt;&amp;1 | tr '\015' '\012'</code></pre>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2013/06/27/quick-file-upload-to-hdfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Pearson&#8217;s chi squared test</title>
		<link>https://www.alex.ballas.org/2013/05/31/httpen-wikipedia-orgwikipearsons_chi-squared_test/</link>
				<comments>https://www.alex.ballas.org/2013/05/31/httpen-wikipedia-orgwikipearsons_chi-squared_test/#respond</comments>
				<pubDate>Fri, 31 May 2013 14:26:22 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Chilling Out]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=418</guid>
				<description><![CDATA[http://en.wikipedia.org/wiki/Pearson&#8217;s_chi-squared_test]]></description>
								<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Pearson's_chi-squared_test">http://en.wikipedia.org/wiki/Pearson&#8217;s_chi-squared_test</a></p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2013/05/31/httpen-wikipedia-orgwikipearsons_chi-squared_test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Keeping track of maximum connected listeners on Icecast2 with node.js</title>
		<link>https://www.alex.ballas.org/2013/03/10/keep-track-of-maximum-connected-listeners-on-icecast-with-node-js/</link>
				<comments>https://www.alex.ballas.org/2013/03/10/keep-track-of-maximum-connected-listeners-on-icecast-with-node-js/#respond</comments>
				<pubDate>Sat, 09 Mar 2013 23:01:03 +0000</pubDate>
		<dc:creator><![CDATA[AlexB]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[icecast]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://www.alex.ballas.org/?p=367</guid>
				<description><![CDATA[I wrote a small node.js reverse proxy for icecast2 , which keeps track of maximum connected listeners. Step1: Make sure you have node.js installed on your machine Step 2: Install all the extra modules needed for the proxy user:~$ npm install http-proxy user:~$ npm install moment Step 3: Save the following code to a file (icecast_proxy.js) and &#8230; <a href="https://www.alex.ballas.org/2013/03/10/keep-track-of-maximum-connected-listeners-on-icecast-with-node-js/" class="more-link">Continue reading <span class="screen-reader-text">Keeping track of maximum connected listeners on Icecast2 with node.js</span></a>]]></description>
								<content:encoded><![CDATA[<p>I wrote a small node.js reverse proxy for icecast2 , which keeps track of maximum connected listeners.</p>
<p><span id="more-367"></span></p>
<p><strong>Step1:</strong><br />
Make sure you have node.js installed on your machine</p>
<p><strong>Step 2:</strong><br />
Install all the extra modules needed for the proxy<br />
<code>user:~$ npm install http-proxy<br />
user:~$ npm install moment</code></p>
<p><strong>Step 3:</strong><br />
Save the following code to a file (icecast_proxy.js) and change the following values:<br />
<code>ICECAST_HOST<br />
ICECAST_PORT<br />
PROXY_PORT</code></p>
<pre>var httpProxy = require('http-proxy');
var fs = require('fs');
var moment = require('moment');

var count = 0;
var maxcount = 0;
var exists = fs.existsSync("icecast_stats.json");
if (exists) {
    data = fs.readFileSync("icecast_stats.json", 'utf8');
    var datafromfile = JSON.parse(data);
    maxcount = datafromfile.listeners;
} else {
    var filedata = {
        listeners: 0,
        date: moment().format('LLLL')
    }
    fs.writeFileSync("icecast_stats.json", JSON.stringify(filedata));
}
var server = httpProxy.createServer(function (req, res, proxy) {
    proxy.proxyRequest(req, res, {
        host: 'ICECAST_HOST',
        port: ICECAST_PORT,
    });
}).listen(PROXY_PORT);

server.proxy.on('proxyError', function (err, req, res) {
    count = 0;
    res.end();
});

server.proxy.on("start", function () {
    count += 1;
    if (count &gt; maxcount) {
        maxcount = count;
        var filedata = {
            listeners: count,
            date: moment().format('LLLL')
        }
        fs.writeFile("icecast_stats.json", JSON.stringify(filedata), function (err) {
            if (err) {
                console.log(err);
            }
        });
    }
    console.log(count);
});

server.proxy.on("end", function () {
    count -= 1;
    console.log(count);
});</pre>
<p>&nbsp;</p>
<p><strong>Step 4:</strong><br />
Run the file with node.js<br />
<code>user:~$ node icecast_proxy.js</code></p>
<p><span style="text-decoration: underline;"><strong>EXAMPLE</strong></span><br />
Lets say we have an icecast server, with host: <strong>host1.example.com</strong> , port <strong>8000</strong> and mount point <strong>live.mp3<br />
</strong>From here, we have to choose whether we want to run this proxy on the same server, or on a seperate one. If we choose to run it on the same server, he have to define a second port for our proxy to run on, other than 8000. Our proxy&#8217;s host will also be host1.example.com. If we choose to run it on a seperate server with with host: <strong>host2.example.com</strong>, we can still use port 8000 for the proxy. I&#8217;ll just go with the first example, where we run it from the same machine.<br />
We set:</p>
<p><code>ICECAST_HOST -&gt; host1.example.com<br />
ICECAST_PORT -&gt; 8000<br />
PROXY_PORT -&gt; 8001<br />
</code><br />
and run it. Now our listeners can connect to <strong>http://host1.example.com:8001/live.mp3</strong><br />
The maximum listeners number is saved to a file called <strong>icecast_stats.json</strong> which is on the same path with our proxy script.</p>
<p>icecast_stat.json can be accessed with any text editor.</p>
<p>&nbsp;</p>
]]></content:encoded>
							<wfw:commentRss>https://www.alex.ballas.org/2013/03/10/keep-track-of-maximum-connected-listeners-on-icecast-with-node-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
	</channel>
</rss>
