Category Archives: Hacks

Managing health overwhelm

Just finished this great episode from my favorite health nerds at Wild Health.

It’s a short, very accessible episode focused on how to do “not too much” health. It’s especially good because these are really data intensive folks that go deep on lots of different tailored practices. Here they talk about not doing all the trends, focusing on what actually helps you embody what you value in your life.

Counting to 90

I’ve been doing stretches in the morning.

This post is about that and a new meditative technique. It’s uh, the title.

My trainer, the incredible Christina, saw there were some exercises where I was limited by mobility, not strength. For a pistol squat, at a certain point I couldn’t go lower without tumbling over.

So, at the end of October she challenged me to do a set of stretches every morning for 30 days. It’s based on these from the Strength Side guys.

  • 1:30 Seiza
  • 1:30 Squat
  • 1:00 Downward Dog
  • 1:00 Crab
  • :45/side Long Lunge
  • :45 Horse Stance

Not too much! Too much doesn’t get done.

I’ve been using this on most mornings as a way to be silent, mindful, meditative and fully inhabit my body instead of jumping into a million thoughts and todos.

After I get the coffee brewing, I do these stretches before cooking breakfast. I’m doing it this way to take advantage of something I learned from my book club inspired reading of Atomic Habits by James Clear. I am setting up a chain where the obvious thing to do while the coffee brews is to do these stretches. Not look at all the slack messages from India that have piled up in the night. Not check my calendar. Not check the news. Just do my stretches while the coffee brews. This is actually working for me as a way to create a good habit. It feels great.

Just one thing is irritating though.

My timer going off on my phone after 1:30 is jarring. Setting the timer again is disruptive and lets me look at notifications. Midway through a stretch I find myself tapping the phone to see how much time is left (as if it matters!).

So I switched to just counting and it’s going great. One one-thousand, two one thousand…

Turns out if you just count and concentrate on the counting, you can get all the way up to 90 just fine. Turns out that counting helps me focus and be single-minded – it’s a meditation technique.

When I’ve finished counting and stretching, I find myself loose and ready and centered. I can eat, clean and get kids ready easily. I can thumb through notifications and Slack messages and make sure I’m ready for the agenda for the day. But I’m doing it because I’m done with what I wanted to do first in the morning.

Every Frame a Wallpaper

Years ago, Tony Zhou and Taylor Ramos made 28 video essays about film form called Every Frame a Painting and it’s incredible in teaching outsiders a whole new way to think about the art of film. The title is perfect. The content is just stunning, simple ways to look at masters of a form at work.

Lots of folks are known for one-shot takes, but this shows how Spielberg sneaks in gorgeous “oners” that do work without calling attention to themselves.

This essay on Fincher is great, but I love the little golden nugget about how spacing shows the evolving relationship between Mills and Somerset

That title always struck me. Every Frame a Painting. That’s gotta be a bar filmakers strive for. Some make it.

Some movies are just so damn beautiful. Just gorgeous.

Like Across the Spider-Verse. Yowza!

Like Sita Sings the Blues! Beautiful.

Like The Fountain

Like the one that you like that isn’t my cup of tea.

Might be nice to see an image from it, right there behind all of your terminals and windows and such, set as your wallpaper. If every frame’s a painting, set a random one as your wallpaper whenever I like it.

So here’s the plan. I want it. So I made it for me. You can have it. But here’s the terms of the deal. I made it for me, so if it doesn’t work for you, you have to make it work for you. If it causes you problems, those are not my problems. If you don’t agree, this isn’t for you.

This will take as an input a movie file, anything that ffmpeg can deal with. You’ll need to install ffmpeg – look on the official site for instructions.

By default, it won’t use the first 5 or last 10 minutes since that’s often the credits. But you can override this.

We’ll find out how many frames are in that remaining part of the movie.

We’ll pick one randomly and extract it from the movie.

Then we’ll set it as your wallpaper. Nice!

