

Discover more from hrbrmstr's Daily Drop
These Drops have been listing a tad bit to javascript port, of late. As noted multiple times, this is due to the encroaching seismic shift in how, when, and where “compute”, “app”, and “data science” tasks will be performed. This does not mean that your friendly neighborhood hrbrmstr has forgotten his rust-ic roots. So, today, we grab the bilge bucket, bail out the boat a bit, and check in on some neat “new” Rust-based tools that help us do various important tasks, one of which is managing javascript environments (it all comes full circle).
nonymous (bore)
As longtime readers will painfully remember, I'm a sucker for anything DNS-related. And, if you make a DNS thing in Rust, you will gain my undying fealty. DNS is DNS, so there's not much to wax poetic about when it comes to DNS lookup tools, including nonymous (BB) a Rust-based DNS protocol and algorithm library.
At present, nonymous cannot:
read and write zone files
act as a stub resolver or recursive resolver
but, you should avoid running your own DNS server anyway (unless you really know what you're doing and keep up with patches).
What nonymous can do is give you access to bore, a dig-like CLI tool to perform DNS lookups. Both bore and dig have similar speed runs (they're both pretty much limited by bandwidth/latency vs anything else), basic usage idioms, and core features, but bore has some additional, fancy bits:
USAGE:
bore [OPTIONS] [@host] [name] [type]
FLAGS:
--encode Write raw query to stdout
--load Read raw query from stdin
--dump Write raw response to stdout
--decode Read raw response from stdin
--show-resolvers Print resolver details
--reverse Make reverse DNS query (name required)
--help Print this help
--man Show the full manual page (more help)
--version Print version details
OPTIONS:
--host <host> Host to send query
--port <port> Port to send query
--timeout <seconds> Time to wait for each host [default: 5]
--class <class> Question class [default: IN]
--color <when> When to use colours or other text styles
[possible values: auto, never, always]
ARGS:
<@host> Host to send query (same as --host)
<name> Question name [default: .]
<type> Question type [see above]
I recommend typing bore --man
to get all the deets.
It works across all platforms, and is also a really good example of a well-built, focused Rust crate.
pastel
Digging into all the webby things of late has me both living in the command line more and fiddling with colors more. Switching from CLI to GUI and back is some cognitive load my lingering long covid brain really does not like, so I'm finding more tools in both environments to make it a bit easier to get through the day.
Pastel is a Rust-based command-line tool to you can use to generate, analyze, convert and manipulate colors. I can't believe I didn't know about this fantastic utility until just a few weeks ago. Here's what's inside the tin (but def read below for some froody highlights):
USAGE:
pastel [OPTIONS] <SUBCOMMAND>
OPTIONS:
--color-mode <mode>
Specify the terminal color mode: 24bit, 8bit, off, *auto*
--force-color
Alias for --mode=24bit
--color-picker <color-picker>
Use a specific tool to pick the colors
[possible values: osascript, gpick, xcolor,
wcolor, grabc, colorpicker, chameleon,
kcolorchooser, zenity, yad]
SUBCOMMANDS:
color Display information about the given color
list Show a list of available color names
random Generate a list of random colors
distinct Generate a set of visually distinct colors
sort-by Sort colors by the given property
pick Interactively pick a color from the screen (pipette)
format Convert a color to the given format
paint Print colored text using ANSI escape sequences
gradient Generate an interpolating sequence of colors
mix Mix two colors in the given colorspace
colorblind Simulate a color under a certain colorblindness profile
set Set a color property to a specific value
saturate Increase color saturation by a specified amount
desaturate Decrease color saturation by a specified amount
lighten Lighten color by a specified amount
darken Darken color by a specified amount
rotate Rotate the hue channel by the specified angle
complement Get the complementary color (hue rotated by 180°)
gray Create a gray tone from a given lightness
to-gray Completely desaturate a color (preserving luminance)
textcolor Get a readable text color for the given background color
help Print this message or the help of the given subcommand(s)
Pastel is a proper UNIX tool, meaning it groks |
and you can use it on itself to do all sorts of fun things with colors.
Say, you want three distinct colors that have some colorblind affordance:
pastel distinct 3 | pastel colorblind prot
(oh, did I forget to mention you get to see colors right in the terminal?)
If you don't need all that info, or just like a compact display, you can do that too:
Forget all those silly color names that come by default with your OS? pastel list
has you covered, as it prints a colorized named list to your terminal.
Want fancy ANSI colored terminal text?
pastel paint -n black --on red --bold " ERROR! " && \
echo " You forgot to read yesterday's Drop!"
Have some rando color strings you want to analyze? No problem!
pastel color "hsl(211, 13.7%, 38.6%)" \
"rgb(196, 77, 88)" c7f484 darkturquoise c44d58
In a rush, and desperately need a complementary color for a primary color? pastel complement 556270
has you covered.
You can also use pastel pick
to pull up a system color picker and choose any color on the screen.
Tis a joy to use and another solid example of a well-built crate.
volta
Volta (GH) solves a problem you likely didn't know you [will] have until you run into a situation when your fav javascript tool doesn't work, or your Node project is tossing errors because the wrong JS toolchain is active.
While this problem is nowhere near as stupid bad as the horribly awful Python counterpart, it is problematic. I've lost count of the number of times I've had Vite bork on me due to having a woefully old dominant JS toolchain active (due to making some R {V8}-based internal packages).
To some degree, nvm (Node Version Manager) has a solve for this. But it simply “just” a POSIX-compliant shell script that allows you to install and switch between multiple versions of Node.js on a per-user basis. With it, you can install and use different versions of Node.js for different projects, which is useful if you need to work with projects that require different Node.js versions. It also handles npm versioning.
Volta, on the other hand, is a tool that takes a more holistic approach to managing Node.js projects. It allows you to specify the Node.js version for a project in a configuration file, and automatically installs and uses the specified version when you run the project. It also provides a way to manage other tools and dependencies that are commonly used in Node.js projects, such as Yarn, npm, and even Rust itself.
By coming along for the ride in your package.json
files, it “just works”.
Read the Understanding Volta Guide to get a more in-depth view into how it works and why you might want to use it.
FIN
Again, if you're in Portland, ME today, drop by MTUG and say 👋! ☮