<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Seichy's Missing Bit</title>
		<description>A blog on programing, electronics, plotters and cats.</description>
		<link>https://martianwabbit.com</link>
		<atom:link href="https://martianwabbit.com/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>Project Log: MidiFaders - ESP-32 MIDI-BLE Faders</title>
				<description>&lt;p&gt;A while back I built a BLE MIDI controller. I was never too happy with it and
had been meaning to take another stab at it.&lt;/p&gt;

&lt;p&gt;My plan is pretty simple, I want a 4 or 5 faders in a small battery-powered box.
I recently came across a TTGO display board. It brings most of what I need
onboard, bluetooth, a screen, a couple of buttons, battery management and, best
of all, a usb-c port.&lt;/p&gt;

&lt;p&gt;I knew exactly what I wanted, so I went to my parts cabinet and grabbed some
faders, and measured how many I could fit easily on that board.&lt;/p&gt;

&lt;h1 id=&quot;electrical-design&quot;&gt;Electrical Design&lt;/h1&gt;

&lt;p&gt;The electronics were pretty straightforward. I just needed all of my faders to
be connected:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/1.jpg&quot; alt=&quot;A schematic for the midi faders&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I rapidly routed a board, and proceeded to mill it.&lt;/p&gt;

&lt;h1 id=&quot;milling-a-pcb&quot;&gt;Milling a PCB&lt;/h1&gt;

&lt;p&gt;I have a small desktop CNC I use for milling PCBs at home. I don’t use it nearly
as often as I’d like but I love having it available. It’s much better than
protoboard and way more fun.&lt;/p&gt;

&lt;p&gt;I had a lot of issues milling this PCB though. It turns out most of the software
I am used to using in Ubuntu flat out doesn’t work on a Mac M1. So I had to find
solutions to some of those issues.&lt;/p&gt;

&lt;p&gt;The biggest problem was FlatCam. FlatCam is awesome and I love it but it seems
barely maintained and running it is getting harder every day. I decided to try
out alternatives. It turns out there really aren’t any.&lt;/p&gt;

&lt;p&gt;I ended up settling with &lt;a href=&quot;https://copper.carbide3d.com/&quot;&gt;Copper&lt;/a&gt;. This is a
website provided by carbide3d that allows you to upload your layers and get a
set of gcode files. You only get minimal options so I don’t think I’d use it for
anything but a one-sided PCB but it seemed acceptable.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/2.jpg&quot; alt=&quot;A picture of Carbide Copper&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;With my set of gcode files I felt ready to mill my PCB. Thankfully bCNC still
runs flawlessly on a Pi so that part of my workflow remained intact. Here’s a
quick rundown on how I usually do it (I’ll probably write a separate post to go
into it in more detail).&lt;/p&gt;

&lt;p&gt;I start by prepping a PCB blank. I clean it will alcohol and a scotch pad and
set it on the bed using double-sided tape.&lt;/p&gt;

&lt;p&gt;Next, I probe the PCB and set my working space.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/3.jpg&quot; alt=&quot;The spindle probing the pcb blank&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I the autolevel but don’t click autolevel. If you’ve used bCNC before you know
this breaks stuff.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/4.jpg&quot; alt=&quot;The resulting PCB.&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;After cleaning it up, we can do soldering. This is generally the easy part. I
leave as much space as possible around my traces, as much as 1mm if there’s
space. Soldering comes down to a lot of flux and as much solder as it takes.
I’ll usually coat parts of the PCB with the excess solder, this is probably
useless but I feel like it makes for a better connection on these homemade PCBs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/5.jpg&quot; alt=&quot;The parts inserted into the PCB before soldering.&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’ll do a quick fit check with all parts and then start soldering.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/6.jpg&quot; alt=&quot;The PCB now soldered.&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;It ended up looking pretty good.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/7.jpg&quot; alt=&quot;The PCB from the frontside.&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;firmware&quot;&gt;Firmware~&lt;/h2&gt;

&lt;p&gt;So the firmware for these things is usually the hard part. My idea was extremely
simple. Each fader should send, via bluetooth midi, a cc on a channel. These
should be modifiable from within the device. The UI would have to be something I
came up with as I went. I used the excellent arduino_midi_library with a
bluetooth transport and everything went surprisingly smoothly.&lt;/p&gt;

&lt;p&gt;In a couple of days I had implemented all menus, battery management, bluetooth
and settings. Of the features I wanted to add, I am only missing presets and a
web app to load these in. Overall I am extremely happy with how performant and
easy to use it is.&lt;/p&gt;

&lt;h2 id=&quot;case&quot;&gt;Case&lt;/h2&gt;

&lt;p&gt;The case took a couple of iterations to get right. I hadn’t done any 3d printing
in a while so I was a bit rusty.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/8.jpg&quot; alt=&quot;A 3d printer, printing the case&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;After shifting around the design a bit I came up with something that was both
easy to print and very functional.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/9.jpg&quot; alt=&quot;The different versions of the case&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;the-end-&quot;&gt;The End ~&lt;/h1&gt;

