Category: technology

Woe is Twitter…

To the tune of R.E.M’s “End of the World”:

“It’s the end of the (Twitter) as we know it, and I feel fiiiiiiinnnnneeee!” via… me.

I don’t have high hopes for the future of Twitter, pending Elon’s acquisition. It’s a service I’ve long loved, been frustrated with, but also found immense value in.

I’ve gotten jobs because of it, made new friends because of it, learned a lot because of it. Granted, it’s gotten much more toxic and I long for the days when it was fun.

But I don’t think having this service in control of a self-proclaimed internet troll who has lurched evermore rightward is going to improve things. Alas.

Punk Rock Obama

I think it’s time to end my AI art career on this high note. Generated with Stable Diffusion, running on my local machine.

The prompt:
“beautiful portrait painting of Barack Obama with a purple mohawk on top of his head shredding on an electric guitar at a punk rock show, concept art, makoto shinkai, takashi takeuchi, trending on artstation, 8k, very sharp, extremely detailed, volumetric, beautiful lighting, wet-on-wet”

Punk Rock Obama

MidJourney – AI Art Madness

A few short weeks ago, I had downloaded a simplified model for generating AI-created images on your local machine. The internet (myself included) had a lot of fun with it, but the quality was definitely lacking, especially when compared to the more serious AI image platforms being created by some big companies.

I recently received my invite to the MidJourney beta and I am just blown away!

For now, I’ve just been putting in ridiculous prompts that simulate styles for various artists (oh, man. I have a feeling this is going to piss off a lot of artists in the future…)

For example: “Apocalyptic wasteland with crumbling buildings and debris, thomas kinkade painting”

The potential here is pretty crazy — for people who aren’t artistically inclined, they can start generating images and scenes based on what they come up with. Some people can probably use this as a base to get to rapidly start iterating on new ideas. And of course, others are going to be mad.

A lot of the detail in creating these images is how you create the prompt. You’re already seeing the phrase “prompt engineering” being used in various places — check out this Twitter search.

For me though, I’m excited about this new technology and it’s something I’ve been eager to play with.

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

Book Review: Deep Work by Cal Newport

The pandemic forced a change in the way many knowledge workers work. Many of us have shifted to working from home — some roles are permanent.

I’m fortunate to be in such a position, but it’s been both a blessing and difficult to adjust to.

Distractions are frequent. From regular Zoom meetings, Slack messages and various alert notifications, to email. I think a number of people (myself included) are over compensating in our communication styles.

For software engineers, this causes a lot of context switching. And that’s generally a bad thing.

Context switching can lower productivity, increase fatigue, and, ultimately, lead to developer burnout. Switching tasks requires energy and each switch depletes mental focus needed for high cognitive performance. Over an entire workday, too many context switches can leave developers feeling exhausted and drained.

The impact of context switching lingers even after switching tasks. Cognitive function declines when the mind remains fixated on previous tasks, a phenomenon known as attention residue.

I’ve recently felt myself feeling drained and less productive that usual. While browsing a thread on Hacker News, a comment on Hacker News suggested that someone should read Deep Work by Cal Newport for ideas on how to regain focus and minimize distractions. It was the first I’d heard of that book.

It was pretty enlightening and I was pretty hooked!

It has a number of self-help style steps (that are somewhat obvious, in hindsight) that you can take to improve your situation and increase productivity (e.g., carve out set times when no one can bother you, like early in the morning or late at night, keep consistent times, set reasonable expectations and have a plan, don’t wing it).

But it also had shared some interesting research on how our brains have been rewired to have shorter attention spans, thanks to all our fancy pants technology.

“Once your brain has become accustomed to on-demand distraction, Nass discovered, it’s hard to shake the addiction even when you want to concentrate. To put this more concretely: If every moment of potential boredom in your life—say, having to wait five minutes in line or sit alone in a restaurant until a friend arrives—is relieved with a quick glance at your smartphone, then your brain has likely been rewired to a point where, like the “mental wrecks” in Nass’s research, it’s not ready for deep work—even if you regularly schedule time to practice this concentration.”

Yeah… guilty.

Anyway, definitely want to put some of these ideas into practice. It was a quick read and had some concrete steps on how to improve attention and focus that I can start using immediately. Excited to try it!

Deep Work by Cal Newport

Experimenting with parallel computing using node worker_threads

I’ve wanted to play around with worker threads in Node JS, so I put together this little repository that demonstrates how it all works. Check it out here.

