Remove the first few lines from a string in PHP

by @edent | # # # | 1 comment
Binary code displayed on a screen.

Problem: I have a multiline string - not a file - and I want to remove the first few lines from it and keep the rest. I found this surprisingly unintuitive. So these are notes in case I want to do it again. Feel free to suggest a better way! Example Given this input: $str…

Continue reading →

Turn an old eReader into an Information Screen (Nook STR)

by @edent | # # # # # # | 12 comments | Read ~7,417 times.
Nook with a train display.

Here's a quick tutorial for turning an old Nook into a passive display. This is an update to my 2013 post End Result An eInk screen which displays the trains I can catch from my local station. It shows the next few available trains, and whether they're delayed. It also shows how long until the…

Continue reading →

Posting Audio to Twitter

by @edent | # # #
The Twitter logo.

You can't post raw audio to Twitter directly. It sucks. Sure, you can post links to audio, but it's not quite the same. Here's a couple of Linux one-liners which will turn audio into simple video suitable for uploading to social media. Waves This converts audio to a waveform: ffmpeg -i input.mp3 -filter_complex "[0:a]showwaves=s=640x480:mode=line,format=yuv420p[v]" -map…

Continue reading →

Quick and Dirty Self-Hosted Alexa Skills (2019)

by @edent | # # # # # # | 3 comments | Read ~562 times.

I hate creating Alexa skills. What should be a 3-click process inevitably ends up requiring trips to multiple websites, to set up weird parameters, and reading outdated tutorials for obsolete libraries. So this is how to create a self-hosted Skill, using PHP. It runs on your own server and doesn't require any interaction. The Skill…

Continue reading →

Convert WebVTT to a Transcript using Python

by @edent | # # # # # | 1 comment | Read ~1,221 times.
YouTube showing subtitles.

I want to convert YouTube's auto-generated subtitles into a plain transcript. Why is this so hard? This blog post gives a more detailed explanation than my answer to this StackOverflow question. Here's what the subtitles look like when you view a video: And here's what the code which generates those subtitles looks like: 00:00:00.930 -->…

Continue reading →

Using the Evoluent VMCR C Series Vertical Mouse with Linux

by @edent | # # # # # # # | 5 comments | Read ~1,402 times.
Mouse with multiple buttons.

This is a quick guide for setting up your new mouse with Ubuntu. I'm a big fan of the Evoluent Mouse range, and I've agreed to publish this Linux guide in return for a review sample. The Basics The only way to configure this mouse is via the command-line. This may look a bit daunting,…

Continue reading →

How to detect 3D video?

by @edent | # # # # | Read ~186 times.
Still from the moview Finding Nemo. The image is split side by side.

Here's an interesting conundrum. My TV can automatically detect when 3D video is being played and offers to switch into 3D mode - but how does the detection work? This post will give you a few strategies for detecting 3D images using Python. Firstly, some terminology. 3D videos are usually saved either as Side-By-Side images,…

Continue reading →

Adjusting timestamps on images with Python

by @edent | # # # # # | Read ~1,673 times.
A cute penguin.

As ever, mostly notes to myself. I have a bunch of old images which don't have any timestamp associated with them. This quick Python script will add a DateTime EXIF metadata tag to an image. This uses piexif which can be installed using pip install piexif This simple script reads a photo, adds a timestamp,…

Continue reading →

Import Images From A Migrated WordPress

by @edent | # # # # # | 2 comments | Read ~423 times.
The Logo for WordPress

Here's how to solve a common WordPress problem. I want to re-import all my blog's images into the media library. I've moved my blog to a new host - but kept the same domain name. I started with a new WordPress install, the uploads folder still has all my images, but WordPress can't see them.…

Continue reading →

Using YouTube to Transcode Videos to DASH on the Command Line

by @edent | # # # # | 9 comments | Read ~1,734 times.

This is part of my redecentralisation efforts to liberate my videos from YouTube. MPEG-DASH is a simple method of streaming videos which doesn't require any specialised server software. You convert a high resolution video into a series of smaller resolution videos. You chop each of the videos up into several chunks. As the video plays,…

Continue reading →