&lt;p&gt;I am very happy with the final result. It came out really clean, easy to use and
highly functional. Setting up new devices is fast and easy and since it’s
compliant it connects seamlessly with other MIDI-BLE devices, like the widi
masters.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/10.jpg&quot; alt=&quot;The final device&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/11.jpg&quot; alt=&quot;The final device&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-02-04-project-log-midifaders-esp-32-midi-ble-faders/12.jpg&quot; alt=&quot;The final device&amp;quot; &quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 04 Feb 2023 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2023/02/04/project-log-midifaders-esp-32-midi-ble-faders.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2023/02/04/project-log-midifaders-esp-32-midi-ble-faders.html</guid>
			</item>
		
			<item>
				<title>Making Softcases for Small Electronics and Cables</title>
				<description>&lt;p&gt;Wraps are my favorite way of storing small electronics. Whenever I get a new one
I’ll probably make one really quickly to store it and it’s accessories.&lt;/p&gt;

&lt;p&gt;It’s a fairly straightforward process. Start with a piece of cloth. I really
like this one, where it’s like felt on one side and like linen on the other. It
makes it so the interior is really nice and soft.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/1.jpg&quot; alt=&quot;A large piece of fabric laying on the floor&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’ll start by measuring the device I’ll be wrapping. Once I’ve got the
measurements I’ll lay my cloth on the floor and draw a rough rectangle. It’ll be
a bit wider than needed and about four times the length of the device. This will
let me wrap it comfortably a couple of times.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/2.jpg&quot; alt=&quot;A couple of lines chalked up on black felt&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’ll then cut this rectangle off.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/3.jpg&quot; alt=&quot;A small piece of fabric laying on the floor now&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’ll then fold a third of this cloth on top of itself and sew it. I got a free
sewing machine a while back (all it took was a couple of 3d printed replacement
parts to get it working but that’s a story for another day) which I use for
this.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/4.jpg&quot; alt=&quot;A sewing machine... sewing&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/5.jpg&quot; alt=&quot;A close up of the sewn case&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once that’s done I’ll flip it inside-out and sew any open borders to give it a
cleaner look.&lt;/p&gt;

&lt;p&gt;I’ll also sew a elastic on the open side so I can close it up.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/6.jpg&quot; alt=&quot;The Elastic sewn to the flap&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I am not great a sewing.&lt;/p&gt;

&lt;p&gt;I’ll then place the device inside, wrap it up and figure out where to put a
button so that it closes up cleanly.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/7.jpg&quot; alt=&quot;A button being placed.&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;Buttons are hard. I’ll do as many passes as possible because I really suck at
place them. Just doing a lot of passes will usually yield a nice looking result.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/8.jpg&quot; alt=&quot;A closeup of the button sewn into place.&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/9.jpg&quot; alt=&quot;How it looks on the insider&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/10.jpg&quot; alt=&quot;How it looks on the outside&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;It’s all about confidence. Once it’s all done, you can insert the device in and
wrap it, using the elastic as a latch.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-29-making-softcases-for-small-electronics-and-cables/11.jpg&quot; alt=&quot;A closeup of the button sewn into place.&amp;quot; &quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 29 Jan 2023 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2023/01/29/making-softcases-for-small-electronics-and-cables.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2023/01/29/making-softcases-for-small-electronics-and-cables.html</guid>
			</item>
		
			<item>
				<title>DIY Midi Cable for the OP-Z and ZM-1</title>
				<description>&lt;p&gt;I’ve been using an old Rockband Keytar as a midi controller for the longest
time. I usually take advantage of the OP-Z’s ability to be a MIDI host to use
the keytar via a midi to usb adapter. This is fairly cumbersome as I have to use
big cables and a USB-A to USB-C adapter.&lt;/p&gt;

&lt;p&gt;Last year I got myself a ZM-1 module for the OP-Z which allows me to connect
MIDI devices via a 3.5mm jack. These are fairly easy to put together and I had
all the spare parts I needed hanging around already so I decided to make a
couple.&lt;/p&gt;

&lt;p&gt;All you need is a MIDI jack, and 3.5mm jack and some cable. I used a midi jack
that already had it’s cable attached. I took this from a previous midi project
so that cut the soldering in half.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-15-diy-midi-cable-for-the-op-z-and-zm-1/1.jpg&quot; alt=&quot;The parts we&apos;ll need. A midi jack and a 3.5mm jack&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I couldn’t find documentation stating weather this cable is meant to be type a
or b or something else. So I tried wiring it as a type-A (a being the “standard”
from what I know). This didn’t work, it turns out is actually type-B. Here’s the
diagram:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-15-diy-midi-cable-for-the-op-z-and-zm-1/diagram.png&quot; alt=&quot;The diagram we&apos;ll follow, current source to tip, current
sink to the ring and shield to the sleeve &amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Some soldering later and the cable is mostly ready:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-15-diy-midi-cable-for-the-op-z-and-zm-1/2.jpg&quot; alt=&quot;The cables soldered onto the 3.5mm jack&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I used some heatshrink as strain-relief. I was also lacking the piece of plastic
that screws to the 3.5mm jack so I wrapped it in some extra heatshrink to give
it some strength. Here’s the final cable:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-15-diy-midi-cable-for-the-op-z-and-zm-1/4.jpg&quot; alt=&quot;The finished cable, now with some heatshrink&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here’s what my keytar setup looks like now:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-15-diy-midi-cable-for-the-op-z-and-zm-1/5.jpg&quot; alt=&quot;The op-z on top of my rockband keytar&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;It works flawlessly and makes for a fun little weekend project.&lt;/p&gt;
</description>
				<pubDate>Sun, 15 Jan 2023 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2023/01/15/diy-midi-cable-for-the-op-z-and-zm-1.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2023/01/15/diy-midi-cable-for-the-op-z-and-zm-1.html</guid>
			</item>
		
			<item>
				<title>Project Log: Some Sort of Guitar</title>
				<description>&lt;p&gt;I was lucky enough to be gifted an old, broken guitar.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/1.jpg&quot; alt=&quot;An image of the guitar&apos;s body&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;It was in pretty rough shape. The bridge had been bolted to the body so when it