Want to change this often? Set up a cron job!

Pulling a single frame out the middle of a movie is CPU intense, so you probably want to use nice in your cron job so it doesn’t interfere with the rest of your work.

Here’s the code, save this in a file called every_frame_a_wallpaper.zsh and then chmod u+x every_frame_wallpaper.zsh

#! /bin/zsh
# This is a pretty processor intensive set of tasks! You should probably nice this script
# as in call it with nice -n 10 "every_frame_a_wallpaper.zsh /path/to/video.mkv"

SCRIPT_NAME=$(basename "$0")

# I like a nice log file for my cron jobs
function LOG() {
  echo -e "$(date --iso-8601=seconds): [$SCRIPT_NAME] :  $1"
}

# set up some options
local begin_skip_minutes=5
local end_skip_minutes=10
local wallpaper="$HOME/Pictures/wallpaper.png"
local usage=(
	"$SCRIPT_NAME [-h|--help]"
	"$SCRIPT_NAME [-b|--begin_skip_minutes] [-e|--end_skip_minutes] [<video file path>]"
	"Extract a single random frame from a movie and set it as wallpaper"
	"By default, skips 5 minutes from the beginning and 10 from the end, but this is overridable"

)

# the docs suck on zparseopts so let this be a reference for next time
# -D pulls parsed flags out of $@
# -F fails if we find a flag that wasn't defined
# -K allows us to set default values without zparseopts overwriting them
# Remember that the first dash is automatically handled, so long options are -opt, not --opt
zparseopts -D -F -K -- \
	{h,-help}=flag_help \
	{b,-begin_skip_minutes}:=begin_skip_minutes \
	{e,-end_skip_minutes}:=end_skip_minutes \
	|| return 1

[[ -z "$flag_help" ]] || {print -l $usage && return }
if [[ -z "$@" ]] {
   print -l "A video file path is required"
   print -l $usage && return

} else {
   MOVIE="$@"
}

if [[ $DISPLAY ]]
then
  LOG "interactively running, not in cron"
else
  LOG "Not running interactively, time to export the session's environment for cron"
  export $(xargs -0 -a "/proc/$(pgrep gnome-session -n -U $UID)/environ") 2>/dev/null
fi

LOG "skipping $begin_skip_minutes[-1] minutes from the beginning"
LOG "skipping $end_skip_minutes[-1] minutes from the end"
LOG "outputting the wallpaper to $wallpaper"
LOG "using file $MOVIE"

LOG "Let's get a frame from ${MOVIE}";


LOG "What's the duration of the movie?"
DURATION=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 \
  $MOVIE);
DURATION=$(printf '%.0f' $DURATION);

LOG "Duration looks like ${DURATION} seconds";

LOG "what's the frame rate?"

FRAMERATE=$(ffprobe -v error -select_streams v:0 \
  -show_entries \
  stream=r_frame_rate \
  -print_format default=nokey=1:noprint_wrappers=1 $MOVIE)




FRAMERATE=$(bc -l <<< "$FRAMERATE");

FRAMERATE=$(printf "%.0f" $FRAMERATE);

LOG "Looks like it's roughly $FRAMERATE"

FRAMECOUNT=$(bc -l <<< "${FRAMERATE} * ${DURATION}");
FRAMECOUNT=$(printf '%.0f' $FRAMECOUNT)
LOG "So the frame count should be ${FRAMECOUNT}";


SKIP_MINUTES=$begin_skip_minutes[-1]
SKIP_CREDITS_MINUTES=$end_skip_minutes[-1]

LOG "We want to skip $SKIP_MINUTES from the beginning and $SKIP_CREDITS_MINUTES from the end".

