Skip to content

Instantly share code, notes, and snippets.

@Simsso
Created August 8, 2020 10:04
Show Gist options
  • Select an option

  • Save Simsso/e52028600e703517fa94d655df964ade to your computer and use it in GitHub Desktop.

Select an option

Save Simsso/e52028600e703517fa94d655df964ade to your computer and use it in GitHub Desktop.
Connects to a raspi, takes a photo, downloads it, and shows it (on Mac)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
timestamp=$(date +%s)
ip=192.168.1.102
echo "Taking a photo..."
ssh pi@$ip "mkdir -p cam && cd cam && raspistill -o cam-$timestamp.jpg"
echo "Downloading..."
scp "pi@$ip:~/cam/cam-$timestamp.jpg" .
echo "Opening..."
open "cam-$timestamp.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment