Easy KiCad PCB panelization with kicad-util

There are multiple panelizers available for KiCad, but only one is suitable for easily placing multiple oddly-shaped PCBs onto a panel: the kicad-util panelizer.

You simply place the PCBs next to each other and draw lines between them on the Eco1.User layer. Then run a kicad-util command voila; the lines are transformed into mouse-bites.

Unfortunately, kicad-util is not compatible with the updated PCB format of KiCad 6, so the drawn lines are not converted to mouse bites anymore.

Luckily, a merge request contains the fix, but the kicad-util creator is not available anymore. Although the contributor created his fork, the .jar file is not recompiled, so the fixed version is still quite inaccessible for most users.

Given the above, I recompiled the fixed kicad-util version with the mvn package command and made the .jar file available. I use it as:

java -jar ~/bin/kicadutil.jar pcb -f=myboard.kicad_pcb panel --inset=0 --hole=0.35 --pitch=0.7 --width=2.5 --fillet=1

Introducing Ultimate Hacking Keyboard

I’d like to take the opportunity to show you the trailer video of the Ultimate Hacking Keyboard, a high-end mechanical keyboard of which I’m the lead developer. Our keyboard is going to be kickstarted soon so you’re more than welcome to share it, follow us and subscribe to our list to get notified when our campaign starts. See you on UltimateHackingKeyboard.com! Cheers!

DXF to SVG to KICAD_PCB converter

Recently, I’ve written dxf2svg2kicad, a highly polished online DXF to SVG to KICAD_PCB converter which I’m very proud of. To be explicit this tool converts:

  • DXF to SVG
  • SVG to KICAD_PCB (used by KiCad EDA)
  • DXF to KICAD_PCB

Speaking to the technical-minded, my tool runs 100% on the client side and I used lots of cutting-edge web technologies to make it happen. You’re welcome to check out the code on GitHub.

Nowadays I simply publish my work on GitHub and rarely blog – I’ve created this post solely for SEO purposes because given the usability of my tool Google should rank it higher.

How to rule remote shell sessions with tmux and mosh

If you’re like most ssh users when your connection breaks it’s bad news for you. Not only do you have to reconnect but your session gets destroyed and you have to make all the moves to restore the previous state. This doesn’t have to be that way. I’d like to say some words about two tools that solve these problems in the most elegant way possible.

tmux

tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.

In the world of tmux there are windows and panes within windows. You can think of tmux windows as workspaces on the desktop that are aligned in a horizontal manner. It’s like having a number of virtual monitors next to each other each running different shell sessions. You can move across these windows as desired. With the use of panes you can split individual windows horizontally and/or vertically as desired, each pane housing a different session. This is pretty useful for tailing various log files in different panes and monitoring them at once.

You simply have to run the tmux command to create a new tmux session. Once a session exists upon reconnecting over ssh you have to invoke tmux attach to reconnect to your already existing session.

If you’re like me you may want to use tmux by default upon ssh’ing to servers. To make this happen you have to include export LC_TMUX_SESSION_NAME=yourusername into your ~/.bashrc and wrap scp on the client side and invoke tmux automatically on the server side. On a related note you can also take a look at my tmux.conf which I believe defines more intuitive shortcuts than the default configuration.

There are a number of alternatives to tmux that I’d like to list starting with the most powerful towards the least powerful. GNU Screen is yet another terminal multiplexer but its feature set, usability and configurability is rather limited compared to tmux. dtach is like a minimalistic tmux featuring one pane inside one window and it only provides a minimal set of options. Finally, with the use of the nohup command you can make your (typically long-running) script immune to hangups and hence it can survive ssh disconnects.

mosh

Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes.

mosh is the other piece of the puzzle leading to the remote shell nirvana. After apt-getting mosh on the client and mosh-server on the server instead of invoking ssh yourserver.com invoke mosh yourserver.com. From this point on you don’t have to worry about reconnecting to ssh or having to wait for the server to echo back your characters anymore.