SKIP_BEGINNING_FRAMES=$(bc -l <<< "${FRAMERATE} * $SKIP_MINUTES * 60");
LOG "So $SKIP_MINUTES * 60 seconds * $FRAMERATE frames per second = $SKIP_BEGINNING_FRAMES frames to skip from the beginning."
SKIP_ENDING_FRAMES=$(bc -l <<< "${FRAMERATE} * $SKIP_CREDITS_MINUTES * 60");
LOG "So $SKIP_CREDITS_MINUTES * 60 seconds * $FRAMERATE frames per second = $SKIP_ENDING_FRAMES frames to skip from the ending."

USEABLE_FRAMES=$(bc -l <<< "$FRAMECOUNT - $SKIP_BEGINNING_FRAMES - $SKIP_ENDING_FRAMES");
UPPER_FRAME=$(bc -l <<<"$FRAMECOUNT - $SKIP_ENDING_FRAMES")
LOG "That leaves us with ${USEABLE_FRAMES} usable frames between $SKIP_BEGINNING_FRAMES and $UPPER_FRAME";

FRAME_NUMBER=$(shuf -i $SKIP_BEGINNING_FRAMES-$UPPER_FRAME -n 1)
LOG "Extract the random frame ${FRAME_NUMBER} to ${wallpaper}";
LOG "This takes a few minutes for large files.";
ffmpeg \
  -loglevel error \
  -hide_banner \
  -i $MOVIE \
  -vf "select=eq(n\,${FRAME_NUMBER})" \
  -vframes 1 \
  -y \
  $wallpaper


WALLPAPER_PATH="file://$(readlink -f $wallpaper)"
LOG "Set the out file as light and dark wallpaper - using ${WALLPAPER_PATH}";
gsettings set org.gnome.desktop.background picture-uri-dark "${WALLPAPER_PATH}";
gsettings set org.gnome.desktop.background picture-uri "${WALLPAPER_PATH}";

In my crontab I call it like this:

# generate a neat new background every morning
0 4 * * * nice -n 10 ~/crons/every_frame_a_wallpaper.zsh -b 5 -e 12 /home/mk/Videos/Movies/Spider-Man_Across_the_Spider-Verse.mkv >> ~/.logs/every_frame_a_wallpaper/`date +"\%F"`-run.log 2>&1

Automated export of your goodreads library

Goodreads used to have an API but they stopped giving access and it looks like they are shutting it down. A real garbage move.

I like to be able to use my data that I put in so I wrote a script to automatically download my data regularly. Then I can do stuff like check to see if books I want are in the library or keep my own list or analytics, etc.

Here’s the python script to export your good reads library, hope it helps you. I’ll put it in the public domain.

Updated to add: I got tired of dealing with places that do garbage moves. I left GoodReads for BookWyrm and it’s better.

o no its ringing o no

How to do a crisis call in technology

This started as an answer on Reddit that someone thought was good enough to gild. So I thought I’d expand it here while Lil Z is sleeping in case it helps more folks. Some tech folks really wanted to know how to talk to business people on troubleshooting conference calls. I’ve seen this done well and done poorly and I have strong opinions on the subject.

The System is down.

It isn’t doing the Thing it does and many, many people are desperate to get the Thing for important money reasons.

You are supposed to bring the System up.

The suits, who are measured on money stuff they can’t do without the Thing, feel terrified. They feel helpless. They can’t bring the System up, they need you to do that. You geeks want to concentrate, think silently, occasionally type things and mutter to each other. That is useless on the big conference call and just inspires anxiety. The day job of a suit usually involves being informed and making decisions – and they can’t do either.

Here is how you do a crisis call right:

1. There is a suit facing call and a geek facing call. Geek talk isn’t the same as suit talk. Perfectly reasonable geek talk (“a reboot will cause us to lose unsaved data”) cause suits to overreact and cause more problems.
2. The talkiest nerd gets to be in charge of communication. That’s their job, not troubleshooting.
3. They go back and forth, figure out status and direction and make real estimates. They give regular updates to suits and give direction to the geeks.

Two Calls

