As we move to document models in our databases it is important to have good tools allowing us to adequately filter out unnecessary and sensitive information.

Photo by Jessica Ruscello on Unsplash

For this article we will be using the flatten-dict library available at and installable via pip install flatten-dict.

Example document that needs to be filtered:

user = {
"name": "Bob Robertson",
"classification": {
"kingdom": "animalia",
"phylum": "chordata",
"class": "mammalia",
"order": "primates",
"suborder": "haplorhini",
"infraorder": "simiiformes",
"family": "hominidae",
"subfamily": "homininae",
"tribe": "hominini",
"genus": "homo",
"species": "h. sapiens",
"statistics": {
"dimensions": {
"height_cm": 194.2,
"weight_kg": 96.52,

Include a plain text cloud-init file using secureString variable types and backticks in your Azure ARM template

Beware! I’m a smidge new to Azure and only recently started fooling around with the template deployment functions. That said… even though it requires quite a shift going from manpages to Azure technical propaganda… it appears ARM templates are fairly straight forward after some initial demystification.

When I went to download my template after using the Azure portal to set up a virtual machine deployment I was a bit dismayed to see that the customData I had included as a cloud-init compatibleuser-data.txt data…

A simple streaming email filter and some assorted entanglements

Photo by Joanna Kosinska on Unsplash

Local mail servers like Postfix and Sendmail as well as various mail processing solutions like Procmail and Formail utilize external mail filters by way of piping (stdin) an entire mail envelope to a program, allowing it to process, and then reading the new filtered envelope that streams out (stdout).

In a less restricted environment many *NIX users can utilize a user home directory dotfile named ~/.forward to define a program, mailbox, or alternate email address for a local address.

With Postfix and Sendmail you can typically use plussed + email addresses like and create ~/.forward+logs in the users home…

Using getattr(…) to find event handlers using constructed names

Photo by Brian Mann on Unsplash

In the telephony industry I do a lot of work with event systems and I often end up writing a lot of if statements to help create a decision tree of sorts. Often I only want to know about the first or second event that occurs. For example a ringing indicator or the first time a call detects a voice. Writing a large and complex if tree or cascading if statements together can lead to some unwanted breaks and head scratching later on.

In Python everything is an object — functions are no exception to this. The Python function getattr

“I wish I could adjust this on the fly”

Photo by Steve Harvey on Unsplash

After a journey into ASGI/WSGI hell as a way to implement short running processes to deal with memory and re-loadable components I found my way back to Tornado but missed having settings reloaded every 10,000 requests as processes were expunged. It was nice being able to adjust configurable intervals and boundaries to help deal with CPU load and I/O spikes.

Lately I have seen patterns in product (not module) development in Python/Node projects I am involved in where there is a global module dedicated to classes and functions that contain settings and parsed command line options. …

Using comments to help create readable code in a world with no wrapping

Photo by Safar Safarov on Unsplash

Am I the only one that has almost put in a feature request for Black, the Python code formatter? I get a few paragraphs in and then realize the futility of the task. Black is labelled as ‘The uncompromising code formatter’ which is part of why I love it! Let’s make all the things look like all the other things!


I don’t really care that the developers behind the formatter figured out 88 chars is the ideal wrapping width since that is an easy to adjust global/project level nerd knob. …

This article focuses on how I was able to use UUID’s generated within my voice application (a dialer) to place and track the progress of outbound calls against a realtime extension context that is also tracked and dynamically generated by way of res_curl and some simple Python based API services.

Realtime? I don’t mean realtime prioritization or realtime as a project codename. Asterisk supports realtime/dynamic configuration of many modules by way of extconfig.conf. …

Anarchy’s proper place — handled and isolated

Unpredictability. Assumed insanity and rioting. Organized chaos in full irony. Taking a demonstration to its knees by creating a violent opinion. Fueling a mixture of emotions with a Molotov cocktail. Anarchist notions that create the opposing force Black Bloc have destroyed the message and replaced it with their own. That’s what works for them.

Difficult times are ahead for protesters and safety has become an overwhelming issue for demonstrations and local law enforcement alike. Law conscious organizers and participants have some choices to make about securing the well-being of the group. Tactics being used to create anarchy are physically and…

A Wall to be seen. A War to be unseen. A myopic state of affairs on all fronts.

For years the U.S. has worked to curb the cost of border enforcement handling drug trafficking and illegal immigration by building the Mexico-United States Barrier. The wall is already in place where patrols can’t keep up with enforcement requirements. However, even 600 miles of barrier later — it appears inadequate. What stands will be removed and replaced as a more uniform, safer, and easier to monitor wall is put in place.

An impressive amount of barrier cost research is overwhelming social feeds as potential help toward a best guess cost of such an installation. A vast landscape of questions remain…

Driving in Alaska will put well reasoned and methodical safe driving behavior to the ultimate test. Distracted and dangerous drivers are well aware of their actions and the potential hazards, forsaking them for poorly excused entitlements, but are just as aware of how many accidents there are and how they affect our community. So what insight can each of us share, regardless of how we drive, to see a long lasting reduction in the amount of fatal accidents and ditch diving.


Attention to habits. Occasionally there’s an unexpected (or… completely expected) flash of brake lights letting a driver know to…

Shane R. Spencer

Photographer, writer, tech developer and outdoor enthusiast living in Eagle River, Alaska.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store