Added CV and removed compiled site from repo

This commit is contained in:
Claudio Maggioni (maggicl) 2021-01-26 21:46:43 +01:00
parent 4a509ba6f0
commit 4f15e02965
47 changed files with 2 additions and 1638 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
.jekyll-cache/
.sass-cache/
_site/
.jekyll-metadata

View File

@ -6,7 +6,7 @@
{% endif %}
{% endfor %}
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="/cv.pdf">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>

View File

@ -1,105 +0,0 @@
<!-- vim: set ts=2 sw=2 et tw=80: -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>maggioni.xyz</title>
<meta name="description" content="Eat polenta and do not counter-aim!
">
<link rel="stylesheet" href="/css/main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://maggioni.xyz/404.html">
<link rel="alternate" type="application/rss+xml" title="maggioni.xyz" href="https://maggioni.xyz/feed.xml">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<script src="https://rawgit.com/snaptortoise/konami-js/master/konami.js"></script>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
</head>
<body>
<header class="header container">
<nav class="head navbar">
<h1 class="title container"><a href="/">maggioni.xyz</a></h1>
<!-- vim: set ts=2 sw=2 et tw=80: -->
<div class="links">
<a href="/blog/">Blog</a>
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>
</section>
</header>
<main class="container">
<h1>404 - page not found</h1>
<p>
If you didn't come on purpose I apologise, but the page you are searching doesn't exist.
If you came on purpose enjoy this minimal <code>gif</code> of a dancing Rick Astley.
</p>
<p>
<img class="block-center" src="https://maggioni.xyz/astley.gif" alt="Rick Astley gif">
</p>
<p>
Thanks to <a href="https://github.com/Giorgio-Croci">Giorgio Croci
</a> for the <code>gif</code>!</p>
</main>
<footer class="site-footer container">
<div class="icons">
<a target="_blank" class="icon" href="https://tea.maggioni.xyz/maggicl"><i class="fa fa-git"></i></a>
<a target="_blank" class="icon" href="https://github.com/maggicl"><i class="fa fa-github"></i></a>
<a target="_blank" class="icon" href="https://gitlab.com/maggicl"><i class="fa fa-gitlab"></i></a>
<a target="_blank" class="icon" href="https://www.linkedin.com/in/claudio-maggioni/"><i class="fa fa-linkedin"></i></a>
</div>
<div class="author">
<i class="fa fa-cc" aria-hidden="true"></i>
Claudio Maggioni
<script>
document.write((new Date()).getFullYear());
</script>
<noscript>2021</noscript><br>
Content under
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
CC BY-NC-SA 4.0</a>
</div>
</footer>
</body>
</html>

View File

@ -1,7 +0,0 @@
Copyright 2018 Claudio Maggioni
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,11 +0,0 @@
<!--- vim: set et sw=2 ts=2 tw=80 : -->
# maggioni.xyz
Jekyll source of website https://maggioni.xyz.
## Licensing
Content of articles is licensed under
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). HTML code is
licensed under the MIT license.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 KiB

View File

@ -1,137 +0,0 @@
<!-- vim: set ts=2 sw=2 et tw=80: -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Blog</title>
<meta name="description" content="Eat polenta and do not counter-aim!
">
<link rel="stylesheet" href="/css/main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://maggioni.xyz/blog/">
<link rel="alternate" type="application/rss+xml" title="maggioni.xyz" href="https://maggioni.xyz/feed.xml">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<script src="https://rawgit.com/snaptortoise/konami-js/master/konami.js"></script>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
</head>
<body>
<header class="header container">
<nav class="head navbar">
<h1 class="title container"><a href="/">maggioni.xyz</a></h1>
<!-- vim: set ts=2 sw=2 et tw=80: -->
<div class="links">
<a href="/blog/">Blog</a>
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>
</section>
</header>
<main class="container">
<article class="post">
<header class="post-header">
<h2 class="post-title">Blog</h2>
</header>
<div class="post-content">
<div class="home">
<ul class="post-list">
<li>
<span class="post-meta">
Jul 28, 2016</span>
<h4>
<a class="post-link"
href="/linux/2016/07/28/how-to-rickroll-people-launching-rm-rf-on-your-system.html">
How to rickroll people that try to run "rm -rf" on your system</a>
</h4>
</li>
<li>
<span class="post-meta">
Jul 12, 2016</span>
<h4>
<a class="post-link"
href="/linux/2016/07/12/installing-gentoo-on-a-thinkpad-x60s.html">
Installing Gentoo on a Lenovo ThinkPad X60s</a>
</h4>
</li>
<li>
<span class="post-meta">
Jul 7, 2016</span>
<h4>
<a class="post-link"
href="/linux/2016/07/07/get-a-bluetooth-keyboard-work-with-arch.html">
Get a Bluetooth keyboard work with Arch Linux</a>
</h4>
</li>
</ul>
</div>
</div>
</article>
</main>
<footer class="site-footer container">
<div class="icons">
<a target="_blank" class="icon" href="https://tea.maggioni.xyz/maggicl"><i class="fa fa-git"></i></a>
<a target="_blank" class="icon" href="https://github.com/maggicl"><i class="fa fa-github"></i></a>
<a target="_blank" class="icon" href="https://gitlab.com/maggicl"><i class="fa fa-gitlab"></i></a>
<a target="_blank" class="icon" href="https://www.linkedin.com/in/claudio-maggioni/"><i class="fa fa-linkedin"></i></a>
</div>
<div class="author">
<i class="fa fa-cc" aria-hidden="true"></i>
Claudio Maggioni
<script>
document.write((new Date()).getFullYear());
</script>
<noscript>2021</noscript><br>
Content under
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
CC BY-NC-SA 4.0</a>
</div>
</footer>
</body>
</html>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>

View File