In order to simulate multiple threads that are each processing data, each worker thread uses a randomly generated timeout between 100 to 700 milliseconds. In addition, it has a random number of loops (between 10 and 1000) that must be completed before the worker is terminated.

It’s kind of fun to watch the tasks run and automatically complete inside the terminal (check out the screenshot of the output up top).

Troubleshooting a (Royal) Kludge (RK G68): Sleep issues with my swanky new mechanical keyboard

TL;DR After a lot of testing and isolating devices, I’ve determined that the RK G68 RF receiver for my swanky new mechanical keyboard causes my Windows 10 machine to wake up immediately after putting it to sleep. And I’m not sure how to fix it.

Join me on an epic journey of heartbreak, anger, loss, triumph and sadness as I try to diagnose some sleep issues.

—-

So, the issue is that if I manually put my computer to sleep (Start Menu -> Power -> Sleep), the machine goes to sleep, fans turn off, and all that. Sweet! Then, after about 5 seconds, it wakes right back up. Uh, what?

I’ve done a number of debugging and testing steps which I’ll outline below (hopefully, this helps some folks in the future).

Let’s do a couple of finger stretches, put on our hacker pants, and open up PowerShell (with admin access). We can run a nifty command called powercfg /requests

I see the following output:

DISPLAY:
None.

SYSTEM:
None.

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
[DRIVER] Legacy Kernel Caller
Power Manager

ACTIVELOCKSCREEN:
None.

Great! But not really super helpful. We visit our friend, Google, and I see that there is a command to disable this:

powercfg -requestsoverride Driver "Legacy Kernel Caller" System

You haven’t lived until you’ve copy and pasted random commands from the Internet into your terminal. Let’s do it! I run that and make the computer go to sleep again. Monitor turns off, fans spool down. Yes! Yes?

Obviously, it immediately wakes up. No dice.

Ah, ha! Maybe read the command first, dude? The issue here is that the Legacy Kernel Caller is in the PERFBOOST category, not SYSTEM category. That’s easy to fix.

…but it isn’t.

Of course, you can’t actually disable the driver for items in the PERFBOOST category. Of course.

Hey, Google…

Next up: A suggestion to check waketimers. I have no idea what that is, but sure: powercfg -waketimers

There are no active wake timers in the system.

Okay.

Yo, Goooooooogle… again!

Ah, another command! powercfg -lastwake

Now we’re getting somewhere. We see that this is a USB device that is waking the computer:

Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Device
    Instance Path: USB\VID_25A7&PID_FA70\8&e5ec113&0&4
    Friendly Name:
    Description: USB Composite Device
    Manufacturer: (Standard USB Host Controller)

But… how do we determine what it is? Looking at the path, we see VID and PID. That means:

Vendor ID: 25A7
Product ID: FA70

Let’s Google those: It turns out, the vendor is Areson Technology Corp and it looks like they make RF receivers for various input devices, such as wireless mice. Interesting! No hits for the product ID. That’s fine, there’s probably more types of RF receivers on planet Earth than there are people.

But that gives me a starting point.

I decide to start unplugging various devices and put my computer to sleep.

  • Unplug Logitech USB receiver: Still wakes up.
  • Unplug Anker USB Bluetooth receiver / transmitter: Still wakes up. I feel like I’m not having much fun anymore.
  • Unplug this random, unlabeled RF receiver: Hey, my keyboard input stopped working from my mechanical keyboard! Ah well. Go to sleep computer…

IT DOESN’T WAKE BACK UP!!!!

Victory. Party dance. Switch out the hacker pants for party pants. Now we’re getting somewhere!

I plug the receiver back in and open device manager. I go to the keyboard section (randomly, there are like 4 different devices listed there). I open the properties dialog box for each of them, go to the Power Management tab and uncheck “Allow this device to wake the computer.

I got you now, pesky sleep problems! :blow-smoke-off-gun-gif-dot-com-dot-net:

I put the computer to sleep.

IT IMMEDIATELY WAKES BACK UP!

I’ll be honest. There was a lot of screaming, kicking, swearing. My dog got up and left the room (he never does that). I almost knocked over a coffee cup onto my keyboard and I DIDN’T CARE.

Okay, fine.

No big deal, really. I’m not okay, you’re okay.

On a hunch, I expand the Universal Serial Bus controllers section inside the device manager. Sure enough, there are a bunch of things that say USB Composite Device. You might remember from earlier (but probably not), that a “USB Composite Device” was called out using the --lastwake command.

If you open up the properties for each USB Composite Device and go to the events tab, you will see the device ID in the information section. Keep looking until you find the device ID that was called out: USB\VID_25A7&PID_FA70\8&e5ec113&0&4

