Fixing 1978 Honda CB400A always on neutral light — “decaf” project bike

I’m about to sell, with some sadness, my 1978 Honda CB400A “Hondamatic” motorcycle.
I have one last problem with it — that’s been baffling me for over a year.

When I consolidated the speedometer and “idiot lights” to a svelte new cafe racer style chrome LED-based single instrument, I found that its neutral light was always on, no matter what gear.

So I finally figured out a clever (if I may say so) way through research to use the “proverbial $7 part” from in-stock Radioshack — a RELAY switch!

Here, I describe and show the problem, step through a bit of the bike’s electrical system, and show you how I used a relay to fix the problem.

I’ll be sad to see you go, little Decaf!

The *awesome* video learning tutorials I used on Youtube to determine relays were for me!:
RELAYS – How to wire and how they work TUTORIAL !!
How An Automotive Relay Works and How to Wire ‘Em up
(thanks, guys!)

hacking Apple Watch to a cuff bracelet custom watch

OK, so here’s the problem.  I think the Apple Watch is too small (but it’s weight is “just right”!) and I dislike the bands.  In fact, I never wear “normal” watches anymore — I greatly prefer nice and wide uniform width leather cuffs.

finished product

So I found (and ordered) this cute cheapie < $20 adapter (which as I thought, comes direct from China).  The black can chip/flake a little (it’s not anodized into the metal well), which they know/cop to — but it’s so cheap so who cares?  😉

Next I ordered a few different bands from my *favorite* watch (and fun!  also cheap!) store (I’ve rocked their watches for years now, and have fun getting different styles.  Their website is a bit slow, but they have great selection).   I settled on this (crazy cheap clearance!) item black tattoo-like watch cuff band (which nicely didn’t come with a watch I didn’t need).

My thinking was to get something at least as wide as the watch (1.5″ wide band) but would set off/partially incognito the black aluminum 42mm watch casing.  The other two bands were an even wider brown one (but it just was a bit more plain than I’d hope for, less “me”) and a 3″+ *really* wide black one (but it looked a little too S&M or something — again not really “me”).  Thankfully Nemesis was great about letting me return them in exchange for another band and watch I wanted (since I was about two weeks past the return deadline!)