started lifting it broke through the top.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/2.jpg&quot; alt=&quot;A closeup of the guitar&apos;s lifted bridge&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I felt that it wasn’t really worth restoring it and that I’d rather try building
something new on top of it. I was thinking that just adding a pickup would make
it a bit more interesting.&lt;/p&gt;

&lt;p&gt;I started by removing half of the top. Since I don’t care too much about the
quality, I was able to remove the lower half quite easily with a utility knife.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/3.jpg&quot; alt=&quot;A ruler on the guitar showing where I cut it through&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/4.jpg&quot; alt=&quot;The lower half of the guitar&apos;s top removed from the guitar&amp;quot; &quot; /&gt;&lt;/p&gt;

&lt;p&gt;I used this lower half to create a template to create a new lower half.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/5.jpg&quot; alt=&quot;The paper template I created&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I used this template to cut a thin sheet of plywood to replace that piece. It’s
a bit oversized but I will be sanding it down to size.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/6.jpg&quot; alt=&quot;The guitar with it&apos;s new plywood top&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The new plywood was a bit thicker than the rest of the top so I had to plane the
outer wall down so that both parts would be somewhat flush together.&lt;/p&gt;

&lt;h2 id=&quot;january-22nd&quot;&gt;January 22nd&lt;/h2&gt;

&lt;p&gt;Here’s the not-so-fun part. I started prepping the guitar for painting. I am
thinking I want to paint the entire thing in a solid color, a dark one should
make the entire thing easier to match.&lt;/p&gt;

&lt;p&gt;I started with the body. I needed to make sure all edges were as neat as
possible. There’s an upper bound to how good I think I can get it to look so I
am trying to cover the basics at least.&lt;/p&gt;

&lt;p&gt;I didn’t have a chisel on hand so I had to use a utility knife. It made the
process rather slow but I got it done.&lt;/p&gt;

&lt;video playsinline=&quot;&quot; muted=&quot;muted&quot; autoplay=&quot;autoplay&quot; preload=&quot;auto&quot; loop=&quot;loop&quot;&gt;
&lt;source src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/video-1.mp4 &quot; type=&quot;video/mp4&quot; /&gt;
&lt;/video&gt;

&lt;p&gt;After cleaning the edges, I sanded the body.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/7.jpg&quot; alt=&quot;The guitar with is freshly sanded body&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Next I had to do the neck and fittings. I started by removing the old fittings,
I don’t intend to buy new ones so I’ll have to clean these.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/8.jpg&quot; alt=&quot;The guitar&apos;s tuners&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Luckily disassembly is pretty straightforward.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/9.jpg&quot; alt=&quot;The guitar&apos;s tuners dissambled&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Next I prepped the neck. Some light sanding…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/10.jpg&quot; alt=&quot;The guitar&apos;s neck after a light sanding&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;and some light scrapping…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/11.jpg&quot; alt=&quot;The guitar&apos;s neck after a light scrapping&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;and it was ready to be painted.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/12.jpg&quot; alt=&quot;The guitar hanged from a wire to be painted&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We applied a primer, to hopefully even everything out a bit.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/13.jpg&quot; alt=&quot;The guitar with it&apos;s white primer&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now it only needs a second coat of primer and we’ll apply it’s final color.&lt;/p&gt;

&lt;h2 id=&quot;january-24&quot;&gt;January 24&lt;/h2&gt;

&lt;p&gt;In the meantime, I’ve gone ahead and cleaned up it’s original hardware. I left
it all submerged in a cup with 1 part of distilled white vinegar and 1 part
water overnight.&lt;/p&gt;

&lt;p&gt;The next day I had a go at it with a scotch pad and some steel wool under
running water.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/14.jpg&quot; alt=&quot;All the parts cleaned up&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After letting it dry and having it reassembled, it all looked great.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2023-01-02-project-log-some-sort-of-guitar/15.jpg&quot; alt=&quot;The tuners reassembled&amp;quot;&quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 02 Jan 2023 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2023/01/02/project-log-some-sort-of-guitar.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2023/01/02/project-log-some-sort-of-guitar.html</guid>
			</item>
		
			<item>
				<title>Installing Gitea on Dokku</title>
				<description>&lt;p&gt;I’ve been meaning to backup my GitHub repos somewhere for a while. I recently
discovered that Gitea can mirror them and will keep them updated. I am running
Dokku on my dedicated server and pretty much run everything I can think of
there. Gitea was a bit tricky to install so here are some notes.&lt;/p&gt;

