Discover more from hrbrmstr's Daily Drop
plistwatch; Hyperpolyglot; Wargame Nexus
There isn't a ton of complexity or nuance for the items noted in today's sections, which should make it quickly digestible.
(This is kind-of macOS-only, so you can skip this if you're using a lesser operating system.)
A property list (plist) is a representation of a hierarchy of objects that can be stored in the file system and reconstituted later. Property lists give applications a lightweight and portable way to store small amounts of data. They are hierarchies of data made from specific types of objects (i.e. a tree-like object graph). Property lists are easy to create programmatically and are even easier to serialize into a persistent representation. Applications can later read the static representation back into memory and recreate the original hierarchy of objects. For those not familiar with them, they look like this (when not in binary form):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Name</key> <string>Jenny</string> <key>Phone Numbers</key> <array> <string>867-5309</string> </array> </dict> </plist>
NeXTSTEP, GNUstep, iOS, iPadOS, watchOS, tvOS, and macOS all use property lists in some way, shape or form to manage state and preferences of various apps and services. Some apps use property lists as log files (ugh). They're also a great way to get a new system configured to your liking in quick order, since it's much easier to run a script of
defaults write commands (which is how you configure various property list settings at the command line). There are many lists of such useful settings across the internets; here are a few of them:
So, how can you get in on the action of discovering new propert list settings?
Chirag Davé (@chiragdog) created a small Golang library and utility dubbed plistwatch which will monitor all property list changes and dump them to stdout. WARNING: it turns out that the utility regularly dumps quite a bit to stdout, as Apple and many apps make regular use of it and store way more than you might expect in these files.
I've been using Ventura's "comfort sounds" (a.k.a. background noise) feature and wanted to see if Apple used property lists to manage this new service. I fired up
plistwatch, made some changes, and lo-and-behold it does!
defaults write "com.apple.ComfortSounds" "lastEnablementTimestamp" '"1658739714.219523"' defaults write "com.apple.ComfortSounds" "comfortSoundsEnabled" '1' defaults write "com.apple.HearingAids" "HearingFeatureUsagePreference" '2112' defaults write "com.apple.HearingAids" "HearingFeatureUsagePreference" '64' defaults write "com.apple.ComfortSounds" "comfortSoundsEnabled" '0'
As of this writing, changing
comfortSoundsEnabled from the command line does nothing, at least not immediately.
Go forth and spy on your system, and drop a comment if you find some fun/good/useful plist settings.
A polyglot is an individual who knows and can use several languages. Since programming languages are languages (I mean "language" in the term!), this term also applies to folks who are code promiscuous.
While it is 100% OK to just use one language and use it well, I've never been comfortable being locked into a single ecosystem. You never know when you're going to end up needing to do some work in a different shell, scripting language, or compiler. I try to "think" in the language environment I'm in, but sometimes it is helpful to have a Rosetta Stone to see how various idioms look in a new language. While you could use Rosseta Code for such a task, it is also sometimes helpful to have a more curated and focused list that translates fundamentals between selected languages.
Say you wanted to know how to extract a substring in MATLAB, R, NumPy, and Julia; Hyperpolyglot has you covered:
# MATLAB s = 'hello' % syntax error: 'hello'(1:4) s(1:4) # R substr("hello", 1, 4) # NumPy 'hello'[0:4] # Julia "hello"[1:4]
The list of translations is not small:
Scripting Languages I
Scripting Languages II
Command Line Interpreters
Forth and PostScript
Prolog, Erlang, Elixir
C and Go
OO C Style Languages
Rust, Swift, Scala
Pascal Style Languages
ML Dialects and Haskell
Numerical Analysis & Statistics
Computer Algebra Software I
Computer Algebra Software II
Gnuplot and GLPK
Fortran and APL
Text Mode Editors
Relational Data and JSON Tools
2D Vector Graphics
Given the forthcoming death of
bash on macOS, today might be a good day to bookmark the Unix Shells page and start updating your shell mental model.
I try not to lean too heavily in to including cybersecurity topics in these editions (I don't want to bore or scare folks away 😎), but that reticence seems to have caused me to exclude cyber topics from most editions. I'll try to find a better balance moving forward.
This is a quick link drop since it's fairly self-explanatory.
In hacking, a wargame (or "war game", if you're a monster) is a cyber-security challenge and "sport" in which competitors must exploit or defend a vulnerability in a system or application, or gain/prevent access to a computer system.
Yan Shoshitaishvili maintains an organized, PR-able list of said wargame sites that should be useful to almost anyone. Yes, even if you're not in the cybers, you should look at some challenges (you don't need to compete) so you can get an understanding of what your cyber peers are up against in this cold, cruel world.
Happy Monday! ☮