Developer Resources

REST

2018 Smart Home Black Friday Deals

Outlets and Switches

* [Wemo Light Switch, WiFi enabled, Works with Alexa and the Google Assistant](https://amzn.to/2TlEIxE)
* **Seller:** WeMo
* **Price:** ~$49.99~ -> $27.99

* [Topgreener USB Outlet with USB Type A and Type C Charging Ports 5.8A/5V, 15A Tamper Resistant Receptacle, Quality Unbreakable Wall Plate Cover, USB Type C Cable, and 3 Face Covers](https://amzn.to/2qVZcQO)
* **Seller:** Top Greener Inc
* **Price:** ~$61.09~ -> $26.15
* **Note:** This is not a smart device per-say, but does provide charging options for your smart devices.

* [Vision In Wall Z-Wave Micro Switch, 2 relay](https://amzn.to/2QYsFEY)
* **Seller:** Vision
* **Price:** ~$39.95~ -> $36.95

* [Outdoor Z-Wave Plus Smart Lighting & Appliance Control Module](https://amzn.to/2KgM8OA)
* **Seller:** Jasco
* **Price:** ~$44.99~ -> $27.19

## Cameras

* [Arlo Pro 2 – Wireless Home Security Camera System | Rechargeable, Night vision, Indoor/Outdoor 1080p | 6 camera kit (VMS4630P)](https://amzn.to/2TwcPDk)
* **Seller:** Arlo Technologies, Inc
* **Price:** ~$1,099.99~ -> $879.99

* Blink Indoor Home Security Camera Systems
* **Seller:** Blink Home Security
* [1 Camera Kit](https://amzn.to/2PDri22) – ~$99.99~ -> $66.99
* [2 Camera Kit](https://amzn.to/2FtwHE7) – ~$169.99~ -> $113.99
* [3 Camera Kit](https://amzn.to/2PFa9oz) – ~$229.99~ -> $153.99
* [5 Camera Kit](https://amzn.to/2qWy0kO) – ~$349.99~ -> $233.99
* [Add-on Camera for Existing Blink Customer Systems](https://amzn.to/2OUzgOW) – ~$89.99~ -> $71.99

* [DIGOO 720P Wireless Night Vision Smart Home Security IP Camera](https://www.aliexpress.com/item/DIGOO-DG-M1Q-960P-2-8mm-Wireless-Mini-WIFI-Night-Vision-Smart-Home-Security-IP-Camera/32817727156.html)
* **Seller:** AliExpress
* **Price:** ~$22.48~ -> $17.98

## Voice Controlled Speakers

* [Certified Refurbished All-new Echo (2nd Generation)](https://amzn.to/2OQmd0R)
* **Seller:** Amazon
* **Price:** ~$79.99~ -> $59.99

* [Echo Sub Bundle with 2 Echo (2nd Gen) Devices](https://amzn.to/2qSBxjU)
* **Seller:** Amazon
* **Price:** ~$329.97~ -> $249.97

* [Echo Sub Bundle with 2 Echo Plus (2nd Gen) Devices – Heather Gray](https://amzn.to/2qTUOS9)
* **Seller:**
* **Price:** ~$429.97~ -> $329.97

* [Echo Dot Kids Edition 3-Pack (Blue/Punch Red/Green)](https://amzn.to/2TqM8zN)
* **Seller:** Amazon
* **Price:** ~$209.97~ -> $99.97

## Media Streamers

* [Roku Streaming Stick | Portable, Power-Packed Streaming Device with Voice Remote with Buttons for TV Power and Volume](https://amzn.to/2KeEJiH)
* **Seller:** Roku, Inc.
* **Price:** ~$49.99~ -> $29.00

* [Fire TV Stick with 1st Gen Alexa Voice Remote, streaming media player](https://amzn.to/2TrOrm4)
* **Seller:** EZ Med — Dropship
* **Price:** ~$39.99~ -> $24.99

* [Fire TV Cube, hands-free with Alexa and 4K Ultra HD (includes all-new Alexa Voice Remote), streaming media player](https://amzn.to/2TrhLta)
* **Seller:** Amazon
* **Price:** ~$119.99~ -> $59.99

* [Fire TV Recast, over-the-air DVR, 500 GB, 75 hours](https://amzn.to/2TwsVge)
* **Seller:** Amazon
* **Price:** ~$229.99~ -> $179.99

## Storage

### SD Cards

* [Samsung 128GB 100MB/s (U3) MicroSD EVO Select Memory Card with Adapter (MB-ME128GA/AM)](https://amzn.to/2qSxSTn)
* **Seller:** Samsung Electronics DAV
* **Price:** ~$41.99~ -> $19.99

* [Samsung 64GB 100MB/s (U3) MicroSDXC Evo Select Memory Card with Adapter (MB-ME64GA/AM)](https://amzn.to/2OSHKpF)
* **Seller:** Samsung Electronics DAV
* **Price:** ~$22.99~ -> $10.99

## Vacuums

* [iRobot Roomba 690 Robot Vacuum](https://amzn.to/2zjCLcL)
* **Seller:** iRobot
* **Price:** ~$374.99~ -> $249.00

* [iRobot Roomba 960 Robot Vacuum](https://amzn.to/2zjCLcL)
* **Seller:** iRobot
* **Price:** ~$699.00~ -> $449.00

* [Roborock S50 Smart Robot Vacuum Cleaner](https://www.gearbest.com/robot-vacuum/pp_009168125546.html)
* **Seller:** GearBest
* **Price:** ~$494.45~ -> $379.99

## Computer Accessories

* [FIDO U2F Security Key](https://amzn.to/2KfkuBJ)
* **Seller:** Thetis
* **Price:** ~$39.99~ -> $15.99 Continue reading “2018 Smart Home Black Friday Deals”

HOWTO: Caching on the cheap

A project I’ve been working on lately is going to be featured in a Super Bowl commercial this weekend. It’s probably safe to assume that the unauthenticated landing pages will get the most traffic. There is some user generated content on these pages (read: database calls) that we want to display. This is how we cached these pages on the cheap:

Step 1: Generate the cache files:

When you run this script, it will loop over all of the PATHS, on the given BASE_URL, for the given PROTOCOLS. It will store the files in a cache directory, one level up from where the script is located. This script assumes that all paths that you defined in PATHS end in a ‘/’ and will cache a version for the full url with and without that ‘/’ (having two different files for these resources makes it easier to write our .htaccess rules next).

bin/gen_cache.sh

#!/bin/bash

PATHS="/ /mobile/ /fb/"
PROTOCOLS="http"
BASE_URL="://example.com"

#-- CD into the project directory
cd "`dirname $0`/.."
if [ ! -d "cache" ]; then
  mkdir "cache"
fi
cd "cache"

for path in $PATHS; do
  for protocol in $PROTOCOLS; do
    base="${path//\//}"
    case "$protocol" in
      "http")
        cache_suffix="_off_cached.html"
        ;;
      "https")
        cache_suffix="_on_cached.html"
        ;;
    esac
    out_file="${base}${cache_suffix}"

    #-- Fetch the resource
    curl "${protocol}${BASE_URL}${path}" > "${out_file}"
    if [ 0 -ne $? ]; then
      #-- If the page did not download correctly, do not cache it
      rm "${out_file}"
    else 
      #-- Only contiune if the page actually loaded
      #echo "" >> "${out_file}"

      #-- If the resource is a sub directory create the alternative name for it
      #   This is so we can support /my_resource AND /my_resource/
      if [ -n "${base}" ]; then
        if [ ! -d "${base}" ]; then
          mkdir "${base}"
        fi
        cp "${out_file}" "${base}/${cache_suffix}"
      fi
    fi
  done
done

Step 2: Serve the cache files (to everyone but our curl script above):

Now that we have our cache files generated, all we have to do is server them. We do however want to let our cache generating script to always access the original source, and so we are only going to apply this rule if the current browser is currently not curl. If that’s the case, we check to make sure that the cache file exits, and if it does, we serve that instead of the actual, uncached resource.

.htaccess

#-- Serve cached files to non Curl user agents
RewriteCond %{HTTP_USER_AGENT} !^curl [NC]
RewriteCond %{DOCUMENT_ROOT}/cache/%{REQUEST_URI}_%{HTTPS}_cached.html -f
RewriteRule ^(.*)$ cache/$1_%{HTTPS}_cached.html [L]

Boom! Add our bin/gen_cache.sh file to run every minute in our cronttab and we’ve got a super cheap cache!

Note: This is only for unauthenticated pages, and there are much better ways to cache resource, like varnish, but for something that you can configure in minutes and only requiring curl, mod_rewrite, and cron, this is a decent start.