Skip to content

Instantly share code, notes, and snippets.

@abv
abv / foodtruck.1m.sh
Last active July 26, 2018 17:15
DUMBO food truck cam in OS X menu bar (For BitBar)
#!/bin/bash
TIMESTAMP=$(date +"%s")
IMAGE=$(curl -s "https://nexusapi-us1.camera.home.nest.com/get_image?uuid=5a6a099c3d894d0284560626c7944d50&width=400&t=$TIMESTAMP" | base64)
cat << EOF
DUMBO 🚚
---
| href=https://www.datalot.com/dumbo-food-truck-cam/ image=$IMAGE
EOF
@ihassin
ihassin / Reconnect
Created June 3, 2012 14:51
Reconnect to a lost database connection using an exception block trick (ruby, rails, mysql, activerecord)
def my_task
while(true) do
begin
database_access_here
rescue Exception => ex
begin
ActiveRecord::Base.connection.reconnect!
rescue
sleep 10
retry # will retry the reconnect