Hi. I’m Daniel Hoffmann.

Take continuously screenshots in a certain interval

Some time ago I took a lecture that was streamed on the Internet, but you would only get the slides, when you came to class in person. I didn’t get the logic in that and to save the time commuting to university I wrote a shell script that takes a screenshot every x seconds to capture the slides. It uses import from the imagemagick packet.

#!/bin/bash
no=$1  # number of screenshots as argument
sec=1  # interval of screenshots in seconds, also floats possible

sleep 5 # optional
s = 0
for i in $(seq $no); do
  sleep $sec
  s = $(($i*$sec))
  echo "$s seconds of $(($no*$sec))"
  import -window root image_$(seq -f %0011f $i $i | cut -d ',' -f 1).png
done

But now I had lots of screenshots and I only needed the distinct ones. Read on →


Dropshadows in Raphaël.js

For a university seminar I needed to create dropshadows for Raphaël objects. I wrote an SVG filter for that and found the blur plugin of the Raphaël author Dmitry Baranovskiy, that applies an SVG filter to Raphaël objects.

Demo

The SVG filter basically blurs the alpha channel of the object and offsets it.

There are two ways of using the plugin, one is per element:

el.dropShadow(size, offsetX, offsetY, opacity = 1)

and the other way adds a global filter that can be used specifying the class dropshadow.

You can find the code and more documentation on the Github page.