It’s important that you tell people status – if you don’t promise status at regular intervals, they will try their best to go find things out or try to help. They will interrupt the people doing the work so that they can get information they need to deal with their immediate problems.

Geeks get angry when questions interrupt troubleshooting because they think the problem is that the System is down. That isn’t really the problem – no one cares about the System but the geeks. The problem is that the Thing isn’t happening. If they could get the Thing without the System, they would – and that might be a solution you can offer.  The suits may be very happy with you taking a long time to fix the System if you can give them the Thing at regular intervals or on demand until the System is back up.

Folks at Krispy Kreme don’t care about the beautiful donut glazing machine as much as they care about devouring delicious hot donuts.

The Talkiest Nerd does the talking

The talkiest nerd can fulfill a very important role by giving status, information and choices to the suits. Let the suits actually make choices based on good information! They should make those decisions so they can make the money stuff happen! The whole reason suits employ geeks is because they need the Thing to make the money stuff happen – they need to know that they aren’t going to get the Thing for at least 4 hours because then they can tell customers to be calm, they are going to get compensated – or they can tell customers don’t worry – we’ll have the Thing within 4 hours.

Timely Updates

Another important point here is Timely updates. Set a schedule and then keep to it. If you say I’ll give you updates on this conference call every 30 minutes or every 15 minutes, then do it. The talkiest nerd can interrupt everyone 5 minutes before on the geek call and make sure they’ve got a good handle on things so they can give a real status.

The reason you make Timely updates is so that people can deal with silence. The big worry is that no one is working on things or that they are working on the wrong thing. Remember, the suits are feeling an unwelcome sense of helplessness. They can deal with silence if they know that they need to be back on the call at X time to get the next status.

It is important to give them some chill so that they can go and do the very important work of handling the downstream problems of the Thing not happening. They can go work on that knowing what’s happening in the next 30 minutes.

Things To Say

  • We have X people looking at the issue and this is our Y priority.
  • We have an idea what the issue is and we are testing it to make sure we are fixing the right thing.
  • It will take about X minutes to confirm and we’ll next update you with status at 11:45.
  • We were wrong and now we think the problem is X and we’re testing that idea.
  • We think we know what’s wrong. Here is an ELI5 short description and here are two ways we think we can solve the problem. Here are the high level time and danger trade offs in those solutions and here is the one the geeks recommend for the following reasons. (Let them actually make an informed choice here)
  • We don’t have any updates right now. This is tricky and X people are discussing the best next steps. We don’t see how we can get this solved before our next status update at 12:30, but we’ll blast out a message if anything changes drastically.
  • We’re manually handling a certain type of problem – please put a list together of the clients you want ordered by priority and we’ll handle them in that order and let you know when each is done.
  • The problem should be wrapped up in X minutes and we will handle any other issues resulting afterwards.
  • Tomorrow we will be rested and have a thorough look into what went wrong, how it wasn’t caught earlier, what warnings we can put in and how we can handle it better next time.

Why should you believe me?

Since 2003 I’ve worked in finance and technology, often as the face of technology to the business. Things have gone wrong and I’ve seen good communication and bad communication. In places where the business trusts tech to handle a crisis, these kinds of patterns have worked. I’ve also worked in places where there was a terrible relationship between technology and the business: patterns like these helped improve things.

Ginsperiment results

image

See my initial post on barrel aging/oaking Breukelen Gin.

That was way faster and better than I expected. I tested with friends after only 2 weeks. Decided to remove the oak cubes as they were both very good already.

12g to 9oz is definitely enough for the oak cubes. Might do less but for longer next time. 16g kind of overpowers the gin.

I used Breukelen gin because my pal Tove Hermanson shared a rare-ish bottle of barrel aged Breukelen gin and it was weird and wonderful. It tastes like a really flowery whiskey full of that same caramely smooth warmth. Like looking at butterflies as a summer sun sets.

Now to whip up some more batches!