So you:

  • center the watch (charger is easiest) on the back of the band (those rivets you see below hold the “snap parts” for this particular cuff — that’s a more ideal setup than a looped kind of other way to secure the watch w/ a single snap underneath — because we’re going to need to cut out a hole so the watch can touch (and basically “see” your skin)
  • trace the charger with a pen
  • cut the circle out with an xacto knife or similar
  • slide out the old watch band
  • assemble the new watch adapter (you can see it in pictures below slid and locked into the watch)
  • snap in in!

Now you can charge it through the hole nicely, and it should make good skin contact and thus stay unlocked once it’s on.

pretty simple, trace charger with pen, then cut carefully w/ xacto knife
showing the new hole and where the watch will snap in. you can see more closely the watch adapter very small pieces and bars locked into the watch
charging happily through the back and new circle hole through the leather band


[ I happen to like also wearing the watch on my left wrist, but face on my underside of the wrist (also makes the watch more innocuous / disappears — and more of a “surprise” when you “wrist up and twist” to others 8-).  So I made my settings say the watch was on my right wrist (since the “bend up arm and twist” motion is more like the other side when you wear the watch this way. ]

“slide-responsively” — minimal standalone HTM/CSS/JS inspired by “sliding-door” from Wayne Connor

I made new “slide-responsively” for image menus, which is minimal standalone HTM/CSS/JS inspired by “sliding-door” from Wayne Connor

I’ve just kept the sliding door idea, and made it independent of a WordPress theme so it can be added to a site using another theme
(example site).

Try shrinking the width of the browser or rotating your mobile device.

View Source to see the minimal elements needed.

Just replace the 7 images and links and go!

my github repo of this plugin.

Hyper Green Magic — Green Magic Man Kawasaki ZX-6 motorcycle Hyperlapse, route 1, CA

From the video:

“Two weeks ago, Green Magic Man became the top poster on kawasaki ZX6 forum”
“One week ago, Hyperlapse hit the App Store”
“this is their story”

“Green Magic Man” hitting the curves on Highway 1 towards the coast, Marin County, CA on Labor Day 2014

We tried “Hyperlapse”, which just came out this week, for the first time.

play motion-JPEG video using javascript (in browser, no plugins, minimal JS)

Motion JPEG test

play motion-JPEG video using javascript (in browser, no plugins, minimal JS)

click a button above to begin!

This extracts the JPEG frames, likely without the huffman compression tables (though chrome dont care 8-), found within the .avi bytestream, and then base64 encodes them so they can be easily inserted into a dynamic <img> tag.

Add in a short display timeout and keep overlaying images, and you have your "video", using <img> tags, like a flip book.

WORKS: [ chrome: yes ][ firefox: was yes but now not 8-( ][ safari/iOS: no ][ IE: i bet not ]

Originally created 2006 by Tracey Jaquith. minor updates to jQuery and simplifying 2013

Source (or "View Source"):

new “php-htm-mode” for emacs — intermixed PHP, HTML, JS, and CSS using multi-modes

I finally formalized, cleaned up, and packaged up my current emacs editing setup for files with intermixed PHP, HTML, JS/javascript, and CSS code all in the same file.  It uses an existing but rarely used technique called “multi-mode” and sets “trigger points” for switching the “major mode” of the buffer as your cursor moves through the code.

A nice thing about this approach is that you can always glance down anytime you are editing to see which mode you are in (or the emacs lisp code *thinks* you are in).  You can also fork/edit the single “.el” lisp file to add/update the triggers for various modes.


screenshot of php-htm-mode
screenshot of php-htm-mode

How to turn Time Machine from disk with many partitions to single partition (logically “extending” Time Machine partition)

The high-level answer is:  

  • use macosx Disk Utility
  • make a .dmg of Time Machine partition (to another disk)
  • wipe out disk
  • restore .dmg
  • extend partition to full size (or whatever size you want) of disk

Detailed steps:

  1. backup one last time with Time Machine
  2. turn off Time Machine via preferences
  3. open Disk Utility (builtin mac app)
  4. select the partition where your Time Machine backups are
  5. hit the “New Image” icon in top bar — use the default options (with “.dmg” suffix, no encryption)
  6. save the .dmg to another disk that has space (this takes awhile)
  7. once that’s done, you can re-partition using Disk Utility the disk that originally had your Time Machine partition on it.  (WARNING THIS WIPES OUT ENTIRE DISK AND ALL PARTITIONS!)  Select each partition on the disk and hit the [-] icon near the bottom of the partition list.  BE VERY CAREFUL AND MAKE SURE YOU HAVE IDENTIFIED THE RIGHT DISK!
  8. your disk is now empty…
  9. repartition the disk however you like — since Time Machine uses its own subdir, I suggest partitioning the disk to a single partition, full extent of the disk
  10. with the emptied disk still selected, hit “Restore” button/tab to the right
  11. find the .dmg you made previously as your Source
  12. drag the emptied partition (where you want Time Machine backups to go) to the Destination
  13. hit the “Restore” button (bottom right)
  14. it will ask you to approve scanning/verifying .dmg (yes/OK)
  15. (this takes awhile)
  16. resize your restored Time Machine partition to full disk (or whatever size you want)
  17. turn back on Time Machine backups
  18. approve the question about “disk has moved…”

PS: you can also you this technique to move an entire set of Time Machine backups from one disk to another disk (without losing all your backups!)

simple way to make h.264 mp4 web and iOS/mobile playable video mp4 files for linux and macosx using ffmpeg

Greetings video geeks! 😎

At my job, I’ve updated the process and way we create our .mp4 files that are shown on video pages on

It’s a much cleaner/clearer process, namely:

  • I opted to ditch ffpreset files in favor of command-line argument 100% equivalents. It seems a bit easier for someone reading the task log of their item, trying to see what we did.
  • I no longer need qt-faststart step and dropped it. I use the cmd-line modern ffmpeg “-movflags faststart”

Entire processing is now done 100% with ffmpeg, in the standard “2-pass” mode
As before, this output .mp4:

  • plays in modern html5 video tag compatible browsers
  • plays in flash plugin within browsers
  • works on all iOS devices
  • makes sure the “moov atom” is at the front of the file, so browsers can playback before downloading the entire file, etc.

Here is an example (you would tailor especially the “scale=640:480” depending on source aspect ratio and desired output size; change or drop altogether the “-r 20” option (the source was 20 fps, so we make the dest 20 fps); tailor the bitrate args to taste):

  • ffmpeg -y -i stairs.avi -vcodec libx264 -pix_fmt yuv420p -vf yadif,scale=640:480 -profile:v baseline -x264opts cabac=0:bframes=0:ref=1:weightp=0:level=30:bitrate=700:vbv_maxrate=768:vbv_bufsize=1400 -movflags faststart -ac 2 -b:a 128k -ar 44100 -r 20 -pass 1 -acodec aac -strict experimental stairs.mp4;
  • ffmpeg -y -i stairs.avi -vcodec libx264 -pix_fmt yuv420p -vf yadif,scale=640:480 -profile:v baseline -x264opts cabac=0:bframes=0:ref=1:weightp=0:level=30:bitrate=700:vbv_maxrate=768:vbv_bufsize=1400 -movflags faststart -ac 2 -b:a 128k -ar 44100 -r 20 -pass 2 -acodec aac -strict experimental -metadata title='”Stairs where i work” – lame test item, bear with us –’ -metadata year=’2004′ -metadata comment=license:’’ stairs.mp4;

Happy hacking and creating!

PS: here is the way we compile ffmpeg (we use ubuntu linux at work, but this script works on macosx, too).

convert yuvj420p to yuv420p (chrome playable!) mp4 video (eg: canon/nikon video)


found a nice (video lossless, best i can tell) way to convert the video from cameras like my Canon ELPH SD1400,
which is *already* h.264 video + PCM mono audio

to a new mp4 container with aac audio. that part’s easy/cake w/ ffmpeg — but the trick to get the h.264
video part to play in chrome browser and/or with a flash plugin is to get the flagged “yuvj420p” colorspace pixels
to be considered “yuv420p”. it seems like the former is >= 8 bits-per-pixel and has a range wider than the 256 values;
while the later is 8 bit per pixel. ( brief info/notes/background )

at any rate, finally found this nice post:

which refers to this modified MP4Box/gpac tree, to switch the “fullrange” color-related flag off:

and then, voila! i have a nice little script where i can convert my canon ELPH videos to a html5 video tag and flash plugin compatible mp4:

#!/bin/bash -ex

IN=${1:?"Usage: [input video] [output video]"};
OUT=${2:?"Usage: [input video] [output video]"};

# make a hacked version of "mp4box" that can toggle a colorspace-related flag in our video!
if [ ! -e $HOME/scripts/mp4box ]; then
(git clone && cd gpac) || \
( cd gpac && git reset --hard && git clean -f && git pull && git status );

./configure --enable-pic --static-mp4box --enable-static-bin
make -j4;

# bonus points: make a *static* binary so if we change linux/OS versions, dont hafta worry!
cd applications/mp4box;
gcc -o $HOME/scripts/mp4box -static main.o filedump.o fileimport.o live.o -L../../bin/gcc -lgpac_static -lm -lpthread -ldl -lz

# demux
ffmpeg -y -i "$IN" -an -vcodec copy video.mp4;
ffmpeg -y -i "$IN" -vn -acodec copy audio.wav;

# convert yuvj420p to yuv420p the cheater way (for chrome and flash plugin playback!)
rm -fv tmp.mp4;
$HOME/scripts/mp4box -add video.mp4#:fullrange=off tmp.mp4

# convert wav audio to aac
ffmpeg -y -i tmp.mp4 -i audio.wav -acodec libfaac -ac 1 -ab 256k -vcodec copy t2.mp4;
qt-faststart t2.mp4 "$OUT";
rm -fv video.mp4 audio.wav t2.mp4 tmp.mp4;

natively compiling ffmpeg, mplayer, mencoder on MacOS Lion (with x264!)

OK, I’ve revamped my script to compile these tools:

on MacOS Lion, using the heads of the trees, with direct encoding support for:
vpx / WebM

A nice recent update to ffmpeg is the ability to decode/read Apple ProRes, too!