Quickly bootstrapping a new Node.js project

A problem that often happens to me: I get the inspiration to whip up something in Node.js  (for fun, for experimentation, for a side project, etc) but then I realize that I need to go through the process of actually setting things up before I can even start writing some code.

Usually, I have to dig through previous projects and copy over my eslint and prettier config files, read through some documentation and remember how to setup TypeScript again, install the correct dependencies for running tests. Before I know it, I’m bored and tired and no longer interested in doing whatever I was going to do.

I decided to experiment with some command line tools and created a Node.js script that can help me quickly bootstrap a new project with common configuration parameters that I use. It’s available on GitHub: Bootstrap Node Project.

The GIF above shows this tool in action. I’m able to get the scaffolding for a new project up and running within about 20 seconds! After running, the project structure looks like this (with associated npm start and test scripts, all ready to go). That is pretty awesome.

my-cool-project/
├─ .husky/
├─ node_modules/
├─ src/
│ ├─ index.js (.ts)
│ ├─ index.test.js (.ts)
├─ .eslintrc.json
├─ .gitignore
├─ .prettierrc
├─ package-lock.json
├─ package.json
├─ README.md
├─ tsconfig.json (optional)

Obviously, it’s highly opinionated and caters to configuration options that I personally like to use. But I figure it’s a great resource for anyone who wishes to roll their own utility to quickly bootstrap projects as well.

 

Generating art using AI

Earlier this year, OpenAI announced DALL-E 2, the latest version of their AI tool that can generate images by simply providing text input.

For example, “people in togas taking a selfie in front of a volcano”, and it will get to work attempting to create an image that includes all these elements.

The Verge has an interesting article with more details. You can see an example of what is possible on the DALL-E 2 subreddit. It’s honestly insane.

For now (sadly), the service is invite only.

More recently, an ambitious engineer named Boris Dayma created an open source version of the service called DALL-E mini. While it isn’t able to generate results as impressive as DALL-E 2, it’s still pretty crazy!

It’s recently taken the internet by storm and you can see people post DALLE-mini generated images and memes everywhere. The official website has been under heavy load, so it’s been pretty tough to try out the service.

Fortunately, you can download the model from Github and get the service setup on your local machine (providing you have a graphics card beefy enough to run the models).

Who has two thumbs and a graphics card just begging to be used? Hello.

I was able to get the service setup on my machine and start playing around with it.

In this example, I used a prompt to essentially create a Bob Ross painting generator. “Alpine forest with river running through the middle, snow capped peaks in the background, Bob Ross style painting.”

Dalle mini forest

Pretty neat! The images that services like DALL-E 2 and Midjourney can create are miles better and I’ve applied to both services.

While I anxiously await my acceptance, I’ll have to continue generating various memes on my own machine.

Monkeys

Redactle – It’s like Wordle but for censored WIkipedia articles

Thanks to a coworker, my latest obsession is Redactle. Each day, it takes one of the 10,000 most popular articles from Wikipedia and censors every word that isn’t a common preposition or article. Each time you make a correct guess, the word is uncovered, slowly revealing more and more of the article. It’s sick and  it’s fun.

Essentially, this turns into an all day affair as I take breaks and then come back to try and solve the puzzle. Yesterday, I determined the article was about “Sparking Wine” after about 276 guesses… 🙀

Get guessing!

Fun with GPT-3

Earlier this evening, I was playing around with OpenAI’s GPT-3 language model for generating “human-like text.”

I gave it the following prompt:

Write a plot about a movie that involves rogue unicorns who want to
conquer Earth and the planet’s only hope is an Australian Cattle dog named Benson who sleeps a lot.

The response?

The unicorns, led by their king, Uni, have been planning their conquest of Earth for years. They have been observing the humans and have concluded that they are weak and vulnerable. The unicorns have developed a powerful magic that will allow them to take over the planet.


Benson, an Australian Cattle dog, is the only one who can stop them. Benson is a lazy dog who loves to sleep. He is content to spend his days lounging around and eating food. However, when the unicorns begin their attack, Benson is the only one who can stop them. He rallies the other dogs and leads them in a fight against the unicorns.

