home.social

#ffffff80 — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #ffffff80, aggregated by home.social.

  1. The return of DeskCam! - Back in 2004 (web.archive.org/web/2004110519) I bought myself an iSight camera, and I set it up to periodically take photos when I was at the computer and FTP them to my website. I called it DeskCam, and it ran (on various hardware) for the better part of ten years. As of today, it’s back, baby!

    As I noted yesterday (web-goddess.org/archive/83205), I can’t find any commercial software that does what I wanted to anymore. Originally I used something called EvoCam, which let me easily add a text overlay and set an upload interval. That’s long gone though, and most of what seems available these days seems to be aimed at people with security cameras (or who want to spy on their roommates). So I had to roll my own, with the help of the Snook. It runs on my Mac mini and uploads a new photo every 10 minutes.

    How we set up DeskCam:

    1. I installed ImageSnap (github.com/rharder/imagesnap), which allows you to take a photo from the command line. I tested it and it worked with my existing Logitech USB webcam with no issues.

    2. I installed ImageMagick (imagemagick.org/) and used it to edit the image. I resize it down to 640px wide, then draw a white rectangle with 50% opacity across the bottom, and then add my text over the top. This was the trickiest bit, but thankfully @ajft got me started with a very helpful toot (aus.social/@ajft/1151222968271) and then I drafted Rodd in for additional help.

    3. I installed the AWS CLI (aws.amazon.com/cli/) tools and used it to copy the final image to a public S3 bucket, which I then display on the site.

    4. Figure out how to turn the current timestamp into the format I wanted to display, and then modify my ImageMagick command to use it.

    5. Figure out how to display a Growl notification to warn me 10 seconds before it takes a photo, just so I’m not scratching my armpit or anything.

    6. I had Rodd help me package all that up in a bash script that looks like this (you’ll need to replace the values in those variables if you want to use it yourself):

    #!/bin/bash

    /usr/bin/osascript -e \
    "display notification \"DeskCam photo in 10 seconds!\""

    sleep 10

    PHOTO="/path/to/snapshot.jpg"
    EDITED="/path/to/deskcam.jpg"
    TARGET="s3://BUCKETNAME/deskcam.jpg"

    /opt/homebrew/bin/imagesnap "${PHOTO}"

    DATE=$(date +"%b %d %Y %H:%M")

    /opt/homebrew/bin/magick "${PHOTO}" \
    -resize 640 \
    -fill "#ffffff80" \
    -draw "rectangle 0,320 640,360" \
    -pointsize 24 \
    -weight demibold \
    -fill black \
    -draw "text 20,348 \"DeskCam\"" \
    -weight normal \
    -draw "text 420,348 \"${DATE}\"" "${EDITED}"

    /opt/homebrew/bin/aws s3 cp "${EDITED}" "${TARGET}"

    7. Then I needed to figure out how to make it run in the background on a loop. This blog post (janik6n.net/posts/run-a-schedu web-goddess.org/archive/83326

  2. However, if you tell the assembler:

    mov r0, #FFFFFF80

    You might be surprised that that works fine. That's because the assembler may secretly rewrite your instruction into

    mvn r0, #7F

    Which works the same way as MOV, except the value is negated after decoding.