El Caudillo

I’ll admit that after our current President was elected I went into a bit of a slump. I don’t think I was the only one, however, and Alain Badiou probably expresses much better than I ever could what so many were experiencing at the time.

Part of the unease of being confronted by such a phenomenon was the thought that these United States, as though in some sort of dystopian nightmare, had possibly entered a terminal decline into fascism.

But although Trump is clearly a charlatan and a buffoon, he is also, I think, something of a simpleton. I wouldn’t categorize him as a fascist because he lacks any coherent ideology. He only appears to be one because he uses traditional tools of fascism (particularly mass propaganda, racist appeals and xenophobia) to excite his so-called base, which is really a form of degenerate proletariat.

I suspect that he is relatively easy to manipulate, and his handlers, particularly his family, probably use this to their benefit. They, too, have no real ideology, other self-enrichment.

There are ideologues in the party – mainly libertarians and neoliberals, but also a mish-mash of gun nuts, religious fanatics, flat-earthers, coal-burners, and other reactionaries of various stripes who are mostly kept around just to collect white votes.

If you’re looking for historical parallels, I would be more inclined to compare Trump to Peron, rather than Hitler or Mussolini (whom he appears to unconsciously emulate).

Argentina has had it’s share of tragedy and authoritarian rule, but they seem to be doing OK (even with multiple defaults). Once this covid thing is over, I think Buenos Aires might be the place to be.

The Death of Burning Man

There has been recent Facebook chatter suggesting that Burning Man, which was cancelled for this year, is now dead, and will never rise from the ashes again. (Presumably killed by the coronavirus, I guess.)

Here’s my response:

It might be different, but I don’t think it’s dead. (Like Frank Zappa once said about jazz, “it’s not dead, it just smells funny.”)

Eventually there will be a new equilibrium.

A number of factors, including the identification of effective treatment (so far remdesivir and anti-inflammatory agents such as anti-IL6 look promising), a vaccine (which may or may not be highly effective, but will be better than nothing), and a general unwillingness by the world population to remain in social isolation and lockdown forever will start to move things closer to normal human behavior.

Certain things might change forever – for example, it will probably become more socially acceptable to decline to shake hands, and hand-shaking itself may come to be seen as eccentric and unhealthy.

We might be wearing masks for a while.

But I don’t think people are going to accept an indefinite future without social gatherings, including very big ones.

There are also very, very dedicated people that are determined to keep this thing alive in some form or another. It might not be a form that includes mojitos. Or it might. It will probably change some. But I can’t see it completely going away.

I’m optimistic. I think we’ll be back by 2022, maybe even next year (but probably not).

Best wishes, and stay safe.

COVID-19

With everybody else putting in their two cents worth on the epidemic, I thought I would share a few thoughts:

1. Eating weird animals, like snakes, bats, lizards, civet cats and pangolins (whatever those are) is not necessary for life, and may even be bad for you. (It might even be better not eat animals at all, but that’s a story for another time.)

2. Smoking is harmful to your health (duh!).

Over 50% of Chinese men and possibly up to 30% of Italian men smoke. 12% of Icelanders (only 9% daily) smoke, and their experience with the disease so far has been very different.

3. It doesn’t help much to have the most advanced and expensive healthcare system in the history of the world, if it doesn’t have a flexible capacity to respond to epidemics and mass casualty situations.

Compare and contrast: For-profit vs Public (forget the much- and unfairly-maligned VA; think Army). Well, I’ve served in all of them, and I can tell you I’d rather spend a month in an Army hospital than 1 hour in the commercial system. In the commercial facility you might recover physically, but end up financially ruined. In the Army, the focus is always in the mission, and that’s also true for medicine, as in everything else.

I mention this because if this whole thing goes south, it won’t be the commercial system picking up the pieces, because they’re not made for this; it will be the VA and the military (whose medical systems are now integrated), mainly because they are the only things we have left that resemble a true public health system (and also because the Army, especially, trains and has doctrine and experience with this).

Well, that’s all for now. Cheers, and stay healthy (and stay away from bats!).

Security

This should by no means be considered an expert guide to web security; it is just a summary of my efforts to protect my own network, given my interest in building a web camera (mainly to watch cats). Here’s what I’ve learned.