The unicorns are powerful, but they are no match for Benson and the other dogs. Benson is able to defeat Uni and the other unicorns, and the Earth is saved.

Summer blockbuster coming soon to a theater near you!

Creating an automated Twitter bot about gun violence

The school shooting in Uvalde last week was horrible. As a parent, I feel so powerless to protect my kids from something like that. Taking them to school the next day was extremely emotional.

It’s clear that we, as a country, are going to continue to do nothing about guns and gun violence. I channeled some of my emotion into building an automated bot for Twitter. I call it SABSStochastic Analysis for Ballistics Superfans (alternative title is “Second Amendment Bullshit”).

If you’re so technically inclined, you can download and run it yourself. Powered by Node and a fun little experiment into Twitter’s API.

It automatically replies to any congressional member who tweets.

Which of course includes unhinged Republicans.

Book Review: Columbine by Dave Cullen

The recent horrific (and all too frequent) school shooting in Uvalde is shocking, sickening, and absolutely impossible to understand. I can’t even begin to imagine what the parents of those children are even going through.

Dropping my kids off at school the day after this happened was especially emotional. I wasn’t the only parent wiping tears away from my eyes as we waved good bye to our little ones.

In an effort to try to understand more about these sorts of tragedies, I decided to read about the event (that I feel like) started this madness: the tragedy at Columbine.

I have a vague recollection of hearing about the news. I was in high school myself at the time, and I remember leaving school a bit early for a volleyball match against another school. As we were loading up the bus and getting ready to depart, I heard another student ask if anyone heard about “what happened at a high school in Colorado?”

At the time, we had little information and kind of just filed it away in the back of our mind.

It wasn’t until I got home later that night that I began to understand just how horrific it was. The media was quick to come up with scapegoats: music, video games, trench coats, loners who were bullied, etc.

We tried to comprehend it, even though we couldn’t. We also couldn’t imagine something like that happening again because it was so egregious. It was a random, unfortunate (and terrible) act, designed to inflict terror. We would move past it.

And we did… for a bit.

And then the school shootings kept happening. (And mass shootings in general.)


Dave Cullen’s book does a deep dive into the events around the massacre at Columbine — using journal entries and videos recorded from both the shooters and evidence sourced from the Jefferson County Sheriff’s Office. He creates a detailed timeline of the things that actually happened that day, and how the city has since tried to recover.

One of the things that stood out to me at first was how shockingly… normal Eric seemed. He had a lot of friends, got good grades, had girlfriends, and people generally had nice things to say about him. Deep down though, he was a true psychopath with a deep seated anger toward everything and everyone.

When he and Dylan were caught stealing electronic equipment from someone’s work van one night, they were assigned community service work and ordered to attend counseling services.

According to the counselors notes, he excelled at the program and always said the right things and displayed the right amount of humility and sorrow for what he had done. At the same time, he was writing in his journal at home about how much he hated the world and wanted everything to burn.

Eric was a full on psychopath in every sense of the term. A section in the book dives into this history of this psychological phenomenon.

Psychopaths are distinguished by two characteristics. The first is a ruthless disregard for others: they will defraud, maim, or kill for the most trivial personal gain. The second is an astonishing gift for disguising the first. It’s the deception that makes them so dangerous. You never see him coming. (It’s usually a him–more than 80 percent are male.) Don’t look for the oddball creeping you out. Psychopaths don’t act like Hannibal Lecter or Norman Bates. They come off like Hugh Grant, in his most adorable role.

In the wake of these mass shootings, people often talk about warning signs and mental health issues (but never the easy access to guns and the carnage they cause, because God forbid we ever talk about those). I myself have thought, “if only this person could have gotten therapy or been helped earlier, it might have changed things.”

Cullen digs into this with a simple answer regarding true psychopaths: it doesn’t work. An excerpt from the book:

Dr. Hare’s EEGs suggested the psychopathic brain operates differently, but he could not be sure how or why. […] Dr. Kent Kiehl wired subjects up and showed them a series of flash cards. Half contained emotionally charged words like rape, murder, and cancer; the others were neutral, like rock or doorknob. Normal people found the disturbing words disturbing: the brain’s emotional nerve center, called the amygdala, lit up. The psychopathic amygdalae were dark. The emotional flavors that color our days are invisible to psychopaths.

Dr. Kiehl repeated the experiment with pictures, including graphic shots of homicides. Again, psychopaths’ amygdalae were unaffected; but the language center activated. They seemed to be analyzing the emotions instead of experiencing them.

So what’s the treatment for psychopathy? Dr. Hare summarized the research on a century of attempts in two words: nothing works. It is the only major mental affliction to elude treatment. And therapy often makes it worse. “Unfortunately, programs of this sort merely provide the psychopath with better ways of manipulating, deceiving, and using people,” Hare wrote. Individual therapy can be a bonanza: one-on-one training, to perfect the performance. “These programs are like a finishing school,” a psychopath boasted to Dr. Hare’s team. “They teach you how to put the squeeze on people.”

To me, that was one of the most frightening passages in the book.

I don’t think this book helped me understand why these sorts of things continue to happen — can anything really do that? That said, it was a fascinating piece of investigative journalism that pieced together material from a variety of sources. I can’t say I enjoyed reading it (because the contents are obviously tragic and heavy), but I felt that it was interesting and informative.

Book Review: The Ministry for the Future by Kim Stanley Robinson

For me, this book was a bit of a slog to get through. I had originally started it early last year and had read pieces of it in fits and starts. It’s been partially read for nearly 12 months now, so I decided to try and finish it in earnest.

It’s an account of the near future, as drastic side effects due to climate change become more prevalent and catastrophic (the book opens with a heat wave in India that kills millions).

The story is told through a series of eyewitness accounts that take us across the world, detailing the effects of climate change and some of the (far-fetched and even fantastical) ideas people have to cope with it.

Some of the accounts and stories told by various characters are compelling, but a number of them are dry and uninteresting.

Eventually we get into current events and a discover a sort of utopia being created around the world to combat climate change together. Side note: the negative response of various groups of citizens and even some countries to the COVID-19 pandemic makes me think this sort of thinking is truly in the realm of fiction. Cli-fi if you will.

Anyway, I really couldn’t get into it. In general, I think I like the idea of Kim Stanley Robinson books more than I like reading them.

(That said, there are still a number of his other books on my bucket list that I will inevitably read.)

★★☆☆☆

Book Review: Integral Meditation by Ken Wilber

I’ve been making a conscious effort to be more mindful in various aspects of my life. Somehow, I stumbled upon this book (perhaps it was a Goodreads recommendation), and thought the blurb sounded interesting. Could this be what I need to take my mindfulness practice to the next level?

Uhhhhhhhhhhh. What?

First, the good news: I finished it!
The bad news: Seriously, what did I just read?

Okay, sure, maybe I should have been more familiar with “integral theory and practice” before I started reading this, (“more” meaning, any sort of familiarity at all). But come on, the blurb sold me: “a radical approach to mindfulness—combining an ancient meditation technique with leading-edge theory, resulting in a powerful new method of self-transformation.”

The 240ish something pages start off interesting. Ken Wilber makes an effort to explain what integral mediation is and how we can use it to grow up (not just wake up / achieve nirvana). This is the first I’d heard of “growing up” used in this context. Wilber uses various stages of human societal evolution as an analogy for the different aspects of growing up and becoming a better, more aware / awake person.

As the book goes on, it goes deeper down the rabbit hole of how awake you should be for given stages of your personal development and steps are needed to achieve the next level.

But as you progress through the book (and presumably through the levels), things seem to make a lot less sense and start to sound downright silly.

A random, out-of-context quote that highlights some of the word soup you’ll need to wade through:

“This, needless to say, was not an incentive to contemplative development, and the religious engagement of individuals increasingly focused on legalistic creeds, codes, and mythic-literal dogma of a particular stage of spiritual Growing Up, namely the mythic-literal. And so we ended up with the two major problems with religion in today’s Western world: no spiritual Waking Up, and rather low levels of spiritual Growing Up. Taken together, this is a cultural disaster of the first magnitude. I just can’t emphasize enough what a staggering nightmare this has been for Western civilization.”

Ultimately, it was a lot of random words jumbled together that I don’t entirely understand. There might be a time and place for reading it and getting something out of it, but I don’t think I will ever get there.

If you’re a Wilber fan, there’s probably a lot here you’ll like (it seems like others do). If you have no idea who this dude is and it’s your first time wading into one of his books (like me), I wish you the best of luck.

★★☆☆☆

Book Review: One Minute to Midnight by Michael Dobbs

“I think this is scarier than the Cuban missile crisis,” said my mom, as we recently chatted on the phone about the current events in Europe and the lack of response by the West due to the threat of nuclear war.

That seemed a bit extraordinary  — but then again, I realized how little I knew of the Cuban missile crisis. Sure, President Kennedy seemingly went “eyeball-to-eyeball” with Soviet Premier Nikita Khrushchev in 1962 and the world was this close (*makes pinching motion*) to nuclear armageddon. The Soviet Union eventually blinked and the world breathed a sigh of relief.

I’m always one to dig into history, and given the relevancy to current events, I decided to find the best book I could about this topic.

Oh, wow. This was a doozy.

It’s an hour-by-hour account of those stressful 13 days in October of 1962, switching between Washington DC, Moscow, and everywhere in between.

It’s surprising how close we actually were to war.

Kennedy agonized over whether to invade Cuba to remove the missiles, knowing that Russia would probably respond in kind in Europe. He had to balance the more hawkish elements of his cabinet (those who favored immediate airstrikes) with more diplomatic suggestions (remove nuclear missiles from Turkey and seemingly backstab a NATO ally).

A number of mistakes and miscommunication along the way didn’t help:

  • A U2 on a reconnoissance mission over Cuba was shot down by a Russian SAM site and the American pilot was killed. A highly ranked supervisor was off duty, so subordinates took it upon themselves to shoot down the plane, believing it to be part of an imminent attack on Cuba.
  • At the same time, a U2 on a high-altitude air sampling mission over the North Pole got lost, due to the aurora borealis (and being unable to properly sight stars for navigation), and ended up over Russia. Miraculously, the U2 made it back to Alaska (just barely). Russian fighter jets were scrambled to intercept the plane. American fighter jets were also scrambled to escort the plane and defend it, if needed. The kicker: the fighter jets were armed with nuclear-tipped air-to-air missiles and the pilots had ultimate authority on whether or not to use them. Fortunately, the Soviet fighter jets had returned to base by the time the American planes met up.
  • A Russian submarine that was being chased and harassed by American naval forces (who were dropping practice depth charges and grenades into the water) couldn’t surface at appropriate times to get the latest communications from Moscow. The captain of the sub feared that World War 3 could have already begun and they didn’t know it. The kicker: the sub was equipped with a nuclear-tipped torpedo that the captain had authority to fire if they felt they were in mortal danger.
  • NORAD reported an (erroneous) missile launch reading from Cuba that was headed toward Florida. By the time military officials realized it was a false alarm due to a configuration issue, the “missile” would have already landed.

Kennedy’s defense secretary, Robert McNamarama, was later asked how we managed to survive and avoid a nuclear war:

Luck. Luck was a factor. I think, in hindsight, it was the best-managed geopolitical crisis of the post-World War II period, beyond any question. But we were also lucky. And in the end, I think two political leaders, Khrushchev and Kennedy, were wise. Each of them moved in ways that reduced the risk of confrontation. But events were slipping out of their control, and it was just luck that they finally acted before they lost control, and before East and West were involved in nuclear war that would have led to destruction of nations. It was that close.

May we always be as lucky.