Script to reboot a Comtrend AR-5381u Modem when connectivity is lost
[bash]#!/bin/bash
# default username for this model
export MODEMUSERNAME=admin
# default password for model
export MODEMPASSWORD=user12345
export COOKIE=/tmp/cookie_jar
export CURL=/usr/bin/curl
export PING=/bin/ping
export GREP=/bin/grep
export CUT=/usr/bin/cut
$PING -c 5 google.com > /dev/null 2>&1
if [ $? -ne 0 ]
then
rm $COOKIE > /dev/null 2>&1
export OUTPUT=`$CURL -v -c $COOKIE ‘http://$MODEMUSERNAME:$MODEMPASSWORD@192.168.1.1/resetrouter.html’ 2>> /tmp/output`
export SESSIONKEY=`echo "$OUTPUT" | $GREP var | $GREP sessionKey | $CUT -d"=" -f2 | $CUT -d"’" -f2`
echo "kicking modem with session key $SESSIONKEY"
export OUTPUT=`$CURL -v -c $COOKIE "http://$MODEMUSERNAME:$MODEMPASSWORD@192.168.1.1/rebootinfo.cgi?sessionKey=$SESSIONKEY" 2>> /tmp/output`
fi[/bash]
Cool Duplo Project #21 – Centrifugal arms spinning top
Dark night, ice, on foot trying to make it home.
Wood pile on the land
Protected: Cool Duplo Project #20 – Roller Skates
Hypnotic
Google Drive API – the case of the unprocessed video files
We’ve been using the Google Drive API uploader for quite a while now. The main lesson we took away from using Google service, specifically from their API is that things will break for more or less valid reasons. That’s not to say we’re unhappy with the way things are going, by and large Google provides amazing service.
To answer quirks, we’ve done everything from handling 2 http response codes to crawling folders to add & remove user permissions or they wouldn’t see the folders that were shared with their groups.
The last bug we’ve had on our radar for a while is that of the Video files that mysteriously would go unprocessed.
Leave them for days they will never get encoded. Everything about the file is right but specifically the md5 checksum reported by Google. The only way to have it processed is to re-upload it. After months of chasing down such files we finally found a programmatic way to “kick” the processing.
When a file is in this state, it does not contain the “thumbnail” attribute, this is how you find them. Then if its “createdDate” attribute is older than X hours, you can run API calls to copy it and delete the original.
Of course this assumes you’re already knee deep into API land.