&lt;p&gt;You start by creating the app:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku app:create gitea
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Once that’s done, we can initialize it from the docker image:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku git:from-image gitea gitea/gitea:latest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is a good time to set the correct domain name and mount the Gitea
directories.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku domains:add gitea git.example.org
; dokku storage:ensure-directory gitea
; dokku storage:mount gitea /var/lib/dokku/data/storage/gitea:/data
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can rebuild the app now:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku ps:rebuild gitea
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Dokku will get some ports wrong sometimes, we should check those:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku proxy:report gitea
=====&amp;gt; gitea proxy information
       Proxy enabled:                 true
       Proxy port map:                http:22:22 http:3000:3000
       Proxy type:                    nginx

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Those look somewhat wrong, lets fix them:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku proxy:ports-remove gitea http:3000:3000 http:22:22
; dokku proxy:ports-add gitea http:80:3000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can enable LetsEncrypt now:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; dokku letsencrypt:enable gitea
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s pretty much it! Seems a lot simpler once I’ve written it down.
If you want to change the config file you can go ahead and edit it + restart the
app:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;; sudo vim /var/lib/dokku/data/storage/gitea/gitea/conf/app.ini
; dokku ps:restart gitea
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Cheers!&lt;/p&gt;
</description>
				<pubDate>Sun, 07 Aug 2022 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2022/08/07/installing-gitea-on-dokku.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2022/08/07/installing-gitea-on-dokku.html</guid>
			</item>
		
			<item>
				<title>The Pandemic</title>
				<description>&lt;blockquote&gt;
  &lt;p&gt;As the &lt;em&gt;end&lt;/em&gt;&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; of the Pandemic approaches, I wanted to write a blog post to
remind myself of these past 18 months and how we spent our time in exile.
There isn’t really a point to this blog post in general it’s mostly a slice
of my life and a lot of disconnected thoughts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;I originally started writing this post in August 8th, 2021. It took me a year to
get around to finishing it but here it is. Better late than never I guess!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;before-the-pandemic&quot;&gt;Before The Pandemic&lt;/h2&gt;

&lt;p&gt;My exile started a bit before the pandemic got to Honduras. Towards the end of
the previous year (2019) I had a cancer scare. It turned out to be nothing but
I developed a lot of anxiety around my health because of it. I had become overly
weary of anything health related and hearing of this SARS-like disease that was
showing up everywhere didn’t help. By that time everyone was a bit tired of my
shenanigans and when I asked everyone around me to prepare for it I
(understandably) was not taken very seriously.&lt;/p&gt;

&lt;p&gt;Honduras is poor and I knew it wouldn’t take much for it’s system to collapse.
If even rich countries seem to be struggling it wouldn’t really take much for
the same to happen here. I told my mother that if she wanted to visit she’d have
to do so before the first case was reported in Honduras. Once that happened I’d
pretty much lock myself up and isolate for however long it took. She came to
visit a couple of weeks before the first case, just in-case. It sounded like
masks and hand sanitizer would be the first thing to fly off the shelves so I
purchased some preemptively. I figured I was being overly dramatic but better
safe than sorry. Having basic things I could hold to would make my anxiety
easier to control I figured.&lt;/p&gt;

&lt;p&gt;As the pandemic seemed to get closer I told everyone my plans of staying indoors
until it was under control, that it might be a bit long but hopefully not more
than a couple of months. The 8th of March, we had Arleth over for brunch, we
talked about the upcoming pandemic over coffee.&lt;/p&gt;

&lt;p&gt;On 10th of March, 2020 the first two cases of covid were reported in
Honduras my lock down would begin two days later. The following day I dismissed
the house staff, had them take the day off and go purchase groceries and supplies.
I assured them that they would still receive their salaries and that they would
have job once this was over.&lt;/p&gt;

&lt;h2 id=&quot;the-first-month&quot;&gt;The first month&lt;/h2&gt;

&lt;p&gt;Once the first cases were reported everything started moving too fast. By Sunday
every supermarket was swamped with people and supplies started dwindling. I felt
a bit validated knowing I had prepared myself with a couple months worth of
food. That sense of validation didn’t really last long.&lt;/p&gt;

&lt;p&gt;For the first couple of weeks everything was under strict lockdown and looked
like Honduras wouldn’t spiral too bad. Wishful thinking.&lt;/p&gt;

&lt;p&gt;The 20th we had a nice break with the release of Animal Crossing: New Horizons.
It came in at the best time, the boredom was settling in and everyone with a
switch was playing it. It felt like a community event, everyone was alone,
playing together. It carried us over a month or two.&lt;/p&gt;

&lt;p&gt;By the end of march the food was a little less varied so it seemed like the
right time to resupply. It looked like all supermarkets were booked for
deliveries for a month or so in advanced so we had to get creative. For
non-perishable we used a small supermarket that specialized in organic goods.
It’s variety wasn’t great and it was really expensive but it allowed us to get
some basics and some not-so-basics while the regular supermarkets got their act
together.&lt;/p&gt;

&lt;p&gt;Mid April everything got a lot better. We found a local catering company that
being unable to cater, had started selling vegetables, dairy and eggs. Getting
fresh vegetables for the first time after almost two months gave me back my will
to live.&lt;/p&gt;

