<title>Just a quick post. BAM!, my first web app (still in development) is on Github!</title>
<description><p>As you can read from the title, I’m publishing the uncompleted code of my first webapp. I’m working on this since 3 weeks, and I’m proud of what I’ve done so far.</p>
<p>If you want to check out the repository, click <a href="https://github.com/praticamentetilde/BAM">here</a>.</p>
<p>Maybe I can use Materialize css also for this jekyll site, or maybe this is another thing I say but I’m not going to do. Who knows.</p>
</description>
<pubDate>Mon, 15 Aug 2016 12:00:00 +0200</pubDate>
<description><p>Hey there! This is my first post about archery, so I thought that I could have done a tour of my setup. As I wrote in the about page, I’m a Olmpic recurve archer based in Italy. I do this for almost five years! If you don’t understand everything I say, you can check out the youtube channel <a href="https://www.youtube.com/user/NUSensei/">Nusensei</a>. It’s a very good source, especially for beginners.</p>
<p>Ok, the setup. I own a <em>Fiberbow 5.99</em> LH (yes, I’m left handed) as my <code class="highlighter-rouge">riser</code>, the <em>central</em> part of the bow. It’s made by carbon fiber so it’s very lightweight. And is not painted too: It looks kinda cool. Many experienced archers could complain saying that carbon fiber bends and this is a bad thing. Instead, I think this gives you a nice feedback when you release. Also I tried to raise a friend’s <em>Hoyt Prodigy XT</em>, and there’s no way I’m going to lift such a weight on a regular base. Both the risers mentioned are high-range ones: I got mine 50% off because it wasn’t the latest model and it had some minor ahestetic flaws. Also, this isn’t my first one. In fact, I used to shoot with an Orange SF Premium: great bow for beginners!</p>
<p>As limbs, I use a pair of <em>EXE College</em> rated at 34 pounds. Since I’m quite tall (limbs and riser toghether make a 70” tall bow), my draw length is around 29.5” and my draw weight is around 38 pounds.</p>
<p>The sight is a <em>Shibuya Dual Click</em>. You can check out <a href="https://www.youtube.com/watch?v=_ZvAnyxazpY">this</a> review by Nusensei (by the way, I knew his channel from this very video).</p>
<p>As stabilizers, I use a set of <em>Fiberbow S.3</em> ones with yellow dampeners (for those who know the difference between the colours).</p>
<p>As plunger button, I use a <em>EXE</em> one. It’s a middle range one, but it seems very well built and it works fine! Also, I’m not going to spend 90€ for a <code class="highlighter-rouge">Cartel</code> one.</p>
<p>My current arrows are a set of <em>Easton X7 Eclipse</em> spined at 2213. These are winter alluminium arrows, but since they are cheaper than carbon ones, I bought these as a total replacement of my <em>VAP V6</em> 600. Those, due to form flaws, were 2 inches too short. Oh, and I always used <em>Spin Wings</em> and <em>Elivanes</em>, a stiffer plastic italian replacement.</p>
<p>Here’s an image of the complete bow at the archery range:</p>
<title>How to rickroll people that try to run "rm -rf" on your system</title>
<description><p><strong>WARNING: The method showed here could not prevent the actual execution of “rm -rf” if the “UNIX vandal” is clever enough. Proceed at your own risk, and make backups!</strong></p>
<p>I like Rick Astley late 80’s songs, and you can see them here in my Spotify:</p>
<p>I like rickrolling people myself too, especially if they’re trying to delete my entire <code class="highlighter-rouge">/home</code> directory or, even worse, <code class="highlighter-rouge">/</code>. Since I learned how to use the <code class="highlighter-rouge">alias</code> built-in, I wanted a way to prevent that random people tinkering with my laptop (that I may forgot to lock) could delete potentially important stuff, just for fun or boredom.</p>
<p>The method that I’ll show will lock any <code class="highlighter-rouge">rm</code> command runned in both recursive and force mode, so <code class="highlighter-rouge">rm -rf</code>, <code class="highlighter-rouge">rm -f -r</code> and <code class="highlighter-rouge">rm -r --force</code> are all blocked, even if they are launched by <code class="highlighter-rouge">sudo</code>. I’m going to alias the rm command in <code class="highlighter-rouge">/etc/profile</code><code class="highlighter-rouge">/etc/bash.bashrc</code> and in <code class="highlighter-rouge">/etc/zsh/zshrc</code> (I’m a zsh user) so that the rickroll will be possible from all users, even root and the ones with a brand new <code class="highlighter-rouge">bashrc</code> or <code class="highlighter-rouge">zshrc</code>. Here is the code I appended to those files:</p>
<span class="nb">alias </span><span class="nv">sudo</span><span class="o">=</span><span class="s1">'sudo '</span><span class="c"># this enables aliases in sudo, see http://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo</span></code></pre></figure>
<p>Since <code class="highlighter-rouge">alias</code> is not able to control the flags of the aliases (see <a href="http://apple.stackexchange.com/questions/50963/how-do-i-add-a-flag-to-an-alias">here</a>), we’re going to redirect each call of <code class="highlighter-rouge">rm</code> to <code class="highlighter-rouge">/bin/rmAlias</code>, that would run the command if it’s safe. I didn’t use a function because it’s a bit tricky to make that work with <code class="highlighter-rouge">sudo</code>. So, let’s see the code I put in <code class="highlighter-rouge">rmAlias</code>:</p>
<span class="nv">ROLLVIDEO</span><span class="o">=</span>/opt/anti-rm/serious-video.mkv <span class="c"># it's just Never Gonna Give You Up on my system, but be free to customize this!</span>
<p>It may look messy to a UNIX guy more experienced than me, but it works. The <code class="highlighter-rouge">getopts</code> built-in sees if both the <code class="highlighter-rouge">-r</code> and the <code class="highlighter-rouge">-f</code> flags are used and, if so, it starts <code class="highlighter-rouge">rickroll()</code>, which opens with <code class="highlighter-rouge">xdg-open</code> that amazing clip from RickAstleyVEVO. From line 30 and below, the script checks if the <code class="highlighter-rouge">--force</code> flag is used instead of <code class="highlighter-rouge">-f</code>.</p>
<p>Give execute permissions to the script we’ve just created:</p>
<p>Restart your shell, and enjoy. If you want to test safely, I suggest trying to run <code class="highlighter-rouge">rm -rf</code> with no folders or one nonexistant, since this script stop even these commands.</p>
<p>If you want even more security, you can rename this script to <code class="highlighter-rouge">/bin/rm</code> and move the original one in some other place, getting rid of all the aliases. I prefer the solution above because it’s tidier: you haven’t to move anything. In fact, this could be just an AUR package…</p>
<title>Installing Gentoo on a Lenovo ThinkPad X60s</title>
<description><p>My only laptop is a <a href="http://www.thinkwiki.org/wiki/Category:X60s">IBM/Lenovo ThinkPad X60s</a>, a top line “ultrabook” from 2006 that features:</p>
<ul>
<li>An Intel Core Duo L2400 dual core 32 bit CPU, clocked at 1.66 Ghz;</li>
<li>2GB of RAM;</li>
<li>60GB of SATA1 hard drive;</li>
<li>Wifi, Bluetooth, trackpoint mouse only, 56k modem, and a decent set of I/0 ports (including a CardBus slot!).</li>
<p>This machine had an installation on Arch Linux, and I was using it for school stuff. It runned smoothly KDE5, Atom (great editor, I’m using it to write this article), and it was usable even with Phpstorm. Pretty impressive for such an old thing, right?</p>
<p>Since now I don’t need this laptop every day I decided to give a try at Gentoo, another rolling relase, DIY install distro. This was both a test of my skills, my patience and the performances of the machine. For those of you that don’t know, Gentoo hasn’t binary packages: imagine using Arch with just a developer mantained AUR.</p>
<p>I followed the <a href="https://wiki.gentoo.org/wiki/Handbook:Main_Page">installation guide</a> without any problem until I had to emerge and install 309 packets from my <code class="highlighter-rouge">@world</code> set: it took 15 hours! The compilation of <code class="highlighter-rouge">cmake</code> crashed because of memory starvation, and so I had to use a spare USB stick as swap (the root file system wasn’t resizable as it was JFS). After some research and a couple of seconds in <code class="highlighter-rouge">top</code> I discovered that <a href="https://en.wikipedia.org/wiki/Physical_Address_Extension">PAE</a> was not implemented in the install disk kernel. TIP: if you want to use a nicer install enviroment, use the Arch ISO. With gentoo, the initialisation of the file system is made with a <a href="https://wiki.gentoo.org/wiki/Stage_tarball#Stage_3">stage 3 tarball</a> and not by tools like <a href="https://wiki.archlinux.org/index.php/beginners'_guide#Install_the_base_packages">pacstrap</a>.</p>
<p>I had another problem with <code class="highlighter-rouge">make menuconfig</code>, the tool used to specify what features add or remove in your compiled from source Linux kernel. The ncurses menu showed me 64bit options, even if the install disk and the CPU were both 32 bit. If you have this issue too, you can set the <code class="highlighter-rouge">ARCH</code> variable by your own:</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># make ARCH=i386 menuconfig</span>
<span class="c"># make ARCH=i386</span>
<span class="c"># make ARCH=i386 install</span></code></pre></figure>
<p>At the end, I made it! I only have a base install, but i can show you <code class="highlighter-rouge">screenfetch</code>:</p>
<p>I’ve not installed Gentoo in dual boot because I didn’t figured out how to switch my bluetooth dongle in HID mode yet, so I can’t select the OS with <code class="highlighter-rouge">rEFInd</code>. Hope this rambling was, if not useful, at least entertaining!</p>
<title>Get a Bluetooth keyboard work with Arch Linux</title>
<description><p>I’ve recently got a Rapoo E6100. This is a minimal and space saving Bluetooth 3.0 keyboard. If you pair it with Windows 10, it will remain paired after reboot, giving the possibility to use it since the login screen. After installing the Bluetooth stack on my Arch via the <code class="highlighter-rouge">bluez</code> and <code class="highlighter-rouge">bluez-utils</code> packages I thought the pairing process would be as simple as Windows if I used the KDE GUI menus for Bluetooth management. That’s not true. The keyboard, once paired, will reconnect automatically just after <code class="highlighter-rouge">plasmashell</code> loaded, leaving me without keyboard during the SDDM login screen and, of course, during a non-graphical session.</p>
<p>As usual, i’ve searched help in the ArchWiki, founding <a href="https://wiki.archlinux.org/index.php/Bluetooth_keyboard">this</a> article. With that, i’ve succesfully reconnected my Bluetooth keyboard using the <code class="highlighter-rouge">bluetoothctl</code> utility. The next step was configuring the service for auto connection during boot. I’ve created the <code class="highlighter-rouge">btkbd.conf</code> and the <code class="highlighter-rouge">btkbd.service</code> files, enabling the last one with systemd. Let’s give a look to the service file:</p>
<span class="nv">Description</span><span class="o">=</span>systemd Unit to automatically start a Bluetooth keyboard
<p>Line 13 enables the Bluetooth dongle, and line 16 connects it to the keyboard we gave the mac address in <code class="highlighter-rouge">/etc/btkbd.conf</code>. This should work flawlessly, right? Of course it doesn’t. The service starts before the <code class="highlighter-rouge">dbus-org.bluez.service</code> is loaded and fails. However, if the service is started manually after login the Bluetooth keyboard works. After hours of trying figuring out what was wrong I’ve almost asked for a return on Amazon! The last attempt I made was with sddm disabled and involved built from scratch service:</p>
<span class="nv">Description</span><span class="o">=</span>systemd Unit to automatically start a Bluetooth keyboard
<p>This incredibly worked. I think the problem was that <code class="highlighter-rouge">multi-user.target</code> that needs to be reached earlier than <code class="highlighter-rouge">bluetooth.target</code>. I got rid of all the tidiness of the ArchWiki solution just to be sure that was not the problem, but I think you can use all of that just correcting <code class="highlighter-rouge">WantedBy=</code>. Currently I haven’t an ArchWiki account nor a forum one, but as soon as I’ll register I’ll correct the article.</p>
<p>Let me know in the comments if this solution is well made or if it’s just a bodge.
Last thing: I discovered that my Bluetooth dongle is CSR 8510 A10 based so expect some ramblings about <a href="http://www.0xf8.org/2014/02/the-crux-of-finding-a-hid-proxy-capable-usb-bluetooth-adapter/">hid proxy</a>.</p>