It occurred to me that forwarding open ports to the Internet might pose a security issue.

I found the following steps offered some reassurance and were relatively simple
to implement.

ufw

Uncomplicated Firewall (UFW) allows ports to be closed on the device.

sudo apt install ufw
sudo ufw allow 22
#SSH, for control and configuration on the LAN

sudo ufw allow 5900
#VNC, best used through an SSH tunnel (5900:127.0.0.1:5900)

sudo ufw allow 8081
#camera

sudo ufw allow 8080
#camera configuration in browser (optional)

#all other ports are disabled by default with ufw,
#port must be either allowed, or can be turned off
#with "deny "

sudo ufw enable
sudo ufw status

Fail2ban

Fail2ban blocks IP addresses that display suspicious activity, i.e., multiple

sudo apt install fail2ban
sudo nano /etc/fail2ban/jail.local

This creates a file that will supercede the default settings. The most hackable
ports will presumably be 22 (SSH) and 46 (VNC).

[ssh]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = -1

This will permanently ban any ip address that fails to login after 3 ties
(you can modify this).

Configure VNC and Motion

I’m not aware of any way to use fail2ban to ban failed VNC login attempts
(or failed attempts of 8080 and 8081), but you can configure VNC to accept only localhost logins (do this with the “Options -> Expert” menu by setting “localhost” to “True” in the RealVNC VNC Server). Presumably 8081 (camera)and 8081 (camera control) can be made less vulnerable by using a strong password
for access, which can be set in the /etc/motion/motion.conf file.

sudo nano /etc/motion/motion.conf

Look for the “Live Stream Server” section. Set up these options:

# The mini-http server listens to this port for requests (default: 0 = disabled)
stream_port 8081

# Quality of the jpeg (in percent) images produced (default: 50)
stream_quality 50

# Output frames at 1 fps when no motion is detected and increase to the
# rate given by stream_maxrate when motion is detected (default: off)
stream_motion off

# Maximum framerate for stream streams (default: 1)
stream_maxrate 50

# Restrict stream connections to localhost only (default: on)
stream_localhost off

# Limits the number of images per connection (default: 0 = unlimited)
# Number can be defined by multiplying actual stream rate by desired number of seconds
# Actual stream rate is the smallest of the numbers framerate and stream_maxrate
stream_limit 0

# Set the authentication method (default: 0)
# 0 = disabled
# 1 = Basic authentication
# 2 = MD5 digest (the safer authentication)
stream_auth_method 2

# Default: not defined (Disabled)

Similarly, look for “HTTP Based Control”, and set the following options:

# TCP/IP port for the http server to listen on (default: 0 = disabled)
webcontrol_port 8080

# Restrict control connections to localhost only (default: on)
webcontrol_localhost on

# Output for http server, select off to choose raw text plain (default: on)
webcontrol_html_output on

# Default: not defined (Disabled)

This ensures that you can a.) only login to the webcontrol page (port 8080) on
the host device, and b.) you must use a username:password pair to actually
access the video stream. It also gives the option of sending you authentication
credentials using the MD5 message-digest algorithm, which apparently has some
vulnerabilities, but may possibly be better than nothing.

So, there you are. All RasPi ports except for 22, 5900, 8081 and 8080 are closed by ufw; fail2ban scans attempts to log in to the SSH server (which shouldn’t be accessible anyway, except over the LAN), VNC is disabled for everything except VNC tunneling through SSH, and the router only forwards 8081 to the web. Stream and webcontrol pages are password protected.

That’s as tight as I could get it with my limited knowledge of network security,
but it seems much better than a wide open server.

In addition to protecting my camera server, I used UFW to lock all the ports on my laptop, as well as Fail2Ban to protect against hacking on port 22 (SSH). It’s also a good idea to use strong passwords.

See this reference for a more complete discussion of the security considerations for a RasPi camera server:
https://www.raspberrypi.org/documentation/configuration/security.md

RasCam

Note: This works with Raspbian GNU/Linux 9.1 (stretch) and Raspberry Pi zero.

These instructions should make it possible to connect a RasPi-compatible camera to a RasPi Zero and stream video on the local network and internet (with suitable configuration).

Attach and enable camera

