hrbrmstr's Daily Drop

Share this post

2022-07-25.01

dailyfinds.hrbrmstr.dev

Discover more from hrbrmstr's Daily Drop

A digest of all the interesting data, packages, blogs and papers covering lots of programming languages, CLI utilities, cybersecurity, data visualization, data science, web-scraping and more!
Continue reading
Sign in

2022-07-25.01

plistwatch; Hyperpolyglot; Wargame Nexus

boB Rudis
Jul 25, 2022
3
Share this post

2022-07-25.01

dailyfinds.hrbrmstr.dev
Share

There isn't a ton of complexity or nuance for the items noted in today's sections, which should make it quickly digestible.

plistwatch

Somebody's Watching Me by Rockwell US 12-inch.jpg

(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:

  • https://github.com/dirtymouse/defaultswrite

  • https://github.com/kevinSuttle/macOS-Defaults

  • https://github.com/sqrthree/defaults-write

  • https://github.com/tarranjones/mac-setup-defaults-write

  • https://github.com/rusty1s/dotfiles/blob/master/macos/defaults.sh

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.

Hyperpolygot

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.

Clark Grubb has curated said focused list over at Hyperpolyglot [GH].

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

  • GUI Scripting

  • Command Line Interpreters

  • Forth and PostScript

  • Prolog, Erlang, Elixir

  • Lisp Dialects

  • C and Go

  • OO C Style Languages

  • Rust, Swift, Scala

  • TypeScript, Dart

  • Pascal Style Languages

  • ML Dialects and Haskell

  • Numerical Analysis & Statistics

  • Computer Algebra Software I

  • Computer Algebra Software II

  • Gnuplot and GLPK

  • Fortran and APL

  • Unix Shells

  • Text Mode Editors

  • Version Control

  • Build Tools

  • Terminal Multiplexers

  • Relational Databases

  • Relational Data and JSON Tools

  • Lightweight Markup

  • 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.

Wargame Nexus

time lapse photography of square containers at night
Photo by Federico Beccari on Unsplash

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.

FIN

Happy Monday! ☮

3
Share this post

2022-07-25.01

dailyfinds.hrbrmstr.dev
Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

© 2023 boB Rudis
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing