Hybrid Hackerhttps://hybridhacker.com/2023-01-24T08:33:41+01:00👾 Technical notes and hybrid geekeriesThe Hybrid Hacker Newsletter2023-01-24T08:33:41+01:002023-01-24T08:33:41+01:00Nicola Ballottatag:hybridhacker.com,2023-01-24:/the-hybrid-hacker-newsletter.html<p>I can hardly believe it's only been less than a month since my last post on this blog. To be honest, having <a href="https://chat.openai.com/">ChatGPT</a> proofreading my writing has made me more productive and helped me overcome my perfectionism. While I'm not always certain that its corrections are entirely accurate, it gives …</p><p>I can hardly believe it's only been less than a month since my last post on this blog. To be honest, having <a href="https://chat.openai.com/">ChatGPT</a> proofreading my writing has made me more productive and helped me overcome my perfectionism. While I'm not always certain that its corrections are entirely accurate, it gives me peace of mind and assists me in expressing concepts that would be difficult to convey in my native language.</p>
<p><img alt="The Hybrid Hacker Newsletter" class="img-fluid" src="https://hybridhacker.com/images/hybrid_hacker_newsletter.png"/>
Today I am thrilled to announce the launch of The Hybrid Hacker newsletter! This new format is a way for me to share my knowledge, experiences, and tips on a wide range of topics that I am interested in, with a wider audience.
As many of you know, I am not the most consistent blogger. When it comes to writing, I often feel blocked. However, with the launch of this newsletter, I am confident that I will be able to share my insights and expertise more frequently and in a more organized way.</p>
<p>What is the newsletter about? Of course, the Hybrid Hacker mindset, a <strong>diverse set of skills, ranging from technical expertise to creative thinking and building useful things</strong>. Mixing these skills allows people to approach challenges from multiple angles, making them highly adaptable and resourceful. A true Hybrid Hacker is always looking for new ways to improve and evolve, which makes them experts in different fields. They are the ultimate problem-solvers, always ready for any challenge that comes their way.</p>
<p>Currently, the newsletter format is not 100% defined and I'm still experimenting a lot. I'm interested in so many topics that defining a solid structure will be challenging. With that being said, main topics will include technology in general, everything related to my job (technical leadership, remote working, scaling teams, etc.), as well as practical projects. So whether you're a seasoned pro or just getting started in one of these fields, there's something for everyone in this newsletter.</p>
<p>To build the newsletter, I used <a href="https://substack.com">Substack</a>, which I found to be quite impressive. I will be sending out a <strong>new issue every Thursday</strong>. So if you want to stay up to date with all the topics mentioned above, sign up for The Hybrid Hacker newsletter]today! Just put your email address in the form below and you'll be all set.</p>
<iframe frameborder="0" height="320" scrolling="no" src="https://hybridhacker.email/embed" style="border:1px solid #EEE; background:white;" width="480"></iframe>NoHumansWrite: a GPT-3 operated blog2022-12-15T13:03:27+01:002022-12-15T13:03:27+01:00Nicola Ballottatag:hybridhacker.com,2022-12-15:/nohumanswrite-a-gpt-3-operated-blog.html<p>It's a bit embarrassing, but it has been almost two years since I last wrote in this blog. I'm honest, I have been trying to maintain a blog for more than 20 years, but I never succeeded. It went a bit better when I had an Italian blog. Writing in …</p><p>It's a bit embarrassing, but it has been almost two years since I last wrote in this blog. I'm honest, I have been trying to maintain a blog for more than 20 years, but I never succeeded. It went a bit better when I had an Italian blog. Writing in my mother tongue was quicker and I was way less paranoid about my perfectionism (I'm far from being a good English writer). With that being said, I probably found a good solution and I guess you already heard about it since it's on everyone's lips. Yeah, you got it right, it's called GPT-3.</p>
<p>I started experimenting with GPT-3 early this year, but then I stopped because I was too busy. In the last couple of weeks, after the release of GPT-3.5, I decided to play with it again. I was impressed, like probably the other 1 million users who joined in just five days. As I was playing with GPT-3, one of the first thoughts that came to mind was "what if I used GPT-3 to write on my blog?". But then I realized that it would be unfair to my audience. Ok, I'm busy and also a bit lazy when it comes to maintaining a blog, but that doesn't justify cheating. So I thought, what if I run a GPT-3 operated blog and let my audience know about it? And maybe even share the GPT-3 prompts I use to create posts? That's how <a href="https://nohumanswrite.com">NoHumansWrite</a> was born.</p>
<p class="center"><img alt="NoHumansWrite" class="img-fluid" src="https://hybridhacker.com/images/nohumanswrite_logo.png"/></p>
<p>As mentioned, NoHumansWrite is a simple blog (almost) entirely operated by AI. I use <a href="https://github.com/nicolaballotta/gtp3-wordpress-post-generator">gpt3-wordpress-post-generator</a>, a simple command-line interface (CLI) I wrote to interact with the GPT-3 API and WordPress. This CLI asks for a topic and then suggests a title. If you like it, then this title is used to automatically generate the post. Images are created using <a href="https://www.midjourney.com/">Midjourney</a> project and then manually embedded in the post. One more thing that I find useful to include, is the GPT-3 prompt used to generate the post.</p>
<p>Apart from feeling realized seeing a blog that finally gets quickly populated, the purposes of this experiment are multiple.</p>
<ul>
<li>One purpose is to understand how people will react to AI-generated content. Will they find it useful? The posts that are currently being generated are basic, but in my opinion, somehow interesting.</li>
<li>Another purpose is to analyze how/if Google and other search engines will index AI-generated content. Just imagine if everyone started using GPT-3 to write content and Google did nothing to mark that content as AI-generated.</li>
<li>Last but not least, the experiment aims to inspire people. As with Google, using the right keywords when you search for something is important, but not everyone is good at it. Being able to use the right keywords when you search for something is a valuable skill (that I always look for in people I hire).</li>
</ul>
<p>In conclusion, apart from NoHumansWrite, I am very excited for the times ahead. This is just the beginning of a big revolution. And no, I'm not talking about me running a blog, I'm talking about AI becoming more and more integrated into our lives 🙂</p>Retrieve Pagerduty on-call schedule with Python2020-02-27T18:22:45+01:002020-02-27T18:22:45+01:00Nicola Ballottatag:hybridhacker.com,2020-02-27:/get-pagerduty-on-call-schedule-with-python.html<p>When you are experiencing an incident, the first thing you need to know is who is on call in your team. With my team at Namecheap, obviously we got everything automated, so if something happens, our alerting system triggers <a href="https://www.pagerduty.com/">Pagerduty</a> who calls the on call designated person. But in such …</p><p>When you are experiencing an incident, the first thing you need to know is who is on call in your team. With my team at Namecheap, obviously we got everything automated, so if something happens, our alerting system triggers <a href="https://www.pagerduty.com/">Pagerduty</a> who calls the on call designated person. But in such cases, it's alwasy nice to determine quickly who's on call, at least to be sure the alert was acknowledged. </p>
<p>This is a very simple script I made to promptly know who's on call directly from Pagerduty APIs. </p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">requests</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="k">class</span> <span class="nc">PagerdutyClient</span><span class="p">:</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">pagerduty_token</span> <span class="o">=</span> <span class="n">token</span>
<span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">_url</span><span class="p">():</span>
<span class="k">return</span> <span class="s1">'https://api.pagerduty.com/'</span>
<span class="k">def</span> <span class="nf">call_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">resource_path</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'Accept'</span><span class="p">:</span> <span class="s1">'application/vnd.pagerduty+json;version=2'</span><span class="p">,</span>
<span class="s1">'Authorization'</span><span class="p">:</span> <span class="s1">'Token token=</span><span class="si">{token}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">token</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pagerduty_token</span><span class="p">)</span>
<span class="p">}</span>
<span class="n">url</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_url</span><span class="p">()</span> <span class="o">+</span> <span class="n">resource_path</span>
<span class="n">response_data</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">)</span>
<span class="k">return</span> <span class="n">json</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">response_data</span><span class="o">.</span><span class="n">text</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">get_oncall</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schedule_id</span><span class="p">):</span>
<span class="n">payload</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'schedule_ids[]'</span><span class="p">:</span> <span class="n">schedule_id</span>
<span class="p">}</span>
<span class="n">response</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">call_api</span><span class="p">(</span><span class="s1">'oncalls'</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">payload</span><span class="p">)</span>
<span class="n">on_call</span> <span class="o">=</span> <span class="n">response</span><span class="p">[</span><span class="s1">'oncalls'</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">'user'</span><span class="p">][</span><span class="s1">'summary'</span><span class="p">]</span>
<span class="k">return</span> <span class="n">on_call</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">'__main__'</span><span class="p">:</span>
<span class="n">pd</span> <span class="o">=</span> <span class="n">PagerdutyClient</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s1">'PD_TOKEN'</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="mi">80</span> <span class="o">*</span> <span class="s2">"-"</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">'The on call winner is: </span><span class="si">{}</span><span class="s1">'</span><span class="p">)</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">pd</span><span class="o">.</span><span class="n">get_oncall</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s1">'SCHEDULE'</span><span class="p">)))</span>
<span class="nb">print</span><span class="p">(</span><span class="mi">80</span> <span class="o">*</span> <span class="s2">"-"</span><span class="p">)</span>
</code></pre></div>
<p>You can find the source code and how to use it on <a href="https://github.com/nicolaballotta/pagerduty_oncall_schedule">Github</a>.</p>Anne Pro 2 and how I improved my typing skills2019-11-09T19:15:11+01:002019-11-09T19:15:11+01:00Nicola Ballottatag:hybridhacker.com,2019-11-09:/anne-pro-2-and-how-i-improved-my-typing-skills.html<p>One of my new year resolutions for 2019 was to write more on this blog and we will see in December if I achieved that. Another 2019 non-written resolution was to improve my typing skills. Unfortunately until some months ago I was just used to Italian keyboards, which (shame on …</p><p>One of my new year resolutions for 2019 was to write more on this blog and we will see in December if I achieved that. Another 2019 non-written resolution was to improve my typing skills. Unfortunately until some months ago I was just used to Italian keyboards, which (shame on me) is what I used for my entire life. In addition to that I had a completely wrong way of typing (just to make an example, I wasn't able to use pinkies). Despite that, my typing speed was 55wpm, which is decent if you consider the avarage speed is 40wpm.</p>
<p>As always when I decide to improve an area of knowledge, <strong>I tend to look every detail</strong>. Long story short, while improving my typing skills, I fell into mech keyboards world and I became really passionate with it. I started with a cheap 68% <a href="https://drop.com/buy/magicforce-68-key-mini-mechanical-keyboard">MagicForce</a> keyboard and immdiately after I bought an Anne Pro 2, a pretty cool 40% keyboard with a good quality-price ratio (I bought it for around 80€ from <a href="https://candykeys.com/product/anne-pro-2-gateron-black">CandyKeys</a>). </p>
<p class="center"><img alt="Anne Pro 2" class="img-fluid" src="https://hybridhacker.com/images/anne_pro_2.jpg"/></p>
<p>So basically not only I had to re-learn typing on a US keyboard, but also using a mech keyboard. I'm honest, first 15 days were a pain. I was barely able to hit 15wpm, with many errors. But after some time I was finally able to type again at a decent speed. Today, <strong>after 8 months, I can hit 67wpm</strong> which is the avg typing speed of a pro. How I achieved that?</p>
<p>Discipline and dedication. Especially in the first 15 days I had to dedicate a lot of time into reviewing my finger positions and try to use the right fingers on the right keys. Then it was all practice, practice and practice. I used these websites and they were really useful: </p>
<ul>
<li><a href="https://10fastfingers.com/">10FastFingers</a> (good for challenges and measuring your wpmw)</li>
<li><a href="https://www.typing.com/">Typing.com</a> (good interactive lessons)</li>
<li><a href="https://www.keybr.com/">Keybr</a> (one of the most useful)</li>
</ul>
<p>As always when I start to dig into new things I discover an entirely new world and also in this case it was not different. There are entire communities dedicated to mechanical keyboards, on <a href="https://www.reddit.com/r/MechanicalKeyboards/">Reddit</a>, on Youtube, etc. There are even ppl doing reviews of how key switches sound, I'm not joking 😀</p>Raspberry Kubernetes cluster for my homlab with k3sup2019-10-31T11:47:45+01:002019-10-31T11:47:45+01:00Nicola Ballottatag:hybridhacker.com,2019-10-31:/homelab-raspberry-kubernetes-cluster-with-k3sup.html<p>With my everyday job I get in touch with huge on-premise Kubernetes clusters (500+ nodes), full of complex and interesting things. Unfortunately they can't be used as playgrounds, so I always end up building something locally (minikube, <a href="https://github.com/kubernetes-sigs/kind/">Kind</a>, <a href="https://microk8s.io/">Multipass/Mikrok8s</a>) which almost always is not the ideal solution unless you …</p><p>With my everyday job I get in touch with huge on-premise Kubernetes clusters (500+ nodes), full of complex and interesting things. Unfortunately they can't be used as playgrounds, so I always end up building something locally (minikube, <a href="https://github.com/kubernetes-sigs/kind/">Kind</a>, <a href="https://microk8s.io/">Multipass/Mikrok8s</a>) which almost always is not the ideal solution unless you want to use them as development environments. On the other hand, here in my homelab I've couple of powerful enough 1U Supermicro where I installed both VMware/Openstack and then Kubernetes on top of them, but they are pretty much noisy and expensive to maintain always on at home. </p>
<p>For that reason I always promised myself to build a Raspberry cluster as soon as I had time. Finally last weekend it was a rainy and ugly day here in Berlin, so I found a couple of hours to build it. I used the Raspys and <a href="https://k3s.io/">k3s</a> I had at home, so it's not consistent as hw build, but it works pretty well.</p>
<h2>Hardware list</h2>
<p>This is the list of hardware I used:</p>
<ul>
<li>1x Raspberry Pi 4 Model B Rev 1.1 (4Gb of Ram)</li>
<li>1x Raspberry Pi 3 Model B+ Rev 1.3</li>
<li>1x Raspberry Pi 3 Model B Rev 1.2</li>
<li>1x D-Link Gigabit switch</li>
<li>1x Inepo Multi USB Port Charger</li>
</ul>
<p class="center"><img alt="Raspberry Cluster" class="img-fluid" src="https://hybridhacker.com/images/kubernetes_on_raspberry_clean.jpg"/></p>
<p>In the future I plan to replace the Pi 3s with Pi 4s and add two more to have a 5 nodes kube cluster. </p>
<h2>Prerequisietes</h2>
<p>Before starting I assume you already have your Raspberry cabled and on the same network with dhcp. In addition to that I assume you flashed a clean version of <a href="https://www.raspberrypi.org/downloads/raspbian/">Raspbian Buster Lite</a> on all your SD cards and added a <code>ssh</code> file in the root folder of every card to be able to log into your Raspberrys. Looking at your router dhcp logs, you should be able to find the ips of your Raspberrys and ssh into them to perform the following pre-configs.</p>
<p>Log into every Raspberry and do this. Remember to <strong>change IP and hostname</strong> for every Raspberry!</p>
<div class="highlight"><pre><span></span><code>ssh<span class="w"> </span>pi@ip_of_your_raspberry<span class="w"> </span><span class="c1"># default password is raspberry</span>
sudo<span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="s2">"master-01"</span><span class="w"> </span>><span class="w"> </span>/etc/hostname<span class="w"> </span><span class="c1"># CHOOSE A DIFFERENT HOSTNAME FOR EVERY RASPBERRY!</span>
<span class="c1"># Now we set a different ip address for every Raspberry</span>
sudo<span class="w"> </span>tee<span class="w"> </span><span class="s"><<EOF >> /etc/dhcpcd.conf</span>
<span class="s"> interface eth0</span>
<span class="s"> static ip_address=192.168.0.100/24</span>
<span class="s"> static routers=192.168.0.1</span>
<span class="s"> static domain_name_servers=8.8.8.8</span>
<span class="s">EOF</span>
<span class="c1"># And then we enable some configs needed to run Kubernetes at its best</span>
sudo<span class="w"> </span>sed<span class="w"> </span>-ie<span class="w"> </span><span class="s2">"/gpu_mem/c\gpu_mem=16"</span><span class="w"> </span>/boot/config.txt
sudo<span class="w"> </span>sed<span class="w"> </span>-ie<span class="w"> </span><span class="s1">'s/$/ cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory/'</span><span class="w"> </span>/boot/cmdline.txt
<span class="c1"># And then reboot so our changes take effects</span>
sudo<span class="w"> </span>reboot
</code></pre></div>
<p>Now for every Raspberry let's add our ssh key so we will easily ssh into them after.</p>
<div class="highlight"><pre><span></span><code>ssh-copy-id<span class="w"> </span>pi@192.168.0.1<span class="w"> </span><span class="c1"># repeat this for every Raspberry node!</span>
</code></pre></div>
<h2>K3s and k3sup</h2>
<p>And now let's do some magic with k3s and k3sup. As you probably know k3s is a minimal distribution of Kubernetes (perfectly compatible with it) with a lot of unneeded stuff stripped away. K3s installation is already super easy and smooth, but with k3sup everything is much easier and you don't even need to log into your Raspberries! So after you configured everything as described in the previous section, let's download and install k3sup (this should be done on your laptop/pc):</p>
<div class="highlight"><pre><span></span><code>curl<span class="w"> </span>-sLS<span class="w"> </span>https://get.k3sup.dev<span class="w"> </span><span class="p">|</span><span class="w"> </span>sh
sudo<span class="w"> </span>install<span class="w"> </span>k3sup<span class="w"> </span>/usr/local/bin/
k3sup<span class="w"> </span>--help
</code></pre></div>
<p>After that, all you need to do to bootstrap a Kubernetes masternode is:</p>
<div class="highlight"><pre><span></span><code>k3sup<span class="w"> </span>install<span class="w"> </span>--ip<span class="w"> </span><span class="m">192</span>.168.1.41<span class="w"> </span>--user<span class="w"> </span>pi<span class="w"> </span><span class="c1"># use the ip of the Raspberry you configured to be the master</span>
</code></pre></div>
<p>To check if everything went fine:</p>
<div class="highlight"><pre><span></span><code><span class="nb">export</span><span class="w"> </span><span class="nv">KUBECONFIG</span><span class="o">=</span><span class="sb">`</span><span class="nb">pwd</span><span class="sb">`</span>/kubeconfig
kubectl<span class="w"> </span>get<span class="w"> </span>node
</code></pre></div>
<p>If everything went fine, you should see your master node marked as ready. </p>
<p>Now you could stop here or (as I did) add more workers to build a proper Kubernetes cluster. To do that simply type:</p>
<div class="highlight"><pre><span></span><code>k3sup<span class="w"> </span>join<span class="w"> </span>--ip<span class="w"> </span><span class="m">192</span>.168.1.43<span class="w"> </span>--server-ip<span class="w"> </span><span class="m">192</span>.168.1.41<span class="w"> </span>--user<span class="w"> </span>pi
</code></pre></div>
<p>where the <code>--ip</code> is the ip of the worker you want to add and the <code>--server-ip</code> is the ip of the master. That's basically it! Again with <code>kubectl get node</code> you will see your worker(s) appearing and becoming part of your cluster. </p>Automatically enable/disable L2TP on TPLink access point2019-01-09T17:26:09+01:002019-01-09T17:26:09+01:00Nicola Ballottatag:hybridhacker.com,2019-01-09:/automatically-enable-disable-l2tp-on-tplink-access-point.html<p>As many expats (I'm Italian and I live in Berlin), I make extensive use of VPN to act as I was in my home country. There are tons of services out there (I personally use <a href="https://privatevpn.com/rt/nG1">PrivateVPN</a>), but that's not the topic of this post. </p>
<p>Unfortunately this kind of VPN services …</p><p>As many expats (I'm Italian and I live in Berlin), I make extensive use of VPN to act as I was in my home country. There are tons of services out there (I personally use <a href="https://privatevpn.com/rt/nG1">PrivateVPN</a>), but that's not the topic of this post. </p>
<p>Unfortunately this kind of VPN services usually are not reliable enough to be always on in your home network. They get frequent disconnections, high latency, etc. For this reason it's a good idea to enable/disable them on demand. In my case I had a Fritzbox 7412 that doesn't really support L2TP and immediately after a TPLink Archer AC1200, a cheap Wifi router with VPN client capabilities. So far, so good. </p>
<p>The only issue with this router is that there's no API support and no remote access using terminal. The only option is the Web UI. That really sucks. Full of Javascript and Ajax. So how to automate L2TP vpn enable/disable action? Usually Urllib, Mechanize, Beautifulsoup are all good answers. But in this case with so much Javascript and Ajax they were not suitable. So I decided to use Selenium.</p>
<p>At work we use Selenium a lot for running functional tests, but I never used it for automation. Well I have to say that it's really powerful. I was able to automate everything in a flash with just a couple of lines of Python code.</p>
<p>You can find the result <a href="https://github.com/nicolaballotta/tplink-vpn">here</a>.</p>
<p>Exactly after 2 day after building this script, I bought a new Mikrotik router switch that has API and much much better L2TP support 😁</p>New year, new domain and good resolutions for 20192018-12-28T10:50:49+01:002018-12-28T10:50:49+01:00Nicola Ballottatag:hybridhacker.com,2018-12-28:/new-year-new-domain.html<p>Last time I wrote here, it was more or less one year ago. 2018 was a really busy year, with many challenges, but also many successes to celebrate. In addition to that, I have a newcomer in my family that will probably keep me awake for some nights. </p>
<p>My good …</p><p>Last time I wrote here, it was more or less one year ago. 2018 was a really busy year, with many challenges, but also many successes to celebrate. In addition to that, I have a newcomer in my family that will probably keep me awake for some nights. </p>
<p>My good resolution for 2019 then, is to try to share more. </p>
<p>In the last year I totally lost interest in sharing stuff on Facebook, Twitter or any other social network. That while I still feel the need of sharing about my "hacker" life, that is not only limited to bits. Indeed, besides computers, I love electronics, DIY, 3d printing, artificial intelligence and and even cooking! </p>
<p>For that reason I decided to revamp a little bit this blog and also move to a more meaningful domain which was better identifying myself. </p>
<p>Yes, I feel like an "hybrid hacker". What an hybrid hacker is?</p>
<p>Imho an hybrid hacker can be defined as a person who tries to apply the hacker culture to everyday life. And this is exactly what I do. If I will be able to do what I just wrote, you will understand more. </p>
<p>With that said, Happy new year! 😀</p>Migrating from Jekyll to Pelican2017-12-08T11:35:40+01:002017-12-08T11:35:40+01:00Nicola Ballottatag:hybridhacker.com,2017-12-08:/migrating-from-jekyll-to-pelican.html<p>After (not) using <a href="https://jekyllrb.com/">Jekyll</a> for a lot of time, I decided to move to <a href="https://blog.getpelican.com/">Pelican</a>. Why I've done that is quickly explained.</p>
<ul>
<li>I'm a Pythonist and I already have to maintain a Python environment on my laptop</li>
<li>Pelican is extremely clean and easy to hack</li>
<li>I'm not a great fan …</li></ul><p>After (not) using <a href="https://jekyllrb.com/">Jekyll</a> for a lot of time, I decided to move to <a href="https://blog.getpelican.com/">Pelican</a>. Why I've done that is quickly explained.</p>
<ul>
<li>I'm a Pythonist and I already have to maintain a Python environment on my laptop</li>
<li>Pelican is extremely clean and easy to hack</li>
<li>I'm not a great fan of Ruby</li>
</ul>
<p>At the moment I'm using a modified version of <a href="https://github.com/nairobilug/pelican-alchemy/">Alechemy</a>, a minimal and responsive theme for Pelican.</p>I finally switched from Fish to Zsh2016-05-24T12:00:00+02:002016-05-24T12:00:00+02:00Nicola Ballottatag:hybridhacker.com,2016-05-24:/i-finally-switched-from-fish-to-zsh.html<p>I always been a big fan of <a href="https://fishshell.com/">Fish shell</a> and if you are involved in sysadmin or development you can understand why. Super useful autosuggestion, shiny colors and many other cool features. So why I decided to switch to <a href="http://www.zsh.org/">Zsh</a>?</p>
<p>I make an extensive use of terminal for everyday job …</p><p>I always been a big fan of <a href="https://fishshell.com/">Fish shell</a> and if you are involved in sysadmin or development you can understand why. Super useful autosuggestion, shiny colors and many other cool features. So why I decided to switch to <a href="http://www.zsh.org/">Zsh</a>?</p>
<p>I make an extensive use of terminal for everyday job. From my terminal I install new apps, manage existing, I create complex scripts, I've many remote sessions opened and I usually write code using Vim. </p>
<ul>
<li>I like to use the standard Posix construct <code>$(command)</code>. In Fish this is not supported (you can only use <code>(command)</code>, not a big deal, but I've to change this on many scripts)</li>
<li>Environment variable declaration. Same as above. Usually I declare a variable like <code>MYHOME=/home</code>. In Fish you have to use <code>env MYHOME=/home</code>.</li>
<li>In Fish the double operand <code>&&</code> is not supported. Fish uses <code>&</code>.</li>
<li>Using Vim with Fish is a pain and you usually override it with bash.</li>
</ul>
<p>In addition to these common issues, Zsh has tons of plugins and themes you can install and activate using <a href="https://github.com/robbyrussell/oh-my-zsh">Oh My Zsh framework</a>.</p>
<p class="center"><img alt="Agnoster" class="img-fluid" src="https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png"/></p>
<p>Installing Zsh on MacOS is only matter of:</p>
<div class="highlight"><pre><span></span><code>brew<span class="w"> </span>update
brew<span class="w"> </span>install<span class="w"> </span>zsh
chsh<span class="w"> </span>-s<span class="w"> </span>/bin/zsh
sh<span class="w"> </span>-c<span class="w"> </span><span class="s2">"</span><span class="k">$(</span>curl<span class="w"> </span>-fsSL<span class="w"> </span>https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh<span class="k">)</span><span class="s2">"</span>
</code></pre></div>
<p>As you see, I included also oh-my-zsh. To activate Agnoster theme (the super cool theme you see in the image above), just change your <code>.zshrc</code> theme section as follows: <code>ZSH_THEME="agnoster"</code>. In addition to this you have to download a supported font and set it on iTerm2. I personally chose <a href="https://github.com/powerline/fonts/blob/master/Meslo/Meslo%20LG%20M%20DZ%20Regular%20for%20Powerline.otf">this</a>.</p>
<p>If you want the Fish-like suggestions, please install also <a href="https://github.com/zsh-users/zsh-autosuggestions">this</a> plugin.</p>KubeRocks: news and resources about Kubernetes and containers2016-03-19T12:00:00+01:002016-03-19T12:00:00+01:00Nicola Ballottatag:hybridhacker.com,2016-03-19:/kuberocks-news-and-resources-about-kubernetes-and-containers.html<p>During the last year and a half, while building <a href="https://easywp.com">EasyWP</a> for Namecheap, I've been focused a lot on things like <a href="https://coreos.com/">CoreOS</a>, <a href="https://www.openstack.org/">Openstack</a> and containers (both with <a href="https://docker.com">Docker</a> and <a href="https://coreos.com/rkt/">Rkt</a>). Building a product based on containers, nowadays is such an ambitious objective.</p>
<p>Though containers technology exists since many years, only during …</p><p>During the last year and a half, while building <a href="https://easywp.com">EasyWP</a> for Namecheap, I've been focused a lot on things like <a href="https://coreos.com/">CoreOS</a>, <a href="https://www.openstack.org/">Openstack</a> and containers (both with <a href="https://docker.com">Docker</a> and <a href="https://coreos.com/rkt/">Rkt</a>). Building a product based on containers, nowadays is such an ambitious objective.</p>
<p>Though containers technology exists since many years, only during the latest months became trending and enough stable to be used in a production environment. In particular, if you want to build a solid container environment, you need a good orchestrator. An orchestrator is something that schedules your containers, keeps them running and auto heals them in case of crash. After trying almost all the solutions available today on the market, I finally came up with <a href="https://kubernetes.io">Kubernetes</a> and I fell in love with it.</p>
<p class="center"><img alt="KubeRocks" class="img-fluid" src="https://hybridhacker.com/images/kuberocks-logo.jpg"/></p>
<p>Kubernetes is an opensource orchestrator cluster technology, originally created by Google and now contributed by many big entities (you wouldn't imagine, but also Microsoft is committing on Kubernetes repository). With Kubernetes you can be sure that your pods are always running. More. Kubernetes offers many tools to manage app deployment in containers, monitoring, etc.</p>
<p>As I said before, these kind of technologies are very new, so finding news, tutorial and resources is very difficult. This is why I decided to create <a href="http://kube.rocks">KubeRocks</a>. KubeRocks is an HackerNews style website that will focus on Kubernetes and container resources. KubeRocks is open to all. Just <a href="http://www.kube.rocks/site/hello/register/1615">subscribe</a> and you can post your links.</p>
<p>Currently KubeRocks runs on <a href="https://www.hellobox.co/">HelloBox</a>, a pretty cool service to create vertical news websites. It has some limits, but for now it's enough. Please subscribe and contribute yourself!</p>Single node Ceph cluster on CentOS 7 with VirtualBox2016-01-17T16:45:00+01:002016-01-17T16:45:00+01:00Nicola Ballottatag:hybridhacker.com,2016-01-17:/single-node-ceph-cluster-on-centos-7-with-virtualbox.html<p>If you work with cloud, you know that nowadays <a href="http://ceph.com/">Ceph</a> is the standard when you talk about distributed file systems. The only good alternative imho is <a href="http://www.gluster.org/">GlusterFS</a>, but today I wanna talk about installing a single node Ceph on CentoOS 7 using Virtualbox. This is for testing purposes only. I …</p><p>If you work with cloud, you know that nowadays <a href="http://ceph.com/">Ceph</a> is the standard when you talk about distributed file systems. The only good alternative imho is <a href="http://www.gluster.org/">GlusterFS</a>, but today I wanna talk about installing a single node Ceph on CentoOS 7 using Virtualbox. This is for testing purposes only. I repeat. For testing purposes only. Having a single node Ceph cluster is a nonsense, but could be useful to take confidence for the first time with this environment. Also, if you have a small amount of resources on your local development environment, you can choose a single node installation to simulate a Ceph environment with only one node.</p>
<h4>REQUIREMENTS</h4>
<p>Before starting the Ceph deploy, ensure to create 2 VMs on Vistualbox with the following characteristics:</p>
<ul>
<li>at least 2 cpus</li>
<li>at least 2GB of RAM</li>
<li>two networking cards, one for NAT and another Host-only Adapter with a network assigned (in this example I've chosen 10.10.10.0/24 network)</li>
<li>one disk each, with at least 50GB of space</li>
<li>a clean install of CentOS 7 with one machine configured as 10.10.10.100 and the other with address 10.10.10.101 (in addition to the dhcp only NAT adapter)</li>
</ul>
<h4>CEPH NODE (10.10.10.101)</h4>
<div class="highlight"><pre><span></span><code>setenforce<span class="w"> </span><span class="m">0</span>
sed<span class="w"> </span>-i<span class="w"> </span>s<span class="s1">'/SELINUX.*=.*enforcing/SELINUX=disabled'</span>/g<span class="w"> </span>/etc/selinux/config
firewall-cmd<span class="w"> </span>--zone<span class="o">=</span>public<span class="w"> </span>--add-port<span class="o">=</span><span class="m">6789</span>/tcp<span class="w"> </span>--permanent
firewall-cmd<span class="w"> </span>--zone<span class="o">=</span>public<span class="w"> </span>--add-port<span class="o">=</span><span class="m">6800</span>-7100/tcp<span class="w"> </span>--permanent
firewall-cmd<span class="w"> </span>--reload
sudo<span class="w"> </span>useradd<span class="w"> </span>-d<span class="w"> </span>/home/ceph-admin<span class="w"> </span>-m<span class="w"> </span>ceph-admin<span class="w"> </span>-s<span class="w"> </span>/bin/bash
sudo<span class="w"> </span>passwd<span class="w"> </span>ceph-admin
<span class="nb">echo</span><span class="w"> </span><span class="s2">"ceph-admin ALL = (root) NOPASSWD:ALL"</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/etc/sudoers.d/ceph-admin
sudo<span class="w"> </span>visudo<span class="w"> </span><span class="c1"># localt "Defaults requiretty" and change it to "Defaults:ceph !requiretty"</span>
sudo<span class="w"> </span>chmod<span class="w"> </span><span class="m">0440</span><span class="w"> </span>/etc/sudoers.d/ceph-admin
</code></pre></div>
<h4>ADMIN NODE (10.10.10.100)</h4>
<div class="highlight"><pre><span></span><code>setenforce<span class="w"> </span><span class="m">0</span>
sed<span class="w"> </span>-i<span class="w"> </span>s<span class="s1">'/SELINUX.*=.*enforcing/SELINUX=disabled'</span>/g<span class="w"> </span>/etc/selinux/config
tee<span class="w"> </span>/etc/yum.repos.d/ceph-deploy.repo<span class="w"> </span>><span class="w"> </span>/dev/null<span class="w"> </span><span class="s"><<EOF</span>
<span class="s">[ceph-noarch]</span>
<span class="s">name=Ceph noarch packages</span>
<span class="s">baseurl=http://ceph.com/rpm-firefly/el7/noarch</span>
<span class="s">enabled=1</span>
<span class="s">gpgcheck=1</span>
<span class="s">type=rpm-md</span>
<span class="s">gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc</span>
<span class="s">EOF</span>
sudo<span class="w"> </span>yum<span class="w"> </span>update<span class="w"> </span><span class="o">&&</span><span class="w"> </span>sudo<span class="w"> </span>yum<span class="w"> </span>install<span class="w"> </span>-y<span class="w"> </span>ceph-deploy<span class="w"> </span>ntp<span class="w"> </span>ntpdate<span class="w"> </span>ntp-doc<span class="w"> </span>openssh-server<span class="w"> </span>ceph-common<span class="w"> </span>ceph-mds
<span class="nb">echo</span><span class="w"> </span><span class="s2">"10.10.10.100 admin-node"</span><span class="w"> </span>>><span class="w"> </span>/etc/hosts
<span class="nb">echo</span><span class="w"> </span><span class="s2">"10.10.10.101 ceph-node"</span><span class="w"> </span>>><span class="w"> </span>/etc/hosts
sudo<span class="w"> </span>useradd<span class="w"> </span>-d<span class="w"> </span>/home/ceph-admin<span class="w"> </span>-m<span class="w"> </span>ceph-admin<span class="w"> </span>-s<span class="w"> </span>/bin/bash
sudo<span class="w"> </span>passwd<span class="w"> </span>ceph-admin
<span class="nb">echo</span><span class="w"> </span><span class="s2">"ceph-admin ALL = (root) NOPASSWD:ALL"</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/etc/sudoers.d/ceph-admin
sudo<span class="w"> </span>chmod<span class="w"> </span><span class="m">0440</span><span class="w"> </span>/etc/sudoers.d/ceph-admin
su<span class="w"> </span>ceph-admin
<span class="c1"># Generate ssh key without passphrase</span>
ssh-keygen
ssh<span class="w"> </span>ceph-admin@ceph-node
tee<span class="w"> </span>~/.ssh/config<span class="w"> </span>><span class="w"> </span>/dev/null<span class="w"> </span><span class="s"><<EOF</span>
<span class="s">Host ceph-node</span>
<span class="s"> Hostname ceph-node</span>
<span class="s"> User ceph-admin</span>
<span class="s">EOF</span>
chmod<span class="w"> </span><span class="m">600</span><span class="w"> </span>~/.ssh/config
mkdir<span class="w"> </span>~/ceph-cluster<span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="nb">cd</span><span class="w"> </span>~/ceph-cluster
ceph-deploy<span class="w"> </span>new<span class="w"> </span>ceph-node
<span class="nb">echo</span><span class="w"> </span><span class="s2">"osd pool default size = 1"</span><span class="w"> </span>>><span class="w"> </span>ceph.conf
<span class="nb">echo</span><span class="w"> </span><span class="s2">"public network = 10.10.10.0/24"</span><span class="w"> </span>>><span class="w"> </span>ceph.conf
ceph-deploy<span class="w"> </span>install<span class="w"> </span>ceph-admin<span class="w"> </span>ceph-node
ceph-deploy<span class="w"> </span>mon<span class="w"> </span>create-initial
ceph-deploy<span class="w"> </span>gatherkeys<span class="w"> </span>ceph-node
ssh<span class="w"> </span>ceph-node
sudo<span class="w"> </span>mkdir<span class="w"> </span>/var/local/osd0
<span class="nb">exit</span>
ceph-deploy<span class="w"> </span>osd<span class="w"> </span>prepare<span class="w"> </span>ceph-node:/var/local/osd0
ceph-deploy<span class="w"> </span>osd<span class="w"> </span>activate<span class="w"> </span>ceph-node:/var/local/osd0
ceph-deploy<span class="w"> </span>admin<span class="w"> </span>ceph-admin<span class="w"> </span>ceph-node
sudo<span class="w"> </span>chmod<span class="w"> </span>+r<span class="w"> </span>/etc/ceph/ceph.client.admin.keyring
ceph<span class="w"> </span>health
rbd<span class="w"> </span>create<span class="w"> </span>foo<span class="w"> </span>--size<span class="w"> </span><span class="m">4096</span><span class="w"> </span>-m<span class="w"> </span>ceph-node<span class="w"> </span>-k<span class="w"> </span>ceph.client.admin.keyring
sudo<span class="w"> </span>rbd<span class="w"> </span>map<span class="w"> </span>foo<span class="w"> </span>--name<span class="w"> </span>client.admin<span class="w"> </span>-m<span class="w"> </span>ceph-node<span class="w"> </span>-k<span class="w"> </span>ceph.client.admin.keyring
sudo<span class="w"> </span>mkfs.ext4<span class="w"> </span>-m0<span class="w"> </span>/dev/rbd/rbd/foo
sudo<span class="w"> </span>mkdir<span class="w"> </span>/mnt/ceph-block-device
</code></pre></div>
<p>Following some useful commands to debug your cluster.</p>
<div class="highlight"><pre><span></span><code>ceph<span class="w"> </span>health
ceph<span class="w"> </span>-w
ceph<span class="w"> </span>quorum_status
ceph<span class="w"> </span>-m<span class="w"> </span>ceph-node<span class="w"> </span>mon_status
ceph<span class="w"> </span>osd<span class="w"> </span>stat
ceph<span class="w"> </span>mon<span class="w"> </span>dump
</code></pre></div>Ask for sudo password in graphical mode on MacOS X2015-11-15T16:45:00+01:002015-11-15T16:45:00+01:00Nicola Ballottatag:hybridhacker.com,2015-11-15:/ask-for-sudo-password-in-graphical-mode-on-macos-x.html<p>I do lot of bash scripting under MacOS and usually, if I need administration privileges, I run <code>sudo</code> from my terminal. Anyway, sometimes you need to let non-technical users run these scripts and I'm sure that they wouldn't be happy to open terminal and run your script with sudo command …</p><p>I do lot of bash scripting under MacOS and usually, if I need administration privileges, I run <code>sudo</code> from my terminal. Anyway, sometimes you need to let non-technical users run these scripts and I'm sure that they wouldn't be happy to open terminal and run your script with sudo command. So how to solve this? Pretty easy, look at the code below.</p>
<div class="highlight"><pre><span></span><code>osascript<span class="w"> </span>-e<span class="w"> </span><span class="s2">"do shell script \"touch /myfile\" with administrator privileges"</span>
</code></pre></div>
<p>Osascript is a command under MacOS that let you launch scripts written in AppleScripts or any Open Scripting Architecture (OSA) language. As you can see above, this script tries to create (touch) an empty file called <code>myfile</code> under the filesystem root that is not owned by you. To do this, we need root password and using <code>osascript</code> we can ask this using MacOS UI.</p>WordPress development environment with Vagrant and Ansible2015-10-28T12:10:00+01:002015-10-28T12:10:00+01:00Nicola Ballottatag:hybridhacker.com,2015-10-28:/wordpress-development-environment-with-vagrant-and-ansible.html<p>Some days ago I had the need of playing with a WordPress website on my local environment. There are many solutions out there to build your local WordPress environment, but I remembered an old project I've created some years ago. And yes, it's still working out of the box!</p>
<p>I …</p><p>Some days ago I had the need of playing with a WordPress website on my local environment. There are many solutions out there to build your local WordPress environment, but I remembered an old project I've created some years ago. And yes, it's still working out of the box!</p>
<p>I called it One Command WordPress, cause it makes use of Vagrant and as you may know you only need one command to fire up your env: <code>vagrant up</code>.</p>
<p>One Command WordPress creates a virtual machine through Vagrant/Virtualbox and installs all the environment packages using Ansible:</p>
<ul>
<li>Ubuntu precise64 (should work with other Ubuntu versions)</li>
<li>Nginx</li>
<li>Php5-fpm</li>
<li>Mysql</li>
<li>WordPress</li>
<li>Various system software (likve Vim and Git)</li>
</ul>
<p>Another cool thing about One Command WordPress, is the possibility of writing directly on your webroot. If you look on your host, you can find a folder called <code>wordpress.dev</code> and this is where your WordPress installation lives. Using <a href="https://github.com/gael-ian/vagrant-bindfs">Vagrant BindFS plugin</a> we solve all the permission issue that usually happen with NFS mount.</p>
<p>To install One Command WordPress, first of all be sure to meet all the requirements installing this software:</p>
<ul>
<li><a href="https://www.virtualbox.org/wiki/Downloads">VirtualBox</a>. Tested on 4.3.x, but 4.2.x should also work.</li>
<li><a href="http://www.vagrantup.com/downloads.html">Vagrant</a>. Tested on 1.6.5</li>
<li><a href="https://github.com/cogitatio/vagrant-hostsupdater">Vagrant hostupdater</a>.</li>
<li><a href="https://github.com/gael-ian/vagrant-bindfs">Vagrant bindfs</a></li>
<li><a href="http://docs.ansible.com/intro_installation.html">Ansible</a>. Tested on 1.5.5.</li>
</ul>
<p>Next, clone the repo and do a vagrant up after configuring <code>ansible/group_vars/all</code>:</p>
<div class="highlight"><pre><span></span><code>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/nballotta/one-command-wordpress.git
<span class="nb">cd</span><span class="w"> </span>one-command-wordpress<span class="w"> </span>
vagrant<span class="w"> </span>up
</code></pre></div>
<p>You will find your WordPress installation under <code>wordpress.dev/</code> and you can point your browser to <a href="http://wordpress.dev">http://wordpress.dev</a>.</p>Switch on and off nsurlsessiond on Mac OS2015-10-23T16:56:00+02:002015-10-23T16:56:00+02:00Nicola Ballottatag:hybridhacker.com,2015-10-23:/switch-on-and-off-nsurlsessiond-on-mac-os.html<p>If you use iCloud services, you may have noticed that sometimes your bandwidth is fully saturated by processes called <em>nsurlsessiond</em> or <em>nsurlstorageid</em>; these services take care of syncing your files, photos or contacts with iCloud. It happens that sometimes you can't count on large bandwidth and this is a bit …</p><p>If you use iCloud services, you may have noticed that sometimes your bandwidth is fully saturated by processes called <em>nsurlsessiond</em> or <em>nsurlstorageid</em>; these services take care of syncing your files, photos or contacts with iCloud. It happens that sometimes you can't count on large bandwidth and this is a bit annoying. This is why I created this simple script to activate/deactivate iCloud nsurl* processes.</p>
<div class="gist">
<script src='https://gist.github.com/3881bcd662248fb93916.js'></script>
<noscript>
<pre><code>#!/bin/bash
function cloudOn {
launchctl load /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
launchctl load /System/Library/LaunchAgents/com.apple.nsurlsessiond.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.nsurlsessiond.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
}
function cloudOff {
launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
launchctl unload /System/Library/LaunchAgents/com.apple.nsurlsessiond.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlsessiond.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
}
if [ -z "$1" ]; then
echo "Usage: $0 on | off"
elif [ "$1" == "on" ]; then
echo "Switching cloud on.."
cloudOn
elif [ "$1" == "off" ]; then
echo "Switching cloud off.."
cloudOff
else
echo "Invalid argument"
echo "Usage: $0 on | off"
fi</code></pre>
</noscript>
</div>
<p>Download this code, save it on a file and <code>chmod +x cloud.sh</code>.</p>
<p>To disable nsurl* services just run: <code>./cloud.sh off</code>.</p>
<p>To enable nsurl* services just run: <code>./cloud.sh on</code>.</p>Wildcard DNS with Dnsmasq on Mac OS X2015-10-20T08:22:00+02:002015-10-20T08:22:00+02:00Nicola Ballottatag:hybridhacker.com,2015-10-20:/wildcard-dns-with-dnsmasq-on-mac-os-x.html<p>A wildcard domain is a <strong>domain name that will match requests for non-existent sub-domain names</strong>. This is fairly simple with a registered domain name and consist of adding a dns record like *.example.com. For more info about setting up a wildcard public domain name, refer to your domain registrar …</p><p>A wildcard domain is a <strong>domain name that will match requests for non-existent sub-domain names</strong>. This is fairly simple with a registered domain name and consist of adding a dns record like *.example.com. For more info about setting up a wildcard public domain name, refer to your domain registrar.</p>
<p>During last months I worked on a big project that required a wildcard dns domain and, as usual for every project I work on, I like to have a shadowed local environment. How to create a local wildcard domain name on Mac OS X the easy way? The answer is <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">Dnsmasq</a>.</p>
<p>First of all install Dnsmasq using <a href="http://brew.sh/">Brew</a> (if you didn't installed Brew yet, please do it now!)</p>
<div class="highlight"><pre><span></span><code>brew<span class="w"> </span>install<span class="w"> </span>dnsmasq
</code></pre></div>
<p>Then you can follow these steps to configure a local wildecard dns on your Mac OS X ennvironment:</p>
<div class="highlight"><pre><span></span><code>cp<span class="w"> </span>/usr/local/opt/dnsmasq/dnsmasq.conf.example<span class="w"> </span>/usr/local/etc/dnsmasq.conf
sudo<span class="w"> </span>cp<span class="w"> </span>-fv<span class="w"> </span>/usr/local/opt/dnsmasq/*.plist<span class="w"> </span>/Library/LaunchDaemons
sudo<span class="w"> </span>chown<span class="w"> </span>root<span class="w"> </span>/Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo<span class="w"> </span>launchctl<span class="w"> </span>load<span class="w"> </span>/Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
tee<span class="w"> </span>/usr/local/etc/dnsmasq.conf<span class="w"> </span>><span class="w"> </span>/dev/null<span class="w"> </span><span class="s"><<EOF</span>
<span class="s">address=/mylocaldomain.dev/172.17.8.200</span>
<span class="s">EOF</span>
sudo<span class="w"> </span>launchctl<span class="w"> </span>stop<span class="w"> </span>homebrew.mxcl.dnsmasq
sudo<span class="w"> </span>launchctl<span class="w"> </span>start<span class="w"> </span>homebrew.mxcl.dnsmasq
sudo<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span>/etc/resolver
tee<span class="w"> </span>/etc/resolver/mylocaldomain.dev<span class="w"> </span>><span class="w"> </span>/dev/null<span class="w"> </span><span class="s"><<EOF</span>
<span class="s">nameserver 127.0.0.1</span>
<span class="s">EOF</span>
</code></pre></div>
<p>Please be sure to replace <strong>mylocaldomain.dev</strong> with your local domain and <strong>172.17.8.200</strong> with the local ip of your project (i.e. a Vagrant/Virtualbox machine).</p>
<p>Now, if the installation was successful, if you ping let's say <em>test.mylocaldomain.dev</em>, you system should always resolve <em>172.17.8.200</em> (or the ip address you configured before)</p>Hello World2015-10-18T08:27:00+02:002015-10-18T08:27:00+02:00Nicola Ballottatag:hybridhacker.com,2015-10-18:/hello-world.html<p>This is my first post on this brand new blog. As usual I cannot guarantee that updates will be constant. </p>
<p>Some technical info about this blog.</p>
<ul>
<li>I'm using <a href="https://jekyllrb.com/">Jekyll</a> as creation engine cause I want to be able to write fast updates using my terminal and I don't want to …</li></ul><p>This is my first post on this brand new blog. As usual I cannot guarantee that updates will be constant. </p>
<p>Some technical info about this blog.</p>
<ul>
<li>I'm using <a href="https://jekyllrb.com/">Jekyll</a> as creation engine cause I want to be able to write fast updates using my terminal and I don't want to waste cpu/memory with <a href="http://wordpress.org">WordPress</a>.</li>
<li>The theme is based on <a href="https://github.com/johnotander/pixyll">Pyxyll</a> by John Otander. It's clean and usable and with a couple of customizations it's perfect for what I'm doing.</li>
<li>This blog is hosted on <a href="https://www.digitalocean.com/?refcode=1710b2f64de5">Digital Ocean</a> inside a small droplet.</li>
<li>I will blog using <a href="http://www.sublimetext.com/3">Sublime Text 3</a>, my favorite text editor.</li>
</ul>
<p>That's all. As a Jack of all Trades, feel free to <a href="/contact">contact me</a> about anything.</p>