Attach camera to RasPi using 15/22 pin ribbon cable. Prepare using the following
commands.

sudo apt-get update
sudo raspi-config
# In this menu, or in the GUI option, enable the camera
reboot

raspistill -o cam.jpg

Install and configure motion software

sudo apt-get install motion
# Careful, on the v4l2 it's an 'L', not the number 1
sudo modprobe bcm2835-v4l2

sudo nano /etc/modules
# at the end of the file, add this line :
bcm2835-v4l2

sudo nano /etc/default/motion
# in this file, search for start_motion_daemon and activate it
# start_motion_daemon=yes

sudo cp /etc/motion/motion.conf /etc/motion/motion.conf.bak
sudo nano /etc/motion/motion.conf
# Allow motion to run the daemon we've set earlier
daemon on
# Set the logfile (important to debug motion if you webservers crashes)
logfile /tmp/motion.log
# we want to be able to access the stream outside off the Pi's localhost
stream_localhost off
# disable pictures and movies saving
output_pictures off
ffmpeg_output_movies off
# set the framerate of the stream (100 for higher quality)
framerate 100
# set the width and height of your video (defaults 640, 480)
width 640
height 480
# webcontrol port 8080 by default (access some controls through http)
webcontrol_port 8080
# stream port 8081 by default (access streaming video through http)
stream_port 8081
# careful ! don't set the stream_port just like the webcontrol port
# Optional: add this line in the file for password protection of webcontrol

sudo service motion start

Open browser, http://localhost:8081

Attach RasPi to local network and router

# will open the network configuration file
# alternately, use the desktop GUI
sudo nano /etc/network/interfaces

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp

Obtain IP address for host and router

ifconfig

route -n
#gets address for default gateway (internal)
#To obtain external address, use a service such as
#This will be useful in setting up DDNS (see below).

Open browser, http://:8081

DDNS

Register ddns account and install ddns client (follow instructions below).
https://www.noip.com/
https://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client/

# To confirm the service is running properly
sudo noip2 ­-S

Connect to router and configure port forwarding.

sudo nano /etc/dhcpcd.conf

interface eth0

static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0

static routers=192.168.0.1
static domain_name_servers=192.168.0.1

#interface = This defines which network interface you are setting
#the configuration for.
#(Make sure you leave the /24 at the end)
#You can add multiple IP addresses here separated with a single space.

reboot Pi
(You may also need to reboot router)

In browser, https://.ddns.net:8081

Networking

This project required me to improve my understanding of networking. There are
two sites that I found particularly helpful listed among the references
below.

References:

https://www.bouvet.no/bouvet-deler/utbrudd/building-a-motion-activated-security-camera-with-the-raspberry-pi-zero

https://pimylifeup.com/raspberry-pi-webcam-server/

https://hackernoon.com/spy-your-pet-with-a-raspberry-pi-camera-server-e71bb74f79ea

https://hackernoon.com/how-to-access-your-raspberry-pi-camera-from-anywhere-544ab9e5bacc

https://motion-project.github.io/index.html

https://www.noip.com/

https://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client/

Cats

It’s interesting what you can see when you go out. I had been staying in for the last few days, mostly in an effort to refine and deepen my understanding of the C language (with a little C++ on the side). But today was sunny and quite warm by Pac NW standards (58 F), so I decided that I would head down to the waterfront.

Only before I could get there, I met a cat. Not a hipster cat – like, a real cat, who was calling me. With that, the cat and I commenced to have a conversation.

Now, how exactly does one go about conversing with cat? I supposed that with help of psychedelics, it’s probably pretty easy. But under ordinary conditions, communicating with a cat can be subtle. The vocabulary that we share is limited, and there’s a still a lot to be worked out. But I can say that as one spends time with cats, it’s possibly to become more and more intimately familiar with their minds and thoughts. And, eventually, you can have a pretty good idea, most of the time, of what they’re trying to tell you.

In this case, it was clear that the cat was sad, lonely, and hungry. I know this, in part, because we both share some context. Unfortunately, the person who was probably the cat’s best human friend had died a few days before. I knew him also, but I don’t think we were nearly as close and he and he cat were. Furthermore, it’s not at all clear if anyone else was feeding this cat, or the rest of his/her entourage that appeared to live in and around the house.

