• Caching YouTube Videos

    Here are some quick instructions if you would like to grab high resolution copies of all of the videos in a YouTube playlist.

    Install dependencies (replace brew with apt-get or yum for linux):

    $ brew install youtube-dl ffmpeg
    

    You can get a muxed 1080P version of all videos in a playlist by running the following command and replacing the URL:

    $ youtube-dl -w --restrict-filenames -f 137+140 -o '~/%(playlist_title)s/%(upload_date)s.%(ext)s' https://www.youtube.com/playlist?list=PLjF7R1fz_OOU08_hRcayfVZSmTpBCGJbL
    

    The -w option will disable overwrites, and --restrict-filenames will make the saved filenames URL safe. The -f 137+140 option tells youtube-dl to grab the 1080P video and AAC audio files, and mux them using ffmpeg.

    read more →
  • Raspberry Pi dwc2 Gadget Notes

    Here are some notes from experiments with dwc2 otg enabled on a Raspberry Pi Zero.

    read more →
  • Message Queue Link Dump

    We use Redis fairly heavily for Adafruit IO, and I started wondering if there might be some better/faster options for our MQTT Redis message queue. It looks like there are many options that are much faster than Redis.

    read more →
  • Redis Killed by OS?

    Redis Server has been killed a few times this week by the OOM. More info in this post on stackoverflow.

    After setting the maxmemory limit to 3GB, and maxmemory-policy to allkeys-lru, things should have gotten better. For some reason node.js workers would die as soon as they were restarted, reporting that they couldn’t connect to Redis.

    Starting the process manually would connect successfully, so the problem seemed to be with pm2, which manages the node cluster.

    Fix

    I tried killing pm2 by running the following command.

    $ pm2 kill
    

    Then, I restarted the node cluster, and everything was back to normal.

    $ sudo service io-server-cluster restart
    
    read more →
  • Copy Raspbian Image to SD Card with Progress Bar on OS X

    Find the SD card using diskutil list:

    todd:~ todd$ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *251.0 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:          Apple_CoreStorage                         250.1 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.1 MB   disk0s3
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                  Apple_HFS Macintosh HD           *249.8 GB   disk1
                                     Logical Volume on disk0s2
                                     5931BF6D-C779-4723-94C6-5831AF22BC00
                                     Unlocked Encrypted
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     Apple_partition_scheme                        *17.5 MB    disk2
       1:        Apple_partition_map                         32.3 KB    disk2s1
       2:                  Apple_HFS Flash Player            17.4 MB    disk2s2
    /dev/disk3
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *15.9 GB    disk3
       1:             Windows_FAT_32 boot                    62.9 MB    disk3s1
       2:                      Linux                         15.9 GB    disk3s2
    

    Unmount the SD card:

    todd:~ todd$ diskutil unmountDisk /dev/disk3
    Unmount of all volumes on disk3 was successful
    

    Copy the image to the SD card using dd and use pv to display progress:

    todd:~ todd$ pv ~/Downloads/2015-11-21-raspbian-jessie.img | sudo dd bs=16m of=/dev/disk3
    837MiB 0:05:19 [3.21MiB/s] [=======>                              ] 22% ETA 0:18:29
    
    read more →