@ -1,250 +0,0 @@
/* vim: set ts=2 sw=2 et tw=80: */
/* Reset some basic elements */
body, h1, h2, h3, h4, h5, h6, p, blockquote, pre, hr, dl, dd, ol, ul, figure { margin: 0; padding: 0; }
/* Basic styling */
html { font-weight: 200; font-size: 15px; line-height: 1.5; font-family: monospace; color: #222; background-color: #EEE; }
/* Images */
img { max-width: 100%; vertical-align: middle; }
/* Lists */
ul, ol { margin-left: 30px; }
/* Disable margin for lists */
li > ul, li > ol { margin-bottom: 0; }
/* Headings */
h2, h3, h4, h5, h6 { font-weight: 200; text-decoration: underline; }
/* Links */
a { color: #FF6000; text-decoration: none; font-weight: bold; }
a:hover { text-decoration: underline; }
/** Blockquotes */
blockquote { color: #222; background: #EEE; border-left: 4px solid #FF6000; letter-spacing: -1px; font-style: italic; margin: 1rem 0; padding: 1em; }
blockquote > :last-child { margin-bottom: 0; }
/* do not put padding around the table with line numbers and the code */
code table { margin: -8px -12px; }
pre table.rouge-table td { padding: 0; }
pre { padding: 8px 12px; overflow-x: auto; }
pre > code { border: 0; padding-right: 0; padding-left: 0; }
/* pull a nice monospace font from the internets, plus set font and background */
pre, code { font-size: 0.95rem; background: #EEE; }
/* Disable borders between line numbers and code when line numbers are shown */
code .rouge-table, code .rouge-table td { border: 0; border-radius: 0; }
code .rouge-table { border-spacing: 0; border-collapse: collapse; }
/** Basic layout rules */
/* Padding for the main content in the page */
.container { padding: .4rem 2em; }
/* Header sizes */
/** General style for the content inside main */
/* separate article metadata to the article itself with some space */
article .post-header { margin-bottom: 3rem; }
/* put some space at the end of each article and at the end of each section */
main article, main section { margin-bottom: 2rem; }
/* justify text */
p { text-align: justify; }
/* put a space between paragraphs and images */
p, figure { margin-top: 1.2rem; }
/* the first paragraph has no space at the top (since that is provided by either main or h? */
p:first-child { margin-top: 0; }
/* make strongly emphasized elements REALLY STRONG */
strong { background: #FAA; }
/* vim: set ts=2 sw=2 et tw=80: */
body { background-color: #EEE; font-family: 'IBM Plex Mono', monospace; display: flex; min-height: 100vh; flex-direction: column; }
main { flex: 1 0 auto; }
.navbar-list .navbar-item { text-transform: uppercase; font-weight: 400; margin: 1em; }
ul.navbar-list { margin-bottom: 2rem; }
.header { border-bottom: 3px solid #FF6000; background: #222; color: #EEE; }
.header .head.navbar { display: flex; }
.header .head.navbar h1 { flex: 2; font-size: 1.5rem; display: inline; margin: 0; padding: 0; }
.header .head.navbar h1 a { color: white; }
.header .head.navbar .links { white-space: nowrap; text-align: right; }
.header .head.navbar .links a { text-transform: uppercase; display: inline-block; padding: .25rem .5rem; }
.header .head.navbar .links a:first-child { padding-left: 0; }
.header .head.navbar .links a:last-child { padding-right: 0; }
.homequote { display: flex; background: #222; color: #EEE; align-items: stretch; margin-bottom: 1rem; }
.homequote figure { margin: 0; flex: 0; display: flex; align-items: center; min-width: 300px; background: black; }
.homequote .quote { border-left: 3px dotted #FF6000; flex: 1; padding: 1rem 1.5rem; }
@media (max-width: 700px) { .navbar-list .navbar-item { width: calc(100% - 2em); } }
ul.post-list, ul.navbar-list { list-style-type: none; margin-left: 0; margin-right: 0; }
ul.post-list li { padding-top: 2rem; }
ul.post-list li:first-child { padding-top: 0; }
footer { padding: .5rem; display: flex; justify-content: space-between; border-top: 3px solid #FF6000; background: #222; color: #EEE; }
footer .author { font-size: 1rem; text-align: right; }
footer .icons { text-align: center; flex: 0; white-space: nowrap; }
footer .icons .icon { display: inline-table; background: #EEE; color: #222; width: 2.5em; height: 2.5em; text-align: center; line-height: 2.5em; margin: .25em; cursor: pointer; }
.container { padding-top: 1rem; padding-bottom: 1rem; }
/* Utility class for centering block elements */
.block-center { display: block; margin: auto; }
/** Syntax highlighting styles */
.highlight { background: #EEE; border: 3px solid #DDD; }
.highlighter-rouge .highlight { background: #eef; }
.highlight td.code > pre { background: #222; }
.highlight pre.lineno { background: #111; text-align: right; }
.highlight .c { color: #777; font-style: italic; }
.highlight .err { color: #a61717; background-color: #e3d2d2; }
.highlight .k { font-weight: bold; }
.highlight .o { font-weight: bold; }
.highlight .cm { color: #998; font-style: italic; }
.highlight .cp { color: #999; font-weight: bold; }
.highlight .c1 { color: #998; font-style: italic; }
.highlight .cs { color: #999; font-weight: bold; font-style: italic; }
.highlight .gd { color: #000; background-color: #fdd; }
.highlight .gd .x { color: #000; background-color: #faa; }
.highlight .ge { font-style: italic; }
.highlight .gr { color: #a00; }
.highlight .gh { color: #999; }
.highlight .gi { color: #000; background-color: #dfd; }
.highlight .gi .x { color: #000; background-color: #afa; }
.highlight .go { color: #888; }
.highlight .gp { color: #555; }
.highlight .gs { font-weight: bold; }
.highlight .gu { color: #aaa; }
.highlight .gt { color: #a00; }
.highlight .kc { font-weight: bold; }
.highlight .kd { font-weight: bold; }
.highlight .kp { font-weight: bold; }
.highlight .kr { font-weight: bold; }
.highlight .kt { color: #458; font-weight: bold; }
.highlight .m { color: #099; }
.highlight .s { color: #d14; }
.highlight .na { color: #008080; }
.highlight .nb { color: #00a6d3; }
.highlight .nc { color: #458; font-weight: bold; }
.highlight .no { color: #008080; }
.highlight .ni { color: #800080; }
.highlight .ne { color: #900; font-weight: bold; }
.highlight .nf { color: #900; font-weight: bold; }
.highlight .nn { color: #555; }
.highlight .nt { color: #0000d0; }
.highlight .nv { color: #0BB; }
.highlight .ow { font-weight: bold; }
.highlight .w { color: #bbb; }
.highlight .mf { color: #099; }
.highlight .mh { color: #099; }
.highlight .mi { color: #099; }
.highlight .mo { color: #099; }
.highlight .sb { color: #f54; }
.highlight .sc { color: #f54; }
.highlight .sd { color: #f54; }
.highlight .s2 { color: #f54; }
.highlight .se { color: #f54; }
.highlight .sh { color: #f54; }
.highlight .si { color: #f54; }
.highlight .sx { color: #f54; }
.highlight .sr { color: #009926; }
.highlight .s1 { color: #f54; }
.highlight .ss { color: #990073; }
.highlight .bp { color: #999; }
.highlight .vc { color: #008080; }
.highlight .vg { color: #008080; }
.highlight .vi { color: #008080; }
.highlight .il { color: #099; }
/*# sourceMappingURL=main.css.map */

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,341 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>maggioni.xyz</title>
<description>Eat polenta and do not counter-aim!
</description>
<link>https://maggioni.xyz/</link>
<atom:link href="https://maggioni.xyz/feed.xml" rel="self" type="application/rss+xml"/>
<pubDate>Fri, 22 Jan 2021 18:48:15 +0100</pubDate>
<lastBuildDate>Fri, 22 Jan 2021 18:48:15 +0100</lastBuildDate>
<generator>Jekyll v4.2.0</generator>
<item>
<title>How to rickroll people that try to run &quot;rm -rf&quot; on your system</title>
<description>&lt;strong&gt;
WARNING: The method showed here could not prevent the actual execution of &quot;rm -rf&quot; if the &quot;UNIX vandal&quot; is clever enough. Proceed at your own risk, and make backups!
&lt;/strong&gt;
&lt;p&gt;
I like Rick Astley late 80's songs, and you can see them here in my Spotify:
&lt;/p&gt;
&lt;p&gt;
&lt;img
src=&quot;/images/spotify_rickastley.png&quot;
alt=&quot;My Spotify with a bunch of Rick Astley songs&quot;&gt;
&lt;/p&gt;
&lt;p&gt;
I like rickrolling people too, especially if they are trying to delete my entire
&lt;code&gt;/home&lt;/code&gt; directory or, even worse, &lt;code&gt;/&lt;/code&gt;. Since I learned
how to use the &lt;code&gt;alias&lt;/code&gt; 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.
&lt;/p&gt;
&lt;p&gt;
The method that I will show will lock any &lt;code&gt;rm&lt;/code&gt; command runned in
both recursive and force mode, so &lt;code&gt;rm -rf&lt;/code&gt;, &lt;code&gt;rm -f -r&lt;/code&gt;
and &lt;code&gt;rm -r --force&lt;/code&gt; are all blocked, even if they are runned with
&lt;code&gt;sudo&lt;/code&gt;. I am going to alias the rm command in
&lt;code&gt;/etc/profile&lt;/code&gt;, &lt;code&gt;/etc/bash.bashrc&lt;/code&gt; and in
&lt;code&gt;/etc/zsh/zshrc&lt;/code&gt; (I am a zsh user) so that the rickroll will be
possible from all users, even root and the ones with a brand new
&lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt;. Here is the code I appended to
those files:
&lt;/p&gt;
&lt;p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;alias rm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/bin/rmAlias
&lt;span class=&quot;nb&quot;&gt;alias sudo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'sudo '&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# this enables aliases in sudo, see http://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
Since &lt;code&gt;alias&lt;/code&gt; is not able to control the flags of the aliases (see
&lt;a href=&quot;http://apple.stackexchange.com/questions/50963/how-do-i-add-a-flag-to-an-alias&quot;&gt;here&lt;/a&gt;, we are going to redirect each call of &lt;code&gt;rm&lt;/code&gt; to
&lt;code&gt;/bin/rmAlias&lt;/code&gt;, that would run the command if it is safe. I did
not use a function because it is a bit tricky to make that work with
&lt;code&gt;sudo&lt;/code&gt;. So, let's see the code I put in &lt;code&gt;rmAlias&lt;/code&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#! /bin/bash&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Rickroll whoever tries to desert this system, even root.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# To achieve this, set the appropriate aliases even in /etc/profile and similars.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Video played when rickrolling&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;ROLLVIDEO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/opt/anti-rm/serious-video.mkv &lt;span class=&quot;c&quot;&gt;# it's just Never Gonna Give You Up on my system, but be free to customize this!&lt;/span&gt;
rickroll&lt;span class=&quot;o&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Never gonna desert this system...&quot;&lt;/span&gt;
xdg-open &lt;span class=&quot;nv&quot;&gt;$ROLLVIDEO&lt;/span&gt; 2&amp;gt;&amp;amp;1 &amp;amp;
&lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;0
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;getopts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;:rf-&quot;&lt;/span&gt; opt&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Prevent '--force' to be detected as -r and -f&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$opt&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;OPTIND&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$OPTIND&lt;/span&gt;+1
&lt;span class=&quot;k&quot;&gt;continue
fi
if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$opt&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;r&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$opt&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;f&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$opt&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;continue
elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$opt&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
&lt;/span&gt;rickroll
&lt;span class=&quot;k&quot;&gt;fi
fi
done
for &lt;/span&gt;var &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;do
if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$var&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--force&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tmp&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;r&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
&lt;/span&gt;rickroll
&lt;span class=&quot;k&quot;&gt;fi
done&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# If it's safe, just run rm&lt;/span&gt;
/bin/rm &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$?&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
It may look messy to a &lt;em&gt;UNIX&lt;/em&gt; guy more experienced than me, but it
works. The &lt;code&gt;getopts&lt;/code&gt; built-in sees if both the &lt;code&gt;-r&lt;/code&gt; and
the &lt;code&gt;-f&lt;/code&gt; flags are used and, if so, it starts
&lt;code&gt;rickroll()&lt;/code&gt;, which opens with &lt;code&gt;xdg-open&lt;/code&gt; that amazing
clip from &lt;em&gt;RickAstleyVEVO&lt;/em&gt;. From line 30 and below, the script checks
if the &lt;code&gt;--force&lt;/code&gt; flag is used instead of &lt;code&gt;-f&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
Let's give execution permissions to the script we have just created:
&lt;/p&gt;
&lt;p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# chmod +x /bin/rmAlias&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
Restart your shell, and enjoy. If you want to test safely, I suggest trying
to run &lt;code&gt;rm -rf&lt;/code&gt; with no folders or a nonexistant one, since this
script stops even these commands.
&lt;/p&gt;
&lt;p&gt;
If you want even more security, you can rename this script to
&lt;code&gt;/bin/rm&lt;/code&gt; 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...
&lt;/p&gt;
</description>
<pubDate>Thu, 28 Jul 2016 16:00:00 +0200</pubDate>
<link>https://maggioni.xyz/linux/2016/07/28/how-to-rickroll-people-launching-rm-rf-on-your-system.html</link>
<guid isPermaLink="true">https://maggioni.xyz/linux/2016/07/28/how-to-rickroll-people-launching-rm-rf-on-your-system.html</guid>
<category>linux</category>
</item>
<item>
<title>Installing Gentoo on a Lenovo ThinkPad X60s</title>
<description>&lt;p&gt;
Currently, my only laptop is a
&lt;a href=&quot;http://www.thinkwiki.org/wiki/Category:X60s&quot;&gt;IBM/Lenovo ThinkPad
X60s&lt;/a&gt;, a top line &lt;em&gt;ultrabook&lt;/em&gt; from 2006 that features:
&lt;ul&gt;
&lt;li&gt;An Intel Core Duo L2400 dual core 32 bit CPU, clocked at 1.66 Ghz;&lt;/li&gt;
&lt;li&gt;2GB of RAM;&lt;/li&gt;
&lt;li&gt;60GB of SATA1 hard drive;&lt;/li&gt;
&lt;li&gt;Wifi, Bluetooth, trackpoint mouse only, 56k modem, and a decent set of
I/0 ports (including a CardBus slot!).&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img
src=&quot;/images/thinkpad1.jpg&quot;
alt=&quot;An image of the ThinkPad X60s&quot;&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img
src=&quot;/images/thinkpad2.jpg&quot;
alt=&quot;Another image of the ThinkPad X60s&quot;&gt;
&lt;/p&gt;
&lt;p&gt;
This machine had an installation on &lt;em&gt;Arch Linux&lt;/em&gt;, and I was using it
for school stuff. It runned smoothly &lt;em&gt;KDE5&lt;/em&gt;, &lt;em&gt;Atom&lt;/em&gt; (great
editor, I am using it to write this article), and it was usable even with
&lt;em&gt;PhpStorm&lt;/em&gt;. Pretty impressive for such an old thing, right?
&lt;/p&gt;
&lt;p&gt;
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.
&lt;/p&gt;
&lt;p&gt;
I followed the &lt;a href=&quot;https://wiki.gentoo.org/wiki/Handbook:Main_Page&quot;&gt;
installation guide&lt;/a&gt; without any problem until I had to &lt;em&gt;emerge&lt;/em&gt;
and install 309 packets from my &lt;code&gt;@world&lt;/code&gt; set: it took 15 hours!
The compilation of &lt;code&gt;cmake&lt;/code&gt; crashed because of memory starvation,
and so I had to use a spare USB stick as swap (the root file system was not
resizable as it was JFS). After some research and a couple of seconds in
&lt;code&gt;top&lt;/code&gt; I discovered that
&lt;a href=&quot;https://en.wikipedia.org/wiki/Physical_Address_Extension&quot;&gt;PAE&lt;/a&gt;
was not implemented in the install disk kernel. &lt;strong&gt;TIP:&lt;/strong&gt; if you
want to use a nicer install enviroment, use the &lt;em&gt;Arch&lt;/em&gt; ISO. With
&lt;em&gt;Gentoo&lt;/em&gt;, the initialisation of the file system is made with a
&lt;a href=&quot;https://wiki.gentoo.org/wiki/Stage_tarball#Stage_3&quot;&gt;&lt;em&gt;stage 3
tarball&lt;/em&gt;&lt;/a&gt; and not by tools like
&lt;a href=&quot;https://wiki.archlinux.org/index.php/beginners'_guide#Install_the_base_packages&quot;&gt;
&lt;code&gt;pacstrap&lt;/code&gt;&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I had another problem with &lt;code&gt;make menuconfig&lt;/code&gt;, the tool used to
specify what features add or remove in your compiled from source Linux kernel.
The &lt;code&gt;ncurses&lt;/code&gt; 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 &lt;code&gt;ARCH&lt;/code&gt; variable by your own:
&lt;/p&gt;
&lt;p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# make ARCH=i386 menuconfig&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# make ARCH=i386&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# make ARCH=i386 install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
At the end, I made it! I only have a base install, but i can show you
&lt;code&gt;screenfetch&lt;/code&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;img
src=&quot;/images/screenfetch.jpg&quot;
alt=&quot;The laptop running 'screenfetch'&quot;&gt;
&lt;/p&gt;
&lt;p&gt;
I have not installed &lt;em&gt;Gentoo&lt;/em&gt; in dual boot because I did not figure
out how to switch my bluetooth dongle in HID mode yet, so I can't select the
OS with &lt;code&gt;rEFInd&lt;/code&gt;. Hope this rambling was, if not useful, at least
entertaining!
&lt;/p&gt;
</description>
<pubDate>Tue, 12 Jul 2016 13:00:00 +0200</pubDate>
<link>https://maggioni.xyz/linux/2016/07/12/installing-gentoo-on-a-thinkpad-x60s.html</link>
<guid isPermaLink="true">https://maggioni.xyz/linux/2016/07/12/installing-gentoo-on-a-thinkpad-x60s.html</guid>
<category>linux</category>
</item>
<item>
<title>Get a Bluetooth keyboard work with Arch Linux</title>
<description>&lt;p&gt;
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 &lt;code&gt;bluez&lt;/code&gt; and &lt;code&gt;bluez-utils&lt;/code&gt; 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 &lt;code&gt;plasmashell&lt;/code&gt; loaded, leaving me without keyboard during the SDDM login screen and, of course, during a non-graphical session.
&lt;/p&gt;
&lt;p&gt;
As usual, i've searched help in the ArchWiki, founding &lt;a href=&quot;https://wiki.archlinux.org/index.php/Bluetooth_keyboard&quot;&gt;this&lt;/a&gt; article. With that, i've succesfully reconnected my Bluetooth keyboard using the &lt;code&gt;bluetoothctl&lt;/code&gt; utility. The next step was configuring the service for auto connection during boot. I've created the &lt;code&gt;btkbd.conf&lt;/code&gt; and the &lt;code&gt;btkbd.service&lt;/code&gt; files, enabling the last one with systemd. Let's give a look to the service file:
&lt;/p&gt;
&lt;p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Unit]
&lt;span class=&quot;nv&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;systemd Unit to automatically start a Bluetooth keyboard
&lt;span class=&quot;nv&quot;&gt;Documentation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://wiki.archlinux.org/index.php/Bluetooth_Keyboard
&lt;span class=&quot;nv&quot;&gt;Requires&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;dbus-org.bluez.service
&lt;span class=&quot;nv&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;dbus-org.bluez.service
&lt;span class=&quot;nv&quot;&gt;ConditionPathExists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/btkbd.conf
&lt;span class=&quot;nv&quot;&gt;ConditionPathExists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/bin/hcitool
&lt;span class=&quot;nv&quot;&gt;ConditionPathExists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/bin/hciconfig
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Service]
&lt;span class=&quot;nv&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;oneshot
&lt;span class=&quot;nv&quot;&gt;EnvironmentFile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/etc/btkbd.conf
&lt;span class=&quot;nv&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/bin/hciconfig &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;HCIDEVICE&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; up
&lt;span class=&quot;c&quot;&gt;# ignore errors on connect, spurious problems with bt?&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# so start next command with -&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;-/usr/bin/hcitool cc &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BTKBDMAC&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Install]
&lt;span class=&quot;nv&quot;&gt;WantedBy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;multi-user.target
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
Line 13 enables the Bluetooth dongle, and line 16 connects it to the keyboard we gave the mac address in &lt;code&gt;/etc/btkbd.conf&lt;/code&gt;. This should work flawlessly, right? Of course it doesn't. The service starts before the &lt;code&gt;dbus-org.bluez.service&lt;/code&gt; 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:
&lt;/p&gt;
&lt;p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Unit]
&lt;span class=&quot;nv&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;systemd Unit to automatically start a Bluetooth keyboard
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Service]
&lt;span class=&quot;nv&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;oneshot
&lt;span class=&quot;nv&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/bin/hciconfig hci0 up
&lt;span class=&quot;nv&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/bin/hcitool cc 00:11:22:33:44:55
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Install]
&lt;span class=&quot;nv&quot;&gt;WantedBy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;bluetooth.target
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
This incredibly worked. I think the problem was that &lt;code&gt;multi-user.target&lt;/code&gt; that needs to be reached earlier than &lt;code&gt;bluetooth.target&lt;/code&gt;. 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 &lt;code&gt;WantedBy=&lt;/code&gt;. Currently I haven't an ArchWiki account nor a forum one, but as soon as I'll register I'll correct the article.
&lt;/p&gt;
&lt;p&gt;
Last thing: I discovered that my Bluetooth dongle is CSR 8510 A10 based so expect some ramblings about &lt;a href=&quot;http://www.0xf8.org/2014/02/the-crux-of-finding-a-hid-proxy-capable-usb-bluetooth-adapter/&quot;&gt;hid proxy&lt;/a&gt;.
&lt;/p&gt;
</description>
<pubDate>Thu, 07 Jul 2016 14:49:18 +0200</pubDate>
<link>https://maggioni.xyz/linux/2016/07/07/get-a-bluetooth-keyboard-work-with-arch.html</link>
<guid isPermaLink="true">https://maggioni.xyz/linux/2016/07/07/get-a-bluetooth-keyboard-work-with-arch.html</guid>
<category>linux</category>
</item>
</channel>
</rss>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 KiB

View File

@ -1,128 +0,0 @@
<!-- vim: set ts=2 sw=2 et tw=80: -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>maggioni.xyz</title>
<meta name="description" content="Eat polenta and do not counter-aim!
">
<link rel="stylesheet" href="/css/main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://maggioni.xyz/">
<link rel="alternate" type="application/rss+xml" title="maggioni.xyz" href="https://maggioni.xyz/feed.xml">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<script src="https://rawgit.com/snaptortoise/konami-js/master/konami.js"></script>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
</head>
<body>
<header class="header container">
<nav class="head navbar">
<h1 class="title container"><a href="/">maggioni.xyz</a></h1>
<!-- vim: set ts=2 sw=2 et tw=80: -->
<div class="links">
<a href="/blog/">Blog</a>
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>
</section>
</header>
<main class="container">
<div class="homequote">
<figure>
<img width="300" height="460" src="images/claudio.jpg">
</figure>
<div class="quote"><p>
I once read a Linus Torvalds quote comparing computer
science to physics, stating that <blockquote><cite>[...] in physics you're
supposed to figure
out how the world is made up, in computer science you create the
world.</cite></blockquote>
</p><p> Hello, my name is Claudio Maggioni, and I have been a passionate
"world builder" for 7 years. </p><p> Since when I began high school, I
meddled with software development, developing a creative mindset and an
interest in problem solving. Since then, I have always been at least in part a
self-taught student of computer science, satisfying my curiosity for topics
that were not covered in general school curriculum. </p><p> My expertise
includes web development, mobile application development of multiplatform
applications, a passion for functional programming, and DevOps skills for
Linux systems. </p><p> Reaching the end of my undergraduate studies in
computer science, I am currently seeking job opportunities to follow at the
end of my studies, eager to apply my skills in a corporate setting.
</p></div>
</div>
<div class="home">
<section>
<h2>Self-hosted services</h2>
<p> Listed below are some websites served by this server: </p>
<ul>
<li><a href="https://git.maggioni.xyz">Gitea</a>, a private Git HTTP
frontend;</li>
<li><a href="https://cloud.maggioni.xyz"><code>maggioni.xyz</code>
cloud</a>, a private <em>Nextcloud</em> instance;</li>
</ul>
</section>
</div>
<!-- vim: set ts=2 sw=2 et tw=80: -->
</main>
<footer class="site-footer container">
<div class="icons">
<a target="_blank" class="icon" href="https://tea.maggioni.xyz/maggicl"><i class="fa fa-git"></i></a>
<a target="_blank" class="icon" href="https://github.com/maggicl"><i class="fa fa-github"></i></a>
<a target="_blank" class="icon" href="https://gitlab.com/maggicl"><i class="fa fa-gitlab"></i></a>
<a target="_blank" class="icon" href="https://www.linkedin.com/in/claudio-maggioni/"><i class="fa fa-linkedin"></i></a>
</div>
<div class="author">
<i class="fa fa-cc" aria-hidden="true"></i>
Claudio Maggioni
<script>
document.write((new Date()).getFullYear());
</script>
<noscript>2021</noscript><br>
Content under
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
CC BY-NC-SA 4.0</a>
</div>
</footer>
</body>
</html>

View File

@ -1,187 +0,0 @@
<!-- vim: set ts=2 sw=2 et tw=80: -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Get a Bluetooth keyboard work with Arch Linux</title>
<meta name="description" content="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 reboo...">
<link rel="stylesheet" href="/css/main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://maggioni.xyz/linux/2016/07/07/get-a-bluetooth-keyboard-work-with-arch.html">
<link rel="alternate" type="application/rss+xml" title="maggioni.xyz" href="https://maggioni.xyz/feed.xml">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<script src="https://rawgit.com/snaptortoise/konami-js/master/konami.js"></script>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
</head>
<body>
<header class="header container">
<nav class="head navbar">
<h1 class="title container"><a href="/">maggioni.xyz</a></h1>
<!-- vim: set ts=2 sw=2 et tw=80: -->
<div class="links">
<a href="/blog/">Blog</a>
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>
</section>
</header>
<main class="container">
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<h2 class="post-title" itemprop="name headline">Get a Bluetooth keyboard work with Arch Linux</h2>
<h4 class="post-meta"><time datetime="2016-07-07T14:49:18+02:00" itemprop="datePublished">Jul 7, 2016</time></h4>
</header>
<div class="post-content" itemprop="articleBody">
<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>bluez</code> and <code>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>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>bluetoothctl</code> utility. The next step was configuring the service for auto connection during boot. I've created the <code>btkbd.conf</code> and the <code>btkbd.service</code> files, enabling the last one with systemd. Let's give a look to the service file:
</p>
<p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre><span class="o">[</span>Unit]
<span class="nv">Description</span><span class="o">=</span>systemd Unit to automatically start a Bluetooth keyboard
<span class="nv">Documentation</span><span class="o">=</span>https://wiki.archlinux.org/index.php/Bluetooth_Keyboard
<span class="nv">Requires</span><span class="o">=</span>dbus-org.bluez.service
<span class="nv">After</span><span class="o">=</span>dbus-org.bluez.service
<span class="nv">ConditionPathExists</span><span class="o">=</span>/etc/btkbd.conf
<span class="nv">ConditionPathExists</span><span class="o">=</span>/usr/bin/hcitool
<span class="nv">ConditionPathExists</span><span class="o">=</span>/usr/bin/hciconfig
<span class="o">[</span>Service]
<span class="nv">Type</span><span class="o">=</span>oneshot
<span class="nv">EnvironmentFile</span><span class="o">=</span>/etc/btkbd.conf
<span class="nv">ExecStart</span><span class="o">=</span>/usr/bin/hciconfig <span class="k">${</span><span class="nv">HCIDEVICE</span><span class="k">}</span> up
<span class="c"># ignore errors on connect, spurious problems with bt?</span>
<span class="c"># so start next command with -</span>
<span class="nv">ExecStart</span><span class="o">=</span>-/usr/bin/hcitool cc <span class="k">${</span><span class="nv">BTKBDMAC</span><span class="k">}</span>
<span class="o">[</span>Install]
<span class="nv">WantedBy</span><span class="o">=</span>multi-user.target
</pre></td></tr></tbody></table></code></pre></figure>
</p>
<p>
Line 13 enables the Bluetooth dongle, and line 16 connects it to the keyboard we gave the mac address in <code>/etc/btkbd.conf</code>. This should work flawlessly, right? Of course it doesn't. The service starts before the <code>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>
<p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre><span class="o">[</span>Unit]
<span class="nv">Description</span><span class="o">=</span>systemd Unit to automatically start a Bluetooth keyboard
<span class="o">[</span>Service]
<span class="nv">Type</span><span class="o">=</span>oneshot
<span class="nv">ExecStart</span><span class="o">=</span>/bin/hciconfig hci0 up
<span class="nv">ExecStart</span><span class="o">=</span>/bin/hcitool cc 00:11:22:33:44:55
<span class="o">[</span>Install]
<span class="nv">WantedBy</span><span class="o">=</span>bluetooth.target
</pre></td></tr></tbody></table></code></pre></figure>
</p>
<p>
This incredibly worked. I think the problem was that <code>multi-user.target</code> that needs to be reached earlier than <code>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>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>
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>
</div>
</article>
</main>
<footer class="site-footer container">
<div class="icons">
<a target="_blank" class="icon" href="https://tea.maggioni.xyz/maggicl"><i class="fa fa-git"></i></a>
<a target="_blank" class="icon" href="https://github.com/maggicl"><i class="fa fa-github"></i></a>
<a target="_blank" class="icon" href="https://gitlab.com/maggicl"><i class="fa fa-gitlab"></i></a>
<a target="_blank" class="icon" href="https://www.linkedin.com/in/claudio-maggioni/"><i class="fa fa-linkedin"></i></a>
</div>
<div class="author">
<i class="fa fa-cc" aria-hidden="true"></i>
Claudio Maggioni
<script>
document.write((new Date()).getFullYear());
</script>
<noscript>2021</noscript><br>
Content under
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
CC BY-NC-SA 4.0</a>
</div>
</footer>
</body>
</html>

View File

@ -1,192 +0,0 @@
<!-- vim: set ts=2 sw=2 et tw=80: -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Installing Gentoo on a Lenovo ThinkPad X60s</title>
<meta name="description" content=" Currently, my only laptop is a IBM/Lenovo ThinkPad X60s, a top line ultrabook from 2006 that features: An Intel Core Duo L2400 dual core 32 bit ...">
<link rel="stylesheet" href="/css/main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://maggioni.xyz/linux/2016/07/12/installing-gentoo-on-a-thinkpad-x60s.html">
<link rel="alternate" type="application/rss+xml" title="maggioni.xyz" href="https://maggioni.xyz/feed.xml">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<script src="https://rawgit.com/snaptortoise/konami-js/master/konami.js"></script>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
</head>
<body>
<header class="header container">
<nav class="head navbar">
<h1 class="title container"><a href="/">maggioni.xyz</a></h1>
<!-- vim: set ts=2 sw=2 et tw=80: -->
<div class="links">
<a href="/blog/">Blog</a>
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>
</section>
</header>
<main class="container">
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<h2 class="post-title" itemprop="name headline">Installing Gentoo on a Lenovo ThinkPad X60s</h2>
<h4 class="post-meta"><time datetime="2016-07-12T13:00:00+02:00" itemprop="datePublished">Jul 12, 2016</time></h4>
</header>
<div class="post-content" itemprop="articleBody">
<p>
Currently, my only laptop is a
<a href="http://www.thinkwiki.org/wiki/Category:X60s">IBM/Lenovo ThinkPad
X60s</a>, a top line <em>ultrabook</em> from 2006 that features:
<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>
</ul>
</p>
<p>
<img
src="/images/thinkpad1.jpg"
alt="An image of the ThinkPad X60s">
</p>
<p>
<img
src="/images/thinkpad2.jpg"
alt="Another image of the ThinkPad X60s">
</p>
<p>
This machine had an installation on <em>Arch Linux</em>, and I was using it
for school stuff. It runned smoothly <em>KDE5</em>, <em>Atom</em> (great
editor, I am using it to write this article), and it was usable even with
<em>PhpStorm</em>. 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 <em>emerge</em>
and install 309 packets from my <code>@world</code> set: it took 15 hours!
The compilation of <code>cmake</code> crashed because of memory starvation,
and so I had to use a spare USB stick as swap (the root file system was not
resizable as it was JFS). After some research and a couple of seconds in
<code>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. <strong>TIP:</strong> if you
want to use a nicer install enviroment, use the <em>Arch</em> ISO. With
<em>Gentoo</em>, the initialisation of the file system is made with a
<a href="https://wiki.gentoo.org/wiki/Stage_tarball#Stage_3"><em>stage 3
tarball</em></a> and not by tools like
<a href="https://wiki.archlinux.org/index.php/beginners'_guide#Install_the_base_packages">
<code>pacstrap</code></a>.
</p>
<p>
I had another problem with <code>make menuconfig</code>, the tool used to
specify what features add or remove in your compiled from source Linux kernel.
The <code>ncurses</code> 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>ARCH</code> variable by your own:
</p>
<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>
<p>
At the end, I made it! I only have a base install, but i can show you
<code>screenfetch</code>:
</p>
<p>
<img
src="/images/screenfetch.jpg"
alt="The laptop running 'screenfetch'">
</p>
<p>
I have not installed <em>Gentoo</em> in dual boot because I did not figure
out how to switch my bluetooth dongle in HID mode yet, so I can't select the
OS with <code>rEFInd</code>. Hope this rambling was, if not useful, at least
entertaining!
</p>
</div>
</article>
</main>
<footer class="site-footer container">
<div class="icons">
<a target="_blank" class="icon" href="https://tea.maggioni.xyz/maggicl"><i class="fa fa-git"></i></a>
<a target="_blank" class="icon" href="https://github.com/maggicl"><i class="fa fa-github"></i></a>
<a target="_blank" class="icon" href="https://gitlab.com/maggicl"><i class="fa fa-gitlab"></i></a>
<a target="_blank" class="icon" href="https://www.linkedin.com/in/claudio-maggioni/"><i class="fa fa-linkedin"></i></a>
</div>
<div class="author">
<i class="fa fa-cc" aria-hidden="true"></i>
Claudio Maggioni
<script>
document.write((new Date()).getFullYear());
</script>
<noscript>2021</noscript><br>
Content under
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
CC BY-NC-SA 4.0</a>
</div>
</footer>
</body>
</html>

View File

@ -1,218 +0,0 @@
<!-- vim: set ts=2 sw=2 et tw=80: -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>How to rickroll people that try to run &quot;rm -rf&quot; on your system</title>
<meta name="description" content="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 ...">
<link rel="stylesheet" href="/css/main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://maggioni.xyz/linux/2016/07/28/how-to-rickroll-people-launching-rm-rf-on-your-system.html">
<link rel="alternate" type="application/rss+xml" title="maggioni.xyz" href="https://maggioni.xyz/feed.xml">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<script src="https://rawgit.com/snaptortoise/konami-js/master/konami.js"></script>
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
</head>
<body>
<header class="header container">
<nav class="head navbar">
<h1 class="title container"><a href="/">maggioni.xyz</a></h1>
<!-- vim: set ts=2 sw=2 et tw=80: -->
<div class="links">
<a href="/blog/">Blog</a>
<a href="/feed.xml">RSS</a>
<a href="/cv.html">CV</a>
<a href="https://git.maggioni.xyz">Git</a>
<a href="https://cloud.maggioni.xyz">Cloud</a>
</div>
</section>
</header>
<main class="container">
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<h2 class="post-title" itemprop="name headline">How to rickroll people that try to run "rm -rf" on your system</h2>
<h4 class="post-meta"><time datetime="2016-07-28T16:00:00+02:00" itemprop="datePublished">Jul 28, 2016</time></h4>
</header>
<div class="post-content" itemprop="articleBody">
<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>
I like Rick Astley late 80's songs, and you can see them here in my Spotify:
</p>
<p>
<img
src="/images/spotify_rickastley.png"
alt="My Spotify with a bunch of Rick Astley songs">
</p>
<p>
I like rickrolling people too, especially if they are trying to delete my entire
<code>/home</code> directory or, even worse, <code>/</code>. Since I learned
how to use the <code>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 will show will lock any <code>rm</code> command runned in
both recursive and force mode, so <code>rm -rf</code>, <code>rm -f -r</code>
and <code>rm -r --force</code> are all blocked, even if they are runned with
<code>sudo</code>. I am going to alias the rm command in
<code>/etc/profile</code>, <code>/etc/bash.bashrc</code> and in
<code>/etc/zsh/zshrc</code> (I am a zsh user) so that the rickroll will be
possible from all users, even root and the ones with a brand new
<code>.bashrc</code> or <code>.zshrc</code>. Here is the code I appended to
those files:
</p>
<p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">alias rm</span><span class="o">=</span>/bin/rmAlias
<span class="nb">alias 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>
<p>
Since <code>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 are going to redirect each call of <code>rm</code> to
<code>/bin/rmAlias</code>, that would run the command if it is safe. I did
not use a function because it is a bit tricky to make that work with
<code>sudo</code>. So, let's see the code I put in <code>rmAlias</code>:
</p>
<p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#! /bin/bash</span>
<span class="c"># Rickroll whoever tries to desert this system, even root.</span>
<span class="c"># To achieve this, set the appropriate aliases even in /etc/profile and similars.</span>
<span class="c"># Video played when rickrolling</span>
<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>
rickroll<span class="o">(){</span>
<span class="nb">echo</span> <span class="s2">"Never gonna desert this system..."</span>
xdg-open <span class="nv">$ROLLVIDEO</span> 2&gt;&amp;1 &amp;
<span class="nb">exit </span>0
<span class="o">}</span>
<span class="k">while </span><span class="nb">getopts</span> <span class="s2">":rf-"</span> opt<span class="p">;</span> <span class="k">do</span>
<span class="c"># Prevent '--force' to be detected as -r and -f</span>
<span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$opt</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"-"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
</span><span class="nv">OPTIND</span><span class="o">=</span><span class="nv">$OPTIND</span>+1
<span class="k">continue
fi
if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$opt</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"r"</span> <span class="o">]</span> <span class="o">||</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$opt</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"f"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$tmp</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">""</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
</span><span class="nv">tmp</span><span class="o">=</span><span class="nv">$opt</span>
<span class="k">continue
elif</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$tmp</span><span class="s2">"</span> <span class="o">!=</span> <span class="s2">"</span><span class="nv">$opt</span><span class="s2">"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
</span>rickroll
<span class="k">fi
fi
done
for </span>var <span class="k">in</span> <span class="s2">"</span><span class="nv">$@</span><span class="s2">"</span>
<span class="k">do
if</span> <span class="o">[[</span> <span class="s2">"</span><span class="nv">$var</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"--force"</span> <span class="o">&amp;&amp;</span> <span class="s2">"</span><span class="nv">$tmp</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"r"</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then
</span>rickroll
<span class="k">fi
done</span>
<span class="c"># If it's safe, just run rm</span>
/bin/rm <span class="s2">"</span><span class="nv">$@</span><span class="s2">"</span>
<span class="nb">exit</span> <span class="nv">$?</span></code></pre></figure>
</p>
<p>
It may look messy to a <em>UNIX</em> guy more experienced than me, but it
works. The <code>getopts</code> built-in sees if both the <code>-r</code> and
the <code>-f</code> flags are used and, if so, it starts
<code>rickroll()</code>, which opens with <code>xdg-open</code> that amazing
clip from <em>RickAstleyVEVO</em>. From line 30 and below, the script checks
if the <code>--force</code> flag is used instead of <code>-f</code>.
</p>
<p>
Let's give execution permissions to the script we have just created:
</p>
<p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># chmod +x /bin/rmAlias</span></code></pre></figure>
</p>
<p>
Restart your shell, and enjoy. If you want to test safely, I suggest trying
to run <code>rm -rf</code> with no folders or a nonexistant one, since this
script stops even these commands.
</p>
<p>
If you want even more security, you can rename this script to
<code>/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>
</div>
</article>
</main>
<footer class="site-footer container">
<div class="icons">
<a target="_blank" class="icon" href="https://tea.maggioni.xyz/maggicl"><i class="fa fa-git"></i></a>
<a target="_blank" class="icon" href="https://github.com/maggicl"><i class="fa fa-github"></i></a>
<a target="_blank" class="icon" href="https://gitlab.com/maggicl"><i class="fa fa-gitlab"></i></a>
<a target="_blank" class="icon" href="https://www.linkedin.com/in/claudio-maggioni/"><i class="fa fa-linkedin"></i></a>
</div>
<div class="author">
<i class="fa fa-cc" aria-hidden="true"></i>
Claudio Maggioni
<script>
document.write((new Date()).getFullYear());
</script>
<noscript>2021</noscript><br>
Content under
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
CC BY-NC-SA 4.0</a>
</div>
</footer>
</body>
</html>

View File

@ -1,41 +0,0 @@
{
"name": "App",
"icons": [
{
"src": "\/android-icon-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "\/android-icon-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "\/android-icon-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "\/android-icon-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/android-icon-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "\/android-icon-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

BIN
cv.pdf Normal file

Binary file not shown.