Click. Close. Click. Close. Click. FOUND IT!

Device USB\VID_25A7&PID_FA70\8&e5ec113&0&4 was configured.

Driver Name: usb.inf
Class Guid: {36fc9e60-c465-11cf-8056-444553540000}
Driver Date: 06/21/2006
Driver Version: 10.0.19041.488
Driver Provider: Microsoft
Driver Section: Composite.Dev.NT
Driver Rank: 0xFF2003
Matching Device Id: USB\COMPOSITE
Outranked Drivers: 
Device Updated: false
Parent Device: USB\VID_0BDA&PID_5411\7&b8f002b&0&2.

Sweet, now to just open up the Power M…. THERE IS NO POWER MANAGEMENT TAB.

My dog came back. He immediately left again. You can probably guess why.

Back to Google again:

“Ensure drivers are updated”.

Okay. Sure. Blah, blah. But maybe it’ll work. It won’t though. I already know. Who am I kidding?

The best drivers for your device are already installed.

Fine. I’ll just uninstall the driver.

Oh, cool, now my keyboard doesn’t work.

BUT YOU KNOW WHAT?! MY COMPUTER STAYS ASLEEP!

Head, meet Desk. Desk, meet Head.

—-

A few other things to note.

    • If I have a USB-C cable plugged into the keyboard, it will stay asleep (even though the RF receiver is still plugged in).
    • If I turn off the keyboard itself, it will stay asleep.
    • If you just walk away from the computer, it will go to sleep (according to my power plan settings — 15 minutes). I suspect this is because the RK software (I’m on version 2, by the way, which I think just came out and the latest firmware) is setup to put the keyboard to sleep after about 5 minutes or so. I really haven’t tried to experiment with this because I DON’T CARE ANYMORE.

(I do care. Deeply. I just can’t right now.)

3 weeks of GOES-17 imagery: hurricanes, wildfires and more

I recently built a side project recently that automatically downloads GOES-17 imagery every 10 minutes and then compiles it into a video.

The result is pretty darn awesome! Here is 3 weeks of GOES-17 imagery sourced from NOAA / CIRA / RAMMB. The video begins the night of August 15th, 2020 as lightning storms rolled through Northern California and runs until the afternoon of September 10th, 2020.

Almost immediately, you begin to see smoke plumes from fires created due to lightning strikes.

Note: The blue and yellow blocks that you see periodically flash on screen are the result of corrupted image data downlinked from GOES-17. I’m not sure exactly what causes this, but these errors are present within the original images files hosted on NOAA’s CDN.

(Be sure to bump up the video quality — YouTube’s default compression really ruins the image)

We are all just algorithms…

I’ve long joked that “we’re all just algorithms in some engineer’s machine.”

But it’s kind of true.

I recently finished reading Homo Deus: A Brief History of Tomorrow by Yuval Noah Harari, which imagines what the lives of our children, grandchildren, and beyond will be like and how technology will affect them.

We generate copious amounts of data each day and give our personal electronic devices and social networks almost unfettered access to all of it. Everything from how long we sleep, how often we exercise, where we go each day to the types of songs, movies and books we like.

There was one passage from the book that I found both amazing and frightening:

A recent study commissioned by Google’s nemesis – Facebook – has indicated that already today the Facebook algorithm is a better judge of human personalities and dispositions than even people’s friends, parents and spouses. The study was conducted on 86,220 volunteers who have a Facebook account and who completed a hundred-item personality questionnaire.

The Facebook algorithm predicted the volunteers’ answers based on monitoring their Facebook Likes – which webpages, images and clips they tagged with the Like button. The more Likes, the more accurate the predictions. The algorithm’s predictions were compared with those of work colleagues, friends, family members and spouses.

Amazingly, the algorithm needed a set of only ten Likes in order to outperform the predictions of work colleagues. It needed seventy Likes to outperform friends, 150 Likes to outperform family members and 300 Likes to outperform spouses. In other words, if you happen to have clicked 300 Likes on your Facebook account, the Facebook algorithm can predict your opinions and desires better than your husband or wife!

This is one of the main reasons why both Google and Facebook have some of the largest (and most effective) advertising networks on the internet.

They fundamentally know who you are and what you like and know us better than we know ourselves.

Indeed, in some fields the Facebook algorithm did better than the person themself. Participants were asked to evaluate things such as their level of substance use or the size of their social networks. Their judgements were less accurate than those of the algorithm.

Excerpts from “Homo Deus: A Brief History of Tomorrow” by Yuval Noah Harari.