Skip to content

Instantly share code, notes, and snippets.

@probonopd
probonopd / start-hello
Created April 30, 2021 17:28
Temporary version that should work on Raspberry Pi
#!/bin/sh
set +x
# This script is intended to be invoked by a desktop file
# from /usr/local/share/xsessions
# where the display manager (login window) picks it up
# Disable core dumps for applications
ulimit -c 0

Simple Parametrized Snap-fit Enclosure for a PCB in Onshape

One killer application for 3D printing is building enclosures for electronics prototypes. Many hobbyists use tools like TinkerCAD to build simple project boxes that are held together using screws.

A more elegant solution is to use snapfit enclosures that consist of two parts that can be snapped together with a satisfying click and without the need for additional parts or tools. Depending on how these snap-fits are designed, pulling the parts apart can be very easy to next to impossible.

Key principles

  • The part must not be under stress after being snapped together. PLA slowly deforms over time if it is under pressure for a prolonged period of time. Hence avoid "friction fits" where to parts are joined simply due to the friction betwee them
  • Always use clearance, at least in x and y dimensions. 0.1mm for a well-tuned FDM printer to 0.2mm for larger nozzles and/or faster printing situations
@probonopd
probonopd / sheepshaver-freebsd.md
Last active December 17, 2022 19:16
SheepShaver on FreeBSD, it can be done!

SheepShaver on FreeBSD

Set e.g., 800x600 with 60fps or fullscreen and it works!

Needs

sudo sysctl security.bsd.map_at_zero=1
@probonopd
probonopd / Wayland.md
Last active August 16, 2025 00:36
Think twice about Wayland. It breaks everything!

Think twice before abandoning X11. Wayland breaks everything!

image

Wayland breaks everything! It is binary incompatible, provides no clear transition path with 1:1 replacements for everything in X11, and is even philosophically incompatible with X11. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Feature comparison

@probonopd
probonopd / dejavu.txt
Last active September 19, 2020 09:36
How to remove these fonts without removing KDE? Create dummy packages with the same name?
$ sudo pkg remove dejavu
Password:
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 162 packages (of 0 packages in the universe):
Installed packages to be REMOVED:
accounts-qml-module: 0.7
adwaita-icon-theme: 3.28.0
akonadi: 20.04.2
baloo-widgets: 20.04.2

Fontconfig, Chrome, and URW fonts were driving me insane

tl;dr: Many versions of the URW fonts coming with Linux distributions and, in my case, FreeBSD, seem to be broken. Uninstall them and use those from https://github.com/ArtifexSoftware/urw-base35-fonts/ instead. It does wonders!

I can't stand "metric compatible" surrogate fonts like DejaVu, Liberation, Bitstream Vera. I would much rather have fonts that at least optically largely match "original" fonts, such as URW Nimbus Sans L (which is a rebranded Helvetica). Yet most open source desktops come with "metric compatible" surrogate fonts deeply pre-wired: When you try to uninstall them using the package manager, then due to the way the package dependencies work the whole graphical desktop gets uninstalled. When you let the packages installed but delete the font files, other breakage occurs. So Fontconfig to the rescue... not.

Example (scoll all the way down for a working one)

I am trying to replace certain sans serif fonts with _Nimbus Sans L

@probonopd
probonopd / freebsd-obs.sh
Created August 29, 2020 13:46
FreeBSD launcher for OBS Studio so that one can record sound from the microphone
#!/bin/sh
# See
# https://www.youtube.com/watch?v=r0yMCOH8BhY
# for more information
set -x
MIXER=$(cat /dev/sndstat | grep "rec" | cut -d ":" -f 1 | tail -n 1 | sed -e 's|pcm|mixer|g')
mixer -f /dev/$MIXER mic 100

Solve all USB permissions errors

Sometimes I get "permissions denied" errors for USB devices.

Example: avrdude in Arduino.

This is the brute force method to allow all users on a Linux system to use all USB devices:

sudo chmod 666 /dev/bus/usb/*/*

Get Normal "Save" dialog in Microsoft Office 365

This trick is golden. It makes the non-standard Office "Save" dialogs go away. I post it here because this drove me crazy until I found the solution.

Click File > Options > Save, and then check the "Don’t show the Backstage when opening or saving files" box.

Apparently these horrific dialogs are called "Backstage" by Microsoft. I will never understand why anyone would want to see them. They are entirely unintuitive and just cumbersome. They do not fit the rest of the Windows UX, and you never seem to be able to navigate the filesystem. They are so complicated and annoying that I don't understand them to this day. Even worse than Clippy and the Ribbon.

What is this horrific "Backstage View" supposed to be good for, except being inconistent and annoying people?