&lt;h2 id=&quot;the-following-4-months&quot;&gt;The following 4 months&lt;/h2&gt;

&lt;p&gt;As the pandemic raged on I realized I was not doing too great. I had become a
bit of a hypochondriac and had developed some anxiety. I had been stuck in my
apartment for a while now so it seemed justified. One day I decided I wanted to
get into therapy. I found a nice Colombian psychologist that would treat me
online. It worked out great and after a month or two I felt better and was told
I could stop going.&lt;/p&gt;

&lt;p&gt;Whenever I am bored I get started on new hobbies. I had a ton of paint around
the apartment so I started painting. I would experiment quite a bit with
acrylics, I didn’t like how glossy they were but it grew on me. I eventually
started drawing over them with markers and developed a bit of a “style”. I would
paint quite a bit over the next couple of months.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/painting.jpg&quot; alt=&quot;One of the many paintings I did over the pandemic. An infinity net over a red background.&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As the sense of normalcy grew and I had more time off I started playing Call of
Duty with Carlos and Carla. It happened almost by accident but we started
playing a couple of hours every day. It was great fun, they’ve been my best
friends for the longest time and being able to spend time with them, even if
only online, felt awesome.&lt;/p&gt;

&lt;p&gt;Eventually I fell back to my oldest habit, overworking. I decided I wanted to be
more productive and get more done. I had been toying with an idea to help local
companies get their products online. Honduras is really far behind on this sort
of thing and during the pandemic it really showed. I’ve had an Estonian
e-residency for a while so I used that to incorporate a business and started
working on the app. I would let it sit to focus on my day job soon after.&lt;/p&gt;

&lt;p&gt;Up to this point we had been using a small refrigerator I bought back when I
first moved in. It was fine at the beginning but since getting delivery was hard
it made more sense to order more food and store it than try to order when
needed. We got a new fridge which was a pretty large QOL upgrade at the time.
Sounds weird but it really cheered us up.&lt;/p&gt;

&lt;p&gt;At this point my anxiety had improved so I decided to let myself drink coffee
again. It’s always been a large part of my life so it felt like that’d help me
go back “normal”. I decided to make a hobby off it (it technically already was)
and got myself a espresso machine. I named it Pino.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/pino.jpg&quot; alt=&quot;Pino the espresso machine&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I eventually start working on my small side project, a site to simplify selling
online, elmarket.&lt;/p&gt;

&lt;h2 id=&quot;the-rest-of-2020&quot;&gt;The rest of 2020&lt;/h2&gt;

&lt;p&gt;Very little happened the rest of the year:&lt;/p&gt;

&lt;p&gt;We raised moths.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/marimoth.jpg&quot; alt=&quot;One of the moths we raised, marimoth&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We would raise more moths the following year at around the same time of the
year.&lt;/p&gt;

&lt;p&gt;Customs eventually reopened so we bought some extra art supplies. I got a new
camera (Which I called Prismo). I painted some more. My sister suggested we run
a book club, we read one book, tiny fire everywhere, I hated it and decided to
stop book clubbing.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/painting2.jpg&quot; alt=&quot;Another painting of mine from that time&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I took a couple of weeks off in December to try to chill for a bit.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/sky.jpg&quot; alt=&quot;A picture of the sky&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;a-new-year&quot;&gt;A New Year&lt;/h2&gt;
&lt;p&gt;On my first day back after the Christmas break we were told at Azlo that our CEO
was leaving. The following day they announced we would be shutting down. Our
parent company had been sold off and no one really wanted to keep operating
Azlo.&lt;/p&gt;

&lt;p&gt;Since I was still stuck home I immediately started interviewing and looking for a
new gig. I found a really nice job at Blueonion Labs. They were doing really
cool things that closely matched the reconciliation stuff I was doing at Azlo. I
would start the week after my birthday. I decided to ignore it that year, it
didn’t seem fair to count it.&lt;/p&gt;

&lt;p&gt;We got a roomba shortly after, it was surprisingly helpful, we were spending
quite a bit of time cleaning and just having it run everyday made it way easier.&lt;/p&gt;

&lt;p&gt;I started working at Blueonion Labs.&lt;/p&gt;

&lt;p&gt;We found Pitt, the chunkiest boy. We originally offered him to Edward for
adoption but he didn’t want to adopt him. After a couple of days, even though we thought
we had enough cats, we ended up falling in love with him.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/pitt.jpg&quot; alt=&quot;Pitt, the cat&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We finally got our first vaccine shot in August. It was nice, it felt like maybe
it was coming to an end.&lt;/p&gt;

&lt;p&gt;A bit later my grandfather died from Covid. My uncle followed a couple of weeks
later.&lt;/p&gt;

&lt;p&gt;I left my job. I was feeling a bit burnt out and depressed.&lt;/p&gt;

&lt;p&gt;Towards the end of September we were fully immunized and decided it was time to
start moving on. We started planning a trip, it’d be the third time leaving the
house in 18 months. The other two were for vaccinations.&lt;/p&gt;