I won’t say if I actually fed the cat, as I’m not sure how the neighbors might feel about that. In our community there’s a division between what I call the cat people and the bunnie people. Maybe not quite as bad as the Natives and the Dead Rabbits in “Gangs of New York,” but there’s still some disagreement over the proper response to the presence and activities of cats, especially the ones who seem like they may be trying to eke out a living in the yards, streets and alleyways of our neighborhood.

As for me, I feel like I can appreciate both sides. On the one hand, nobody likes to see little birds or bunnies turned into cat food. On the other hand, I also understand that nature having made them this way, cats have no choice but to kill and consume what they can. Cats don’t eat tofu. Humans and cats have been coexisting for possibly around 10,000 years; but the fashion of keeping cats as pets and feeding them has probably only been going on for less than 100 years. And they know this is not something they can depend on forever.

端的只今の一念より外はこれなく候

This is a line from Hagakure by Yamamoto Tsunetomo. The Hagakure is usually referred to as The Way of the Samurai, or something li ke that, but a literal translation would be more like, “In the Shadow of Leaves”, which I think is more beautiful.

これなく候

ichinen yori hoka wa
kore naku sōrō

Which means, more or less:

There is surely nothing
other than the single purpose
of the present moment.

(Note that the words have been rearranged for grammatical reasons.)

Even though it’s not 5-7-5, it still has the feeling and rhythm of a haiku for me, and it really distills very nicely, I think, the spirit of zen.

The Hagakure, BTW, is the book that Ghost Dog reads (and gives to the little girl) in Jim Jarmusch’s film of the same name.

Wine

I don’t drink wine anymore; having finished cat-assisted rehab, I now just drink lots coffee. But I’m still interested in the subject and was particularly curious about a data-set that I happened to encounter in my efforts to learn more about Python and statistics.

I’ll try to provide more details later on, but I was so excited about these results that I decided to go ahead and put up a rough ASAP.

Turns out, that with a little Pythonification and linear regression, you can find out some interesting things about wine.

This is what you get when you look at something like about 130k(!) wines:

The wines are scored by a professional wine-taster, or sommelier, or something. The first graph shows the distribution of scores, which, to my untrained eye, looks suspiciously like a so-called “normal” (or Gaussian) curve. The graph next to it is an attempt to find the best fit for a linear relationship (if there is one) between the scores and the prices of these fine products. Turns out the lowest price is \$4 (like what you might get at Trader Joe’s) and the highest is in excess of \$3000 (Yikes!).

But look at that graph – the numbers are all over the place, and there doesn’t seem to be a well-defined relationship at all, at least not at first. After looking at it a couple of times, I thought to myself, “well, what about a logarithmic transformation – why not!”

So there you have it. There’s a bit of spread, but to me it certainly does look like the prices go up exponentially as the wine-taster’s scores increase. Something to think about, I guess.

(Note: If you check out the links above, be advised that the code provided on the web pages doesn’t work the way it’s written, or at least it didn’t work for me. Maybe because I’m still using Python 2.7. I had to do a little tweaking, as well as learn a little more about the use of the numerical and graphing modules to get it going.)

Cheers, everyone.

Seattle Weather, revisited

Following up a little on the previous post about Seattle weather conditions and Markov chain modeling, I decided to write a quick Python script that calculates the probability vectors for each day’s weather.

Here it is:

#!/usr/bin/env python

import numpy as np

t = 1

M = np.array([[0.80, 0.65, 0.60],
[0.10, 0.25, 0.10],
[0.10, 0.10, 0.30]])

x = np.array([[1],[0],[0]]) #x1

for t in range (1, 15):

print 't =', t
print 'x(%d) =' %(t)
print x[0]
print x[1]
print x[2]
print '\n'

x = np.dot(M,x)

As you can see, not much to it, really.

Recall that $x_t$ is a vector that contains the current (at time $t$) probabilities of the weather either being cloudy ($x(1)$), rainy ($x(2)$), or sunny ($x(3)$). As each day passes, $x_{t + 1} = Mx_t$ where $M$ is the probability transition matrix for the various different states (Cloudy/State 1, Rainy/State 2, Sunny/State 3).

If you iterate this equation multiple times, you get some interesting results:

