Stavros' Stuff Latest Posts Latest posts on Stavros' Stuff. en-us Stavros Korokithakis How to use FIDO2 USB authenticators with SSH https://www.stavros.io/posts/u2f-fido2-with-ssh/ https://www.stavros.io/posts/u2f-fido2-with-ssh/ <div class="pull-quote">Secure, easy to use, cheap: Pick three</div><p>I recently installed Ubuntu Wacky Whatever, the latest version, and I&#8217;m very excited about it shipping with SSH 8.2, which means that I can finally use hardware USB keys for secure, easy to use authentication. If securing your devices has been something you&#8217;ve wanted to easily do yourself, read on, because it&#8217;s finally happening.</p> <h2>FIDO2</h2> <p>One of the most exciting security-related developments recently has been the development of <a href="https://webauthn.guide/">WebAuthn</a> and FIDO2, which are basically euphemisms for &#8220;nice security stuff&#8221;. In summary, WebAuthn and FIDO2 aim to make it really easy to use security devices with stuff by standardizing the way the two talk to each other, and using better terms than &#8220;stuff&#8221;.</p> <p>This is great news for us, because now we can have dirt-cheap USB keys that can be used to secure all our authentication very easily, without requiring any special security knowledge. All you need to know to be completely immune to phishing, password theft, and a whole host of other ways of losing Bitcoin is to just plug your USB key in, press the little button/type your PIN/enter your fingerprint, and you&#8217;re logged in.</p> <p>What does this have to do with SSH? Very little, but Tue, 30 Jun 2020 00:30:19 +0000 Using FastAPI with Django https://www.stavros.io/posts/fastapi-with-django/ https://www.stavros.io/posts/fastapi-with-django/ <div class="pull-quote">FastAPI actually plays very well with Django</div><p>You know me, I&#8217;m a <a href="https://www.djangoproject.com/">Django</a> fan. It&#8217;s my preferred way of developing web apps, mainly because of the absolutely <em>vast</em> ecosystem of apps and libraries it has, and the fact that it is really well-designed. I love how modular it is, and how it lets you use any of the parts you like and forget about the ones you don&#8217;t want. This is going to be emphasized rather spectacularly in this article, as I&#8217;m going to do things nobody should ever have to do.</p> <p>My only issue with Django was that it never really had a good way of making APIs. I hate DRF with somewhat of a passion, I always found its API way too complicated and verbose, and never managed to grok it. Even the simplest things felt cumbersome, and the moment your API objects deviated from looking exactly like your DB models, you were in a world of hurt. I generally prefer writing a simple class-based view for my APIs, but then I don&#8217;t get automatic docs and other niceties.</p> <p>It&#8217;s no surprise, then, that when I found <a href="https://fastapi.tiangolo.com/">FastAPI</a> I was really excited, I really liked its autogenerated docs, dependency injection system, and lack of magical &#8220;request&#8221; objects or big JSON blobs. It looked very simple, well-architected and with sane defaults, and I seriously considered developing the API for my company&#8217;s next product on it, but was apprehensive about two things: It lacked Django&#8217;s ecosystem, and it didn&#8217;t have an ORM as good and well-integrated as Django&#8217;s. I would also miss Django&#8217;s admin interface a lot. Three things.</p> <p>It would have been great if FastAPI was a Django library, but I guess the asynchronicity wouldn&#8217;t have been possible. Still, there&#8217;s no reason for DRF not to have an API as nice as FastAPI&#8217;s, but there&#8217;s no helping that. A fantastical notion caught hold of me: What if I could combine FastAPI&#8217;s view serving with Django&#8217;s ORM and apps? Verily, I say unto thee, it would be rad.</p> <p>And that&#8217;s exactly what I did. Here&#8217;s how:</p> Mon, 11 May 2020 20:11:11 +0000 Make your own PCBs with a 3D printer https://www.stavros.io/posts/make-pcbs-at-home/ https://www.stavros.io/posts/make-pcbs-at-home/ <div class="pull-quote">More PCBs, less hassle</div><p>Listen, anyone can make a <span data-expounder="pcb">PCB</span> at home, it&#8217;s easy. <span data-expounded="pcb">PCBs (printed circuit boards) are those flat things with all the components that are inside all electronic devices, you&#8217;ve seen them.</span> All you need is a laser printer, some glossy magazine pages, print your circuit onto the page, use a clothes iron to transfer the toner onto your copper clad, if that doesn&#8217;t work use some water and some lacquer or something, I don&#8217;t know, I <a href="https://hackaday.com/2008/07/28/how-to-etch-a-single-sided-pcb/">stopped reading</a> at that point because the last time I saw a laser printer, a magazine and a clothes iron was in the nineties.</p> <p>Until recently, the only ways I knew to make PCBs was to practice the dark art above, to pay $10 and wait three weeks to get professional-looking PCBs from China, or to pay $60 and wait three days to get professional-looking PCBs from Europe. It was &#8220;cheap, fast, actually doable by a human person, choose two&#8221;.</p> <p>That always bugged me, it shouldn&#8217;t be like that, I have always been of the opinion that there shouldn&#8217;t be things you can&#8217;t make when you have a 3D printer, but PCBs have consistently eluded me. I yearned for them, I wanted to be able to make them at home, but it seemed impossible.</p> <p>One day, everything changed.</p> Fri, 14 Feb 2020 00:06:04 +0000 Behold: Ledonardo https://www.stavros.io/posts/behold-ledonardo/ https://www.stavros.io/posts/behold-ledonardo/ <div class="pull-quote">A revolutionary new invention that lets you take slightly different photos than before</div><p>A few years ago, I set out to reinvent photography. I didn&#8217;t have a good idea how to do this, I just knew I wanted to make something original, and combining photography with my electronics skills seemed like a good way to do that. It failed at reinventing photography, but I succeeded in writing a clickbait first sentence, and the process was lots of fun too.</p> <p>It all started one night, when I was having drinks with a friend and looking for something new to do with photography. Our conversation went something like this:</p> <ul> <li>I need to do something original with photography.</li> <li>Mmhmm.</li> <li>Maybe I could combine technology and photography to create something new, but what could it be?</li> <li>Hmm.</li> <li>I know! I&#8217;ll make a light stick thing.</li> <li>Mmm.</li> </ul> <p>The idea was great, I would use a LED strip to display images in mid-air, like those <a href="https://www.youtube.com/watch?v=4yuSBgBC35I">persistence of vision</a> displays. I could set the camera to record a long exposure, then move the strip and trace a pattern in the air. I had never seen anyone do this before, so the first thing I did was what everyone does when they have a groundbreaking idea: I searched the web to see if this already existed.</p> Tue, 01 Oct 2019 21:23:59 +0000 Seven tips for a great remote culture https://www.stavros.io/posts/seven-tips-great-remote-culture/ https://www.stavros.io/posts/seven-tips-great-remote-culture/ <div class="pull-quote">Make Remote Great Again</div><p>Did you like that clickbait title? I&#8217;ve been practicing. This article doesn&#8217;t contain seven tips because I hate listicles. It&#8217;s just a recounting of my experience working remote for fifteen years now and observations on what works and what doesn&#8217;t, but it doesn&#8217;t matter, because the amazing title has piqued your interest.</p> <p>For a bit of background, my first job was working in an office, as IT support for a construction company. I did that for three years, and then I got a remote job and never looked back. Personally, I enjoy the freedom that comes with being able to work from anywhere, and I&#8217;m lucky enough to be one of the people who can. Many of my friends have to be at their home office or a coworking space to get work done, but I can focus anywhere, which allows me to travel to another country for a week or two and work from there.</p> <p>I&#8217;m not going to go into the pros and cons of remote working, I assume they&#8217;ve been beaten into you by the myriad of other posts, since it&#8217;s a trendy topic. Instead, I&#8217;ll assume you are interested in improving your existing remote culture and I&#8217;ll detail Mon, 29 Jul 2019 16:45:38 +0000