Category Archives: Pals

Hosting better screencasts in WordPress

When I was writing up a note about pingplotter I figured I should show how it works because that’s much better for understanding it.

This gobbled up an incredible amount of time, so I’m writing it down so I never have to figure it out again.

There’s a few terminal screencast recorders out there, but I picked asciinema since it seemed simple, it recorder everything as text, not an image and it seemed a very light format to playback. These things are true, and the pain I felt is mostly unrelated to any failings of asciinema.

Asciinema is great. I can record a session locally, play it back to check locally and then upload it to their hosting to share. All pretty cool!

# record a session, but skip pauses over 1 second
asciinema rec -i 1 pingplotter.cast
asciinema: recording asciicast to pingplotter.cast
asciinema: press <ctrl-d> or type "exit" when you're done
# type a bunch of things to demo
# then ctrl-d to stop recording
asciinema: recording finished
asciinema: asciicast saved to pingplotter.cast

# time to check to see if it was any good
asciinema play pingplotter.cast
# the saved session plays back

# good enough!
asciinema upload pingplotter.cast 
# asciinema gives you the URL of the upload
# you can give it a description and make it public

Since this website is still powered by WordPress, I wanted to share it here. The Asciinema url didn’t embed automatically, so I figured I could either embed a script from Asciinema or add a plugin to do the embed code.

Both of these failed – somehow the javascript from Asciinema wasn’t working in my Firefox. It worked in Chrome, but that’s not good enough. I figured I should just host the cast myself! Why do I need to embed this tiny file or load javascript or install plugins to do this?

I found a neat utility to convert an asciicinema screencast to an animated SVG.

Listen, SVG and animated SVG is incredibly powerful, and if you don’t know, you should learn about it. Animated gifs are heavy, don’t resize, and are full of rendering artifacts. SVG are vector graphics, which mean they are infinitely scalable up or down crisply in a much smaller size than most gifs. Every modern mobile and desktop browser supports them.

The cool utility is svg-term. It lets you take an asciinema file and turn it into an animated svg.

It’s very nicely made, but is unfortunately distributed with npm, a package manager designed to ruin you. The instructions svg-term gives you to install it are incredibly dangerous unless you know to set up your npm install to not install packages with root privileges, WHICH FOR SOME REASON ISN’T THE DEFAULT OR EVEN POSSIBLE. I looked at the npm documentation for something like pip install --user, but it doesn’t exist. Instead, the solution is to redefine global installs to mean user local installs. I’m not kidding.

I don’t want to ever have to figure this out again either, so I added it to my jumpstart script so it will be ready for the next computer I use.

cat pingplotter.cast| svg-term --out ~/pingplotter.svg

This worked great! I went to upload it to my WordPress site to share with you. It did not work great!

WordPress very reasonably recognizes that while I enthusastically love SVG, it can be a security hole. SVG files can embed all sorts of foolishness like JavaScript and other loopholes to escalate privileges. So WordPress prevents them from being uploaded. I opted to allow them with a plugin that sanitizes SVG files to remove the dangerous stuff but allow the rich graphical goodness. This worked great!

I then decided to demo using tmux and glances, which meant I had to do a lot more typing in the demo, which expanded the size of the screencast. Poor svg-term began to crap out because I was exceeding the size of the javascript heap by feeding it a file larger than 1 mb. Fair enough, I don’t want to have a big file anyway!

The solution here is to script as much as possible ahead of time. The asciinema commandline takes a -c command argument which makes it execute a command as soon as it startes recording. Since tmux also lets you script up what you want it to do, I ended up with this.

asciinema rec -i 1 -c 'tmux new "pingplotter ; read" \; split-window "glances ; read" \; select-layout even-horizontal' pingplottertmux.cast

I’m telling asciinema to open up tmux and start recording. I’m telling tmux to start with pingplotter in a window, then open a new pane with glances and make the layout side-by-side. Each of those panes will close when the command they are running is done. Now I can just use ctrl-a <space> a few times to rotate the layout, ctrl-c to kill the panes, tmux exits and asciinema stops recording.

The file size ended up being small enough for svg-term and now you get this!

Anyhoo, black people are human beings with real lives and I don’t want my tax dollars to be used to murder them. Please, call your city representatives to urge them to shrink the police budget and use that money for social services that prevent crime and pain. If you can’t figure out your local representation, please learn how. If you won’t, please at least call your federal reps to ask them to stop giving the city police things like machine guns and tanks.

Pingplotter

I need to see if my remote connection to work is healthy and if my remote connection to video conferencing is suffering.

I wrote a little utility to handle that in the commandline. It’s dumb but it works. Let’s call it pingplotter. It’s in the public domain, go nuts.

It’s fine to just pop in a terminal you have open, but it plays really nice with tmux and glances (I use both).

I think I spent nearly as much time making these screencasts as I did writing the shell script. I should blog that too, if only so I don’t have to research that again.

Max silhouetted against glorious fireworks

Plague update 2

I didn’t think America was ever going to take black lives seriously in my lifetime. I’m close to thinking we might. There was finally a murder so slow and egregiously awful by police that it seemed fewer people came out to defend it than normal. People protested – which has happened before, but this time the police responded swiftly and brutally all over the nation, which helped more people realize the urgent need to demilitarize and defund or abolish police departments all over the nation.

More people have been murdered by police and by right wing activists. More people are seeing that there is significant infiltration of right wing racist groups into military and civilian armed forces like the police and the national guard. Significant effort seems to be put into either pretending the grievances we list are fake or that protesters are the same as rioters or into sparking riots to give a chance for crackdowns or to trigger broader societal conflict and breakdown.

