Discover more from hrbrmstr's Daily Drop
Drop #321 (2023-08-21): Simple-y Delightful
Gum; Termbin/Fiche; ShareDrop
I truly enjoy it when things “just work”. It's a big reason I also truly dislike Python (how many package managers do y'all have to solve the “
pip install” nightmare, now, 50?). And, why there will never be the “year of the linux desktop”. (And, also why I grow increasingly frustrated with macOS—gimme System 7 any day).
Today, I guarantee you'll end up using and enjoying the simplicity and elegance of at least one of the three items we're covering. As usual, keep Ferengi Rule #196 firmly in mind, as you should do with any installment of the Drop.
This is an AI-generated summary of today's Drop.
Today, I used Phind via their VS Code extension. The experience was solid enough to warrant dropping a full-screen capture. There was no “Copy” button to get the output as Markdown. So, I ended up having to copy/paste links.
The first section of the document focuses on Gum, a command-line interface (CLI) tool that allows users to create visually appealing and interactive shell scripts without writing Go code. It provides installation methods for different platforms, suggests project ideas using Gum, and lists Gum's top-level commands. Gum
The second section introduces Termbin, a command line pastebin powered by Fiche, which allows users to share terminal output with others. It provides instructions for using Termbin and running a personal Termbin server. Termbin / Fiche
The third section describes ShareDrop, a free, open-source web app for securely sharing files directly between devices without uploading them to a server. It provides instructions for using ShareDrop locally or across networks and setting up a personal instance. ShareDrop
I somewhat promised Bonus Drop subscribers that I'd cover Gum this week, so we'll make good on that today.
Do you want to level up user interaction in your shell scripts regardless of what language you are using? Thought so!
Gum is a command-line interface (CLI) tool developed by Charmbracelet (we've covered some of their spiffy tech before) that allows you to create compelling, visually appealing and interactive shell scripts without writing any Go code. I note the “Go” bit, since many of Charmbracelet's offerings are Go modules which are intended to be used in Go programs. Gum leverages the power of Bubbles and Lip Gloss, two libraries from the Charm ecosystem, to provide a collection of highly configurable utilities — wrapped up in a single, cross-platform binary — for creating user-friendly CLI scripts.
Gum can be installed on various platforms, including macOS, Linux, and Windows. Here are some installation methods for different platforms:
macOS or Linux:
brew install gum
pacman -S gum
Debian/Ubuntu: Follow the instructions provided in the official installation guide.
For other platforms, refer to the official installation guide for detailed instructions.
I'm not including a ton of examples, since Gum's README does a better job than I could ever do showcasing all of its superpowers. What I can do is suggest three not-even-close-to-weekend-projects (a toy version of each should take an hour or so) to help kick Gum's tyres:
Build an interactive configuration file generator: Create a script that prompts users for input and generates configuration files based on their responses. Gum's
confirmutilities can be used to collect user input and confirm their choices before generating the files.
Ye olde 'Task Manager' demo app: Build a task manager script that allows users to add, remove, and view tasks. Use Gum's
chooseutility to display a list of tasks and let users select the ones they want to manage.
Create a fancy status dashboard: Design a script that displays system information, such as CPU usage, memory usage, and disk space, in a visually appealing format. Utilize Gum's
tableutility to present the data in an organized and easy-to-read manner.
These are all of Gum's top-level commands:
choose: Choose an option from a list of choices
confirm: Ask a user to confirm an action
file: Pick a file from a folder
filter: Filter items from a list
format: Format a string using a template
input: Prompt for some input
join: Join text vertically or horizontally
pager: Scroll through a file
spin: Display spinner while running a command
style: Apply coloring, borders, spacing to text
table: Render a table of data
write: Prompt for long-form text
The toy example I used in the Bonus Drop was to have Gum present output from the podcast search utility we built.
I realize Gum introduces a third-party dependency, but it drops in everywhere, and is just a joy to use. Tis def worth said reliance.
Termbin is a command line pastebin that provides an easy way to share your terminal output with others. It is powered by Fiche, an open-source command line pastebin server. To use Termbin, you only need to have
netcat installed on your system, which is available on most platforms, including Windows, macOS, and Linux.
While you can use the public Termbin server, you can also run your own Termbin server by installing Fiche, setting up a web proxy server for it (to serve the collected text files) and opening up a port for Fiche. This can be useful if you want more control over your data or if you need to share terminal output within a private network. However, it's important to note that no sensitive data should be transferred over the public Termbin server, as it is a public, unauthenticated service with easy-to-enumerate default URL paths. Termbin-proper is also used by C-list malicious folk, so it may be blocked in your organization.
The life span of a single paste is one month, and older pastes are, in theory, deleted. That means if you're reading this Drop within one month of publication, you can see the output of this:
$ cat surprise | nc termbin.com 9999
Termbin/Fiche can be used as poor dude's version of what the Warp browser can do automagically. I can't run my own “Warp server”, and do not trust the developers of Warp enough to give them all my keystrokes, CLI output, and usage data. You shouldn't either. I mention this since I was all excited about Warp when it first came out. It does a remarkable job reimagining the terminal. But, relying wholly on third-party infrastructure — and a required internet connection to use a local terminal — for something as sensitive as terminal work just doesn't make sense to me. YMMV.
Not gonna fib…the instructions you see when you first visit ShareDrop are good enough to just outright steal. So, ima do that (or you can quit reading and just go there, though I did mangle it a bit and also have more to say than the intro the site gives itself).
ShareDrop is a free, open-source web app that allows you to easily and securely share files directly between devices without uploading them to any server first.
To send a file to another device on the same local network, open
sharedrop.io on both devices. Drag and drop (or tap to select) a file directly on another person's anonymously named and generated avatar, or click the avatar and select the file you want to send. The file transfer will start once the recipient accepts the file. To send a file to another device on a different network, click the
+ button in the upper-right corner of the page and follow further instructions.
This basic use-case requires you be on the same local network, since ShareDrop uses a secure and encrypted peer-to-peer connection to transfer information about the file (its name and size) and file data itself. This means that this data is never transferred through any intermediate server but directly between the sender and recipient devices. To achieve this, ShareDrop uses a technology called WebRTC (Web Real-Time Communication), which is provided natively by browsers. You can read more about WebRTC security here, and some other things it powers.
The local-[W]LAN-only version of ShareDrop is legit local-only. The cross-network one does exchange a bit of data (not the file contents) across an untrusted channel, so you can opt to set up your own instance if you have such a use case.
The section header shows me sending a copy of a special “Barbie”-inspired version of the intro panel of our weekly Storm⚡️Watch webcast at work from a macOS desktop running Arc to an iOS device (my phone) running Safari.
ShareDrop is (IMO) way more reliable than Apple's AirDrop and a pretty clever hack on top of WebRTC.
If you make something with Gum, drop a note wherev you're most comfortable! ☮
hrbrmstr's Daily Drop is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.