My bias lighting setup

It should be no news for any well informed geek that bias lighting is good for your eyes. I’ve just recently implemented my setup which was surprisingly easy to put together. It only needed a self adhesive LED strip, an AC adapter, a switch and some wires. Click on the album below for your viewing pleasure!

bias-lightingClick to see the album

Ethernet cable labelling

Ever felt that you have too many cables in your home and don’t know which one leads where?  Welcome to my world!  Here’s my recipe to how to make the situation easier.

It all starts with a sticky tape.

ethernet-cable-labelling-1

Now comes the pen.

ethernet-cable-labelling-2

Let’s cut the tape with scissors.

ethernet-cable-labelling-3

At this point you should remove the protective foil from the back of the tape to expose the glue and shape a loop.

ethernet-cable-labelling-4

As a final move, pull the cable through the loop and push the tape against the cable to make it stick.

ethernet-cable-labelling-5

When doing all the above properly, you’ll get a of sight that makes the pants of any nerd wet.

Make your OpenWrt router automatically enable your home server and notify you

Here’s the situation: I have a Mini-ITX home server in my LAN that sometimes gets disabled when the power goes down. I could setup its BIOS to get automatically enabled when it gets power but considering the nature of power outages it may happen that the power goes out and on in rapid succession over a short amount of time which isn’t really good for the hardware.

I’d rather choose my server to be checked on a 5 minute basis and have it automatically woken up and I also wanna be notified by email on such an occasion so that I can SSH into it and uncrypt the crypto partition.

I’m about to carry out this task using my OpenWrt driven router. Everything is pretty straightforward, except that I can’t send emails through GMail SMTP using Openwrt because mini_sendmail lacks SASL support so I’ll just fetch a PHP script that’ll actually send the mail.

openwrt:/usr/bin/supervise-host

Be aware that the above wol utility is a home-cooked one.

openwrt:/etc/crontab/root

# m h  dom mon dow   command
0,5,10,15,20,25,30,35,40,45,50,55 * * * * supervise-host mybox http://mydomain.com/notifyme.php

At this ponit restart cron on OpenWrt.

mydomain.com:/var/www/notifyme.php

< ?php
mail('admin@mydomain.com', $_GET['host'] . ' has been rebooted', 'uncrypt me!');
?>

Enjoy!

Minimizing CSS and JavaScript HTTP requests automatically on the CMS level

Broadband Internet connections are pretty standard in the modern world nowadays, but despite of this many sites feel slow to load. Why is that? This is because of a multitude of reasons but the one that really hits home for me is excess HTTP requests. To be even more specific, I’d like to talk about excess CSS and JavaScript file requests. It’s not unusual for sites to load about a dozen or more CSS and JavaScript files combined which I think is way overkill.

I came up with an algorithm that could be implemented by any CMS on the API level and it could dramatically reduce the load times of sites and relieve web servers significantly.

  1. Expose a dedicated API on the CMS level for plugins such as add_cached_css() / add_cached_js() .
  2. Execute the following points upon every page load:
  3. Check the modification times of all the CSS / JavaScript files.
  4. If the modification time of any file has been changed since the last page load or any new file has been added then go on, otherwise abort.
  5. Save the modification time of all the CSS / JavaScript files, concatenate the files and md5sum the concatenated files.
  6. Save the concatenated CSS / JavaScript files using their md5sums, such as 7c1735b79f2d13052454c196259ca511.css and 9fee0c4c4391bd75ca4269dac409a0aa.js
  7. Save the md5sums for the CMS to be able to reference the generated files from the main page.

A couple of things to note:

  • The generated CSS / JavaScript files should be cached forever as it’s practically impossible for two distinct generated files to ever collide.
  • This algorithm could be implemented by any CMS so that any plugins could use it with no effort.
  • No new API functions should be necessary for every CMS.  For example, WordPress already has functions for adding CSS / JavaScript files.  A simple define should be enough to activate such an algorithm.

Let me know what you think.