The plague of systemic racism is getting acknowledged and the movement is being recognized enough to be co-opted. Many states have decided to paint a road with “Black Lives Matter” which is nice. None have revoked qualified immunity. Still, this co-option is a good sign – people are uncomfortable enough to start making the most basic gestures. DeBlasio still sucks. He can’t get the road painted in front of Trump Tower because he sucks. He and the City Council failed to defund the NYPD, instead shuffling money and police officers around.

Still the streets fill with people angry that they have to fight for simple recognition that black lives matter and the police are not here to protect or serve them. Even in the tiny village of Saugerties, people are showing up every day to stand vigil with their plague masks on.

I hope that we can skip reforms and channel some of our vast wealth into things that benefit people instead of control them.

In our home, we are much more settled into a routine. I’ve got a space to work. Max has rules around how he can earn precious screentime by doing workbooks or reading a new book. Zelda has similar… She’s learning to count and does M&M math with me because she’s insatiably into chocolate. Sam’s growing an impressive number of things outside, where the filthy dirt is. I’m no farmer, but it’s really nice to eat a sandwich with your own lettuce in it! Today she showed me where beans are coming up near some corn.

It’s been a ton of activity around here for home improvement. I’ve built a pretty large stone patio by leveling one stone at a time. Sam came up with the idea of putting an outdoor rug over it and it looks great – gotta finish the edges somehow though.

Sam’s gardening has been huge – we’ve got plants everywhere and it looks amazing. Together, we built some raised planters and they are full of the three sisters: corn, beans and squash. She tore out our old sink since there was a leak that screwed up the cabinet and we put in the replacement. We also tore out the old vent exhaust light and put in a new one – plus a better light for the entranceway. Sam bought a tiny washer and got it installed near the kitchen so we can continuously wash clothes. Speaking of continuously washing, we have to continuously wash dishes since we don’t have a dishwasher and don’t want to be set upon by insects.

We celebrated July 4th in style with a TON of fireworks. The neighbors applauded.

I’m working too many hours because work bleeds into everything when it is so close. I also think we are all sick of sitting around the house – the newness has worn off and we crave change. I started running with Zombies, Run to explore the neighborhood. I registered for a virtual fitness championship, and tomorrow afternoon I’m going to try to submit my first workout.

We’re still getting out and exploring.

That picture is from earlier on the 4th. To get here you park your car by the side of a road on the path through the Catskills on the way to hunter mountain. You hop a guardrail and navigate the rock fill to get down to this paradise of mountain streams and waterfalls everywhere.

Hike down a bit and we came to little pools dug into the bedrock, natural water slides and everywhere it was gorgeous.

It was amazing. The mostly black and brown families around us had managed to bring music, barbecues, hookahs, kids – it was amazing. We left as it got packed. When I got to the road, of course the police were ticketing and towing cars. We got a $75 ticket.

Worth it.

The federal government is paralyzed from the top down, offering no solutions, only misinformation and confusion. As NY is beginning to be less wildly dangerous, other states are beginning to see their lax policies have the same payoff as Cuomo and DeBlasio’s initial bungling. Here in Saugerties I see some restaurants reopening with “social distancing” but it’s very poorly observed. Here’s an idea: people can’t be trusted to make smart decisions when they are drinking. So no wonder I’m seeing even in big open spaces people hopping from group to group, saying hello and hugging with masks around their necks. Places that haven’t seen ice trucks holding bodies are probably going to have to experience it for themselves.

I told Max we might not be back in Brooklyn for a long time or that we might sell our place so he could have a place with a backyard and more room. He seemed heartbroken by the idea – I think I really messed up. He could articulate that he missed it and it was special to him. But given that we think there’s very little chance the schools can safely reopen by September, what can we do? I think about how I never felt attached to the second place we moved to in Colatown.

As always, our problems pale in comparison to what’s happening around us.

Since my internet connection is crucial to my work these days, I wrote a little utility to graph ping time so I can see if things are going wrong early. I’ll neaten it’s up and share it.

Just looked up and realized it’s tomorrow so I’m gonna schedule this to publish in a few hours and get some sleep. Let this be a reminder to me to never mess with .htaccess rules again.

Plague update

A drawing by Max of him and Dad hiking and doing a “skramble”

We’ve been weathering the Coronacrisis upstate in Saugerties. It was immediately clear that trying to work full time remotely while educating a 2E kid and a toddler in a small apartment was going to end up in an Overlook Hotel situation.

Up here we have a backyard with a a swing and some room to run. Put in a trampoline. On the weekends we can go for hikes.

Max in a sweet pose with Sam and Z in the background at the Esopus creek nature preserve

Max says he’s forgetting his home because he’s been up here so long. On the bright side he’s also much more interested in hikes and walking outside. He’s noticing that and thinks it might be because there’s less noise outside up here.

Queen Z with a stick she was twirling

Zezus has been having a grand time. Hikes wear her completely out. She’s been doing walks around the block and stomping in puddles with me. Bath times are capped by putting on pajamas in front of the fire.

We’re still trying to find a balance so that Sam isn’t overwhelmed and I can get some work done. Trying a new schedule with some explicit breaks for each of us. Trying to just be more chill with each other and be ok that the kids are gonna get more screen time.

Sam being abused by a pile of tiny monster children

Welding

Did a little welding class last night. I got to practice Oxy-Acetylene welding one on one because no one else wanted to weld on a hot summer night in the Brooklyn Navy Yard.

Since it was just me I got to do more with the instructor and we did both brazing and actual steel welding. Tons of fun. My final project was a little Z-Z tea light holder!