&lt;p&gt;Shortly before leaving we found Gomita, the newest member of our family. We had
no intentions of adopting another cat at the point but she needed a ton of help
and it didn’t seem fair to pin her off on someone else. So we kept her. No
regrets.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/gomita.jpg&quot; alt=&quot;Gomita, the cat&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We left for Europe in October and spent a couple of weeks over there. I had to
go to Estonia to open a bank account for the company I had founded the year
before but we spent the rest of time relaxing and doing normally touristy stuff
(mostly eating).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://martianwabbit.com/files/2022-08-05-the-pandemic/me.jpg&quot; alt=&quot;A picture of the author&amp;quot;&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;

      &lt;p&gt;We are about 4 weeks away from being fully immunized which is as far as I
know, the closest thing to an end there can be for the time being. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
				<pubDate>Fri, 05 Aug 2022 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2022/08/05/the-pandemic.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2022/08/05/the-pandemic.html</guid>
			</item>
		
			<item>
				<title>Installing FlatCAM on Ubuntu</title>
				<description>&lt;p&gt;So FlatCAM is an essential part of my PCB milling workflow and has become
increasingly difficult to install on the latest version of Ubuntu. Here’s a
couple of notes on how I managed to get it running.&lt;/p&gt;

&lt;p&gt;The first thing is to clone the repo:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://bitbucket.org/jpcgt/flatcam
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Something I didn’t notice at first is that there’s a beta branch available, it
uses newer versions of pyqt which makes everything way easier.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git checkout origin/Beta
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you are on Ubuntu you can run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ubuntu_setup.sh&lt;/code&gt; and should install pretty
much everything you need. I did hit a snag though, for whatever reason if I
tried installing the requirements, gdal would not compile. Turns out
it comes down to it not finding the correct headers. You can get around it by
installing it manually like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt install libgdal-dev gdal-bin
pip install gdal==3.0.4 --global-option=build_ext --global-option=&quot;-I/usr/include/gdal/&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should use whatever version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gdal-config --version&lt;/code&gt; prints out. You should
also update the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requirements.txt&lt;/code&gt; so that the version of gdal is also the same
so that the rest of the dependencies install.&lt;/p&gt;

&lt;p&gt;Once that’s up you can run it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python FlatCAM.py&lt;/code&gt;.&lt;/p&gt;
</description>
				<pubDate>Fri, 22 Jan 2021 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2021/01/22/installing-flatcam-with-pyenv.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2021/01/22/installing-flatcam-with-pyenv.html</guid>
			</item>
		
			<item>
				<title>Haproxy, Nginx and Dokku</title>
				<description>&lt;p&gt;I just finished setting up a wordpress site for my sister over the past weekend.
I usually setup some plugins to automatically block bruteforce attempts on these
since they are so common. Everything went smooth as usual until I checked in on
it the next morning and found myself blocked. I checked the logs and it turns
out it banned the reverse proxy’s ip.&lt;/p&gt;

&lt;p&gt;I am using Haproxy as a reverse proxy / load balancer for the entire server but
the ssl is handled by dokku which means Haproxy runs in tcp mode and doesn’t do
much other than route the traffic. Dokku also has a reverse proxy which it uses
to handle domains, it uses Nginx for this.&lt;/p&gt;

&lt;p&gt;It turns out Haproxy can’t add requests to an https request that terminates on a
different server. This makes sense but wasn’t obvious from the get go, the easy
solution was to use the proxy protocol so that Haproxy and Nginx can agree on
which ip is which.&lt;/p&gt;

&lt;p&gt;Here’s how to do it:&lt;/p&gt;

