Shell script to email when web page has updates/changed

Some shipping companies don’t have any sort of notification system for when updates happen to packages. For small things, this is probably not a major issue, but when i ordered my huge Patio roof, i needed to be at home when it was being delivered to help unload.

Unfortunately the website did not have any notifications, and the alternative was to hit reload on the page all the time to check. I figured this should be easy to script and so wrote this small shell script to watch the page, and email me if there were any updates

 

#!/bin/bash
#
# URL to check
url="http://fasttracker-nz.tollgroup.com/onetoll-fast-tracker.aspx?ConsignmentNumber=xxxxxxxxxx"
 
# Temp file to store the tracking page
temp=/tmp/trackingcheck
 
# Get the page, remove dynamic content of newrelic and diff feedback on that
modified=$(wget -q -O $temp $url ; diff ${temp} ${temp}.1 |grep -v newrelic |grep -v --  "--" |grep -v 8c8 )
 
# This is a good idea if it has the Last Modified headers, but in my case it didn't
#modified=$(curl -sI "$url" | grep ^Last-Modified)
 
# set email address
email="liz@xxxxxx.com"
 
# Check if the modified variable exists and is more than 0 characters
if [[ ! -z "$modified" && ${#modified} -gt 0 ]]; then
    # Email me the changes if there are any
    echo $url has changed  $modified  - modified| mail -s "Tracking Update"  ${email}
    # Copy the recent grab of the page to the second file to compare to next time
    cp ${temp} ${temp}.1
fi

The initial idea was to check for Last-Modified headers, but they did not have those, so i ended up dumping the page to /tmp/trackingcheck and comparing against /tmp/trackingcheck.1 . I had to adapt my diff command to remove the newrelic dynamic content lines, which probably could have been done, but over all the script worked nicely.
I set up a cron task to run that every 10 minutes. If the page has changed, it emails me, and copies the temp file to /tmp/trackingcheck.1

*/10 * * * * /home/velofille/tracking.sh

How to 3D print from an image (conversion)

I tried many variations of this, and most seemed to be really annoyingly hard or not overly great results. This seems to be the best results i have had yet, by doing the following.Pioneer

First of all, get your image, PNG works best IMHO, because you have transparent backgrounds. Ideally you need the image to be contrasty or black/white. Open the image in Gimp, copy and paste it into a new image with transparent background.

Select Color , click desaturate. Click Color -> Brightness/Contrast. Set the brightness up at full, then set the contrast to full. This should give you a black/white high contrast image.

Black is what will show, so remove any white you have now leaving it transparent. Select any crap you don’t want, and delete that now. Once you have the image looking how you want, export that as a file.pnm (raw)

Pioneer-bw

From the commandline, convert that using potrace (installed via apt-get )

potrace pioneer.pnm -s -o pioneer.svg

Now you have a good working svg to work with. Install inkscape if you don’t have it already, and install this plugin according to instructions http://www.thingiverse.com/thing:25036 . Its merely a matter of unzipping the 2 files into ~/.config/inkscape/extensions/

Start inkscape, open the svg. From the “Extensions” menu, select “Generate from Path > Paths to OpenSCAD”. Now you have your scad you can open and compile with openscad (open, press F6)

Export as an stl or modify further within openscad (this one has a background plate i made)

pioneer-3D

Wood business card holder

I had some scraps of Mahogany leftover from making my Ukulele, they were nice and thin and just dying to be used for something awesome. I also had some 4mm marine ply from another project, so decided i needed to make something to hold business cards.

First I put a card on the wood, and cut 3 pieces of wood (2 mahogany, 1 ply) to a size just a little larger than the card. I then cut the plywood out to be a C shape, with the C being the slightly larger (by 1-2mm) size of the cards i wanted to put inside.

I glued the 2 mahogany sides on, one on each side and cleaned up all the edges. I used a dremel sander to cut an indent into the top so i can get cards in/out easily (the 2mm mahogany is brittle and thin), then sanded it and oiled the lot. This is clearly to brittle to be in a back pocket, but should be fine in a top pocket or my bag , and looks fantastic when i take out a business card for somebody 🙂small-2014-01-03 09.28.58 small-2014-01-03 09.29.18 small-2014-01-03 09.29.10 small-2014-01-03 09.29.04 small-2014-01-03 09.28.46