this post was submitted on 23 Jan 2026
8 points (100.0% liked)

Show & Tell

234 readers
1 users here now

Show & Tell

There appears to be a bug with Lemmy that makes it so you cannot see these posts. If you can't see any posts please send me a message

A community for developers to share personal projects of any size or polish. Anything software/firmware/hardware.. ALL THE WARES!! Side projects, experiments, learning builds, half-finished ideas — all welcome.

Explain what you built, why you built it, and what you learned. Give feedback if you can. Ask for feedback if you want.

Rules

  1. Personal projects only (no company or paid product marketing)
  2. Include context: what it is, what tech you used, what you learned
  3. Be constructive and respectful
  4. No spam or referral farming
  5. Feedback is encouraged, not mandatory
  6. Mark NSFW content clearly
  7. If you see a project you like and you think is cool consider giving it a star!
AI Rules

Guys it's 2026, if you're not using AI at this point you're falling behind. That being said this community is not for showing off AI prompts that you put into gh Copilot or Claude or whatever, all that's showing the world is "hey I know how to make something up and explain it in 20 words while having the expectations of a team who gives a shit! Woow look at me!!".

So do your best to disclose where/how/why you used AI in your code, and if you suspect a project is entirely AI generated slop,, don't engage, don't bully, just let them eat their foot ¯\_(ツ)_/¯.

Icon and Banner were generated using ChatGPT, they're placeholders as of 1/20/26, will replace them with real art soon! https://chatgpt.com/share/696fa8bc-f3e0-8012-b6d7-350a8b53a0e1

founded 1 week ago
MODERATORS
 

Last year while I was learning to self-host some services on a Raspberry Pi I came across Alpine Linux. The very minimal environment of Alpine Linux was something that really interested me. Somewhere along the way I started writing scripts. Since Bash wasn't my default shell and I was missing a lot of other programs that would normally be pre-installed under other distributions, I unintentionally started writing POSIX portable scripts.

I continued writing with POSIX in mind because I not only found it interesting but it was also giving me a better understanding of how Linux works under the hood. I was always curious about how windows worked when I was using it but it always seemed so much more complex and intimidating.

This specific script I wrote was meant to make mounting and unmounting a LUKS encrypted device from the command line easier and a bit safer. Eventually I extended the functionality to automatically decrypt, mount, execute a command, unmount and reencrypt the device in one single command.

My reasoning for this is because I use external encrypted USB drives to backup my computer, phone and two RPi devices. I wanted to still enter my passphrase but I didn't want to forget to reencrypt my device after updating the backup.

Some of the things I learned while writing this script in particular was working with getopts and changing terminal settings with stty. There are a bunch of other small things I learned to work around the limited tools I had available but it would be too much to try and list them all.

With getopts I managed to find a few ways to make it manageable and easy to work with long options. That makes it much easier to use this script within other scripts since I don't have to remember what each single character short option name does. The limitation with getopts and long option names is that the long option requires an '=' character but it works consistently which is what matters to me.

With stty I learned how to disable and reenable job control (default CTRL+Z in a terminal) as a way to prevent the script from being interrupted and leaving the device unencrypted because the script couldn't continue with the unmounting trap command.

I spent a couple months of my free time working on this script but it's at the point where I am comfortable and very happy with how it turned out. It's a single file, POSIX portable and only requires cryptsetup as it's only dependency.

I'll apologize for the commenting in advance, I find the shouty comments help me understand what's happening with the script better than trying to remember what each command or variable does. It's also might seem silly in some places but it's consistent which is also important to me.

The Script: emountman

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here