These are the same results that we got by hand before. Now let's do a few more iterations and see what we get:

And finally:

This is really very exciting; notice how after about 12 iterations, we have a vector that represents stable, long-term probabilities of approximately 76% cloudy days, 12% rainy days, and 12% sunny days. I don't know if that's true or not, but it certainly feels about right! (Of course, with climate change, this just might all be a thing of the past, which would be sad; I like it cloudy.)

Nozarashi o

しむ身かな

Nozarashi o
Kokoro ni kaze no
Shimu mi kana.

– Bashō

My son suggested that I translate this haiku by Bashō. I think he thinks I know more Japanese than I do. But having spent a lot of time with this poem, I’ll give it a try.

It is contained in a book that was published in or around 1685, 野ざらし紀行 (Nozarashi kikō), the title of which is translated in various ways, but my favorite is Journal of Bleached Bones in a Field, a pdf of which can be downloaded here for your reading pleasure.

Basho himself was a very interesting fellow. Born 松尾 金作 (Matsuo Munefusa), he later changed his name to 松尾 芭蕉 (Matsuo Bashō). Apparently he called himself “Bashō,” which means “banana tree” after a tree that grew in the yard of his hut, where he lived more-or-less as a hermit at times. He was a restless person and traveled a lot. At one point his hut burned down; so for a while, at least, he was effectively homeless. He was a practitioner of Zen, and lived a monk-like existence, but as far as I know he was never actually formally a Buddhist monk.

Here’s a picture of Bashō, presumably doing what he did best:

There are already a number of existing translations of the haiku above, and I am by no means a scholar of Japanese. But I like the way these particular words are arranged, and I find them intriguing.

Nozarashi o

“Nozarashi” is often translated as “Bleached bones in a field,” because the kanji 野 refers to a “field,” and ざらし or 晒 refers to something “bleached” (presumably y the sun) or exposed. The particle を (pronounced “o”) indicates direction, in a away similar to the preposition “at” or “to.” This is the place where something is happening, the place Basho is seeing or thinking of. So far we have a field and a condition of having been bleached. Where are the bones? As a Zen teacher might say, “they are in your mind.”

Kokoro ni

“Kokoro” is “heart.” に, pronounced “ni,” is another particle indicating direction, in this case it can be thought of as meaning “in” or perhaps also “to” (the way を can). According to one particular resource you can think of を as indicating the direction of action, whereas に is more for the direction of motion. I think を may have more to do with location in this case. Note that a particle in Japanese comes after a word in Japanese where it would typically be used before a word in English.

kaze no

“Kaze” means “spirit” or “wind” (same thing), as in 神風, pronounced “kamikaze,” meaning, “divine wind.” Most people probably associate the kamikaze with suicide pilots during WWII, but this expression was previously used to refer to the typhoons which destroyed Mongol fleets in 1274, and again in 1281, on both occasions saving Japan from invasion. The Japanese were truly under the protection of the gods!

I should mention that I have puzzled over the particle の, pronounced “no,” which usually acts like an apostrophe “s,” indicating possession , but can be very flexible. It can refer to other things, like location, and sometimes it just seems to connect things together. I’m honestly not sure what it means in this case, or if it really means anything. I have suspected that it might be there for rhythm, or just to provide a syllable.

しむ身かな
Shimu mi kana

しむ, “shimu” is a verb that means “pierce.” 身, pronounced “mi” in this instance (Japanese words can often be pronounced a lot of different ways, depending on how they are used) means “body.” The expression かな, “kana,” is something that, as I understand it, is used to represent what we would use an exclamation point for in English. (Kind of like the way よ, “yo,” is used at the end of a Japanese sentence for emphasis.) It also conveniently adds 2 syllables, which helps with the 5-7-5 structure of the poem.

I feel like if I were going to translate this in a way that was closest, perhaps, to the original intent of the author, I might say something like this:

Bleached bones in a field;
The wind pierces me to the heart.

Or, if I were going to expand it a little and try to make it more like a real 5-7-5 haiku in English:

Bleached bones in a field;
The wind pierces my body,
And it chills my heart.

This is a pretty minimalist interpretation, but I think of Haiku as a pretty minimalist form. So there you have it.