&lt;p&gt;First, we need to tell Haproxy to use the proxy protocol. All we have to do is
add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;send-proxy&lt;/code&gt; to the server option. This will send over all of the info Nginx
will need to find the correct ip.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;backend web
        mode tcp
        server web-http dokku send-proxy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next we need to tell Nginx to actually use that info. This is done by adding the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxy_protocol&lt;/code&gt; parameter to the listen option.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;server {
  listen      443 ssl proxy_protocol http2;
  ...
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, we need to set the request’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-For&lt;/code&gt; header to the real ip.
We can achieve this by adding a new conf file in
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/conf.d/set_real_ip.conf&lt;/code&gt;. You can name it whatever you want, it
should look something like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;set_real_ip_from  10.0.0.0/8;
set_real_ip_from  172.0.0.0/8;
real_ip_header proxy_protocol;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should list off all of the proxies that are part of the chain here.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxy_protocol&lt;/code&gt; will take care to set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-For&lt;/code&gt; ip to the correct
value automatically.&lt;/p&gt;
</description>
				<pubDate>Mon, 04 Jan 2021 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2021/01/04/haproxy-nginx-and-dokku.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2021/01/04/haproxy-nginx-and-dokku.html</guid>
			</item>
		
			<item>
				<title>KVM Backups, the easy way</title>
				<description>&lt;p&gt;I am now using a dedicated server to host all of my various projects. It turns
out if you are willing to do a lot of the work yourself you can get quite a bit
for you buck. Since I have to take care of backups myself now I had to rethink
my general backup strategy.&lt;/p&gt;

&lt;p&gt;In the name of being as lazy as possible what I’ve been doing now is using
libvirt to create individual VMs for every project. To back them up I can just
copy off the entire disk somewhere else. Once compressed these are relatively
small for what they are and are easy to move around into storage.&lt;/p&gt;

&lt;p&gt;I am also using git underneath almost everything so that actual code and assets
are also backed up locally and on github/gitea etc.&lt;/p&gt;

&lt;p&gt;Anyways, here’s what I am using to back machines up:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;DOMAIN&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;$1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;DISK&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;si&quot;&gt;$(&lt;/span&gt;virsh domblklist &lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; +3 | &lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{print $2}&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;\n&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;TIME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;+%Y-%m-%d--%H.%M.%S&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

virsh snapshot-create-as &lt;span class=&quot;nt&quot;&gt;--domain&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-backup&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;--diskspec&lt;/span&gt; vda,file&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-backup&lt;/span&gt;.qcow2 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;--disk-only&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--atomic&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--quiesce&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--no-metadata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

xz &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--verbose&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.qcow2&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

curl &lt;span class=&quot;nt&quot;&gt;--netrc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.qcow2.xz ftp://ftp.example.org/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.&lt;span class=&quot;nv&quot;&gt;$TIME&lt;/span&gt;.qcow2.xz&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

virsh blockcommit &lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt; vda &lt;span class=&quot;nt&quot;&gt;--active&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--verbose&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pivot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.qcow2.xz&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-backup&lt;/span&gt;.qcow2&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;First I create a snapshot for the current machine I’ll be backing up, these
machines are running the qemu agent so I get to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--quiesce&lt;/code&gt; to freeze the
file system. If you don’t have the agent installed you’d probably have to make
some small changes to the command.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;virsh snapshot-create-as &lt;span class=&quot;nt&quot;&gt;--domain&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-backup&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;--diskspec&lt;/span&gt; vda,file&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-backup&lt;/span&gt;.qcow2 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;--disk-only&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--atomic&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--quiesce&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--no-metadata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Once that’s done I’ll compress it using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xz&lt;/code&gt;. This will make the backup tiny but
it takes a really long time, you could use zip, tar or nothing at all if you
want the whole process to be faster.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;xz &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--verbose&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.qcow2&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now we can upload the compressed file to our backup location. I use curl to
upload to a local network drive I have available. I also attach a timestamp to
the file name as I do this.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;--netrc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.qcow2.xz ftp://ftp.example.org/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.&lt;span class=&quot;nv&quot;&gt;$TIME&lt;/span&gt;.qcow2.xz&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally I will use blockcommit to pivot back to the original disk image, merging
the contents of the backup and anything that’s happened since the snapshot was
taken, and remove the unnecessary snapshot and compressed files.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;virsh blockcommit &lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt; vda &lt;span class=&quot;nt&quot;&gt;--active&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--verbose&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--pivot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;.qcow2.xz&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; /var/lib/libvirt/images/&lt;span class=&quot;nv&quot;&gt;$DOMAIN&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-backup&lt;/span&gt;.qcow2&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It took me a bit to figure out how to do this which is why I am documenting it
here for myself. Most of this is based of off &lt;a href=&quot;https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit&quot;&gt;this wiki
entry&lt;/a&gt;.&lt;/p&gt;
</description>
				<pubDate>Fri, 30 Oct 2020 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2020/10/30/kvm-backups-the-easy-way.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2020/10/30/kvm-backups-the-easy-way.html</guid>
			</item>
		
			<item>
				<title>PocketChip in 2020</title>
				<description>&lt;p&gt;After many years of wanting one and then giving up on them when the company went
under, I finally acquired a PocketChip. This thing is great. Not all around
great but great &lt;em&gt;in principle&lt;/em&gt;. It has a great form factor with a nice screen
and great battery life. I quite like it. I’ve been using it to control my
plotters wirelessly, for counting words on my typewriter and to backup my op-z.
I’ve ran into a bunch of issues along the way so here are my notes on it, what’s
worked and what hasn’t in case someone else wants to give it a go.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/files/2020-10-24-pocketchip-in-2020/pocket-chip.jpg&quot; alt=&quot;My PocketChip&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;apt-sources&quot;&gt;Apt Sources&lt;/h2&gt;

&lt;p&gt;The first thing you should do is change you apt sources. It turns out when the
NextThingCo went under they took their mirrors with them (naturally). Luckily a
valuable member of the community took the time to create a mirror for it we can
all use &lt;a href=&quot;http://chip.jfpossibilities.com/chip/debian/&quot;&gt;here&lt;/a&gt;. That same member
of the community also took the time to mirror all of NextThingCo’s repositories
and other goodies:
&lt;a href=&quot;http://chip.jfpossibilities.com/&quot;&gt;http://chip.jfpossibilities.com/&lt;/a&gt; this is in
general the single best resource of data and code available for the chip in
2020.&lt;/p&gt;

&lt;p&gt;I ran into an issue with Jessie backports, as the distribution is pretty old
it’ll be necessary to update your apt sources to use the debian archive mirror:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

deb http://archive.debian.org/debian/ jessie-backports main
deb-src http://archive.debian.org/debian/ jessie-backports main

deb http://archive.debian.org/debian/ jessie main contrib non-free
deb-src http://archive.debian.org/debian/ jessie main contrib non-free
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Don’t forget to disable validity checks:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Acquire::Check-Valid-Until false;&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sudo tee&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; /etc/apt/apt.conf.d/10-nocheckvalid
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;ssh-access&quot;&gt;SSH Access&lt;/h2&gt;

&lt;p&gt;The PocketChip doesn’t include an ssh server by default so I’d recommend
installing one once you’ve gotten your apt updating and running:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;openssh-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;checking-the-battery-level&quot;&gt;Checking the Battery Level&lt;/h2&gt;

&lt;p&gt;There’s two magic files in the os that reflect your current battery state, you
can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/lib/pocketchip-batt/voltage&lt;/code&gt; to check how charged your PocketChip
is and you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/lib/pocketchip-batt/charging&lt;/code&gt; to check if it’s charging
or not. These are mostly useful for scripts and such.&lt;/p&gt;

&lt;p&gt;The voltage range is from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3600&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4200&lt;/code&gt; from what I’ve seen.&lt;/p&gt;

&lt;h2 id=&quot;using-uart&quot;&gt;Using UART&lt;/h2&gt;

&lt;p&gt;If you want to use the built-in UART you need to shutdown getty:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl stop serial-getty@ttyS0.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can then use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/ttyS0&lt;/code&gt; as you normally would as a terminal or programmer
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stty&lt;/code&gt; to check the config &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stty -F /dev/ttyS0&lt;/code&gt; or change it
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stty -F /dev/ttyUSB0 9600&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;a-full-desktop-environment&quot;&gt;A full desktop environment&lt;/h2&gt;

&lt;p&gt;If you want to have a full desktop environment running on your chip, you can use
&lt;a href=&quot;https://github.com/AllGray/PocketDesk&quot;&gt;PocketDesk&lt;/a&gt;, which sets it up for you.&lt;/p&gt;

&lt;h2 id=&quot;using-your-gpio-pins&quot;&gt;Using your GPIO Pins&lt;/h2&gt;

&lt;p&gt;This actually took a lot of tinkering and was going to be the original focus of
this blog post.&lt;/p&gt;

&lt;p&gt;PocketOS provides an easy way (once you figure it out) to enable or disable gpio
pins. Under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/sys/class/gpio&lt;/code&gt; there’s two sinks &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unexport&lt;/code&gt;. As
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export&lt;/code&gt; to enable a gpio pin by piping it the pin’s
identifier:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;1015 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/export
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Apparently these identifiers changed depending on the OS version, on mine it
starts with GPIO 1 as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1015&lt;/code&gt; and follows with GPIO 2 on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1016&lt;/code&gt; and so on. When
you are done using a pin you should &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unexport&lt;/code&gt; it:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;1015 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/unexport
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;While the pin is exported you can set three settings according to what you are
trying to achieve:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Pin direction:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;in&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/direction
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;out&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/direction
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;Active Low:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;1 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/active_low
&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;0 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/active_low
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;Edge detection:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;rising&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/edge
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;falling&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/edge
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;none&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /sys/class/gpio/gpio1015/edge
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can check the GPIO’s state by reading the value:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /sys/class/gpio/gpio1015/value
&lt;span class=&quot;c&quot;&gt;# Either 0 or 1 depending on the current state of the pin.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Since this behaves like a normal file and emits events you can use anything that
uses inotify to watch it. For example, here’s how you’d monitor a button press
using inotify-hookable:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /sys/class/gpio
&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;1015 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;export
cd &lt;/span&gt;gpio1015

&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;0 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; active_low
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;in&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; direction
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;rising&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; edge

inotify-hookable &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; ./value &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;cat ./value&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There’s some extra information about the pins in the
&lt;a href=&quot;http://web.archive.org/web/20210222094348/http://www.chip-community.org/index.php/GPIO_Info&quot;&gt;community wiki&lt;/a&gt;.
The pin numbers seem wrong for the pocketchip but the rest of the information
available seems solid.&lt;/p&gt;

&lt;h2 id=&quot;configure-the-app-launcher&quot;&gt;Configure the app launcher&lt;/h2&gt;

&lt;p&gt;The default built-in launcher for the PocketChip, PocketHome, can be minimally
configured by editing a json file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/pocket-home/config.json&lt;/code&gt;. You can
change the apps and the icons from there among other small niceties.&lt;/p&gt;

&lt;p&gt;I’d recommend changing the terminal to xfce-terminal, it comes pre-installed and
seems to be better in general, I changed the terminal button to this:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Terminal&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;shell&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;xfce-terminal --hide-borders --fullscreen --hide-menubar&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;icon&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;appIcons/terminal.png&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You need to restart the entire PocketChip for the changes to kick in.&lt;/p&gt;

&lt;p&gt;Also, if you are ever using a keyboard, dmenu is installed and mapped to alt +
space which is super nice for quickly switching apps.&lt;/p&gt;

&lt;p&gt;And that’s it, I think, everything I’ve had to figure out about the PocketChip,
distilled into one blog post. Let me know if there’s anything important you
think I should know.&lt;/p&gt;
</description>
				<pubDate>Sat, 24 Oct 2020 00:00:00 +0000</pubDate>
				<link>https://martianwabbit.com/2020/10/24/pocketchip-in-2020.html</link>
				<guid isPermaLink="true">https://martianwabbit.com/2020/10/24/pocketchip-in-2020.html</guid>
			</item>
		
	</channel>
</rss>
