Skip to content

Instantly share code, notes, and snippets.

@ankr
Last active March 25, 2020 10:06
Show Gist options
  • Save ankr/417acef1e9ae662f8f6beac946987ec9 to your computer and use it in GitHub Desktop.
Save ankr/417acef1e9ae662f8f6beac946987ec9 to your computer and use it in GitHub Desktop.
Simple script for taking a drag-n-drop screenshot on OSX and upload it to your private server.

scrcap

Simple script to taking drag-n-drop screenshots on OSX and upload them to your own server.

  1. First create a new bash script with the following content:
#!/bin/bash

# Use timestamp to generate "unique" filename
filename=$(date +%s).png
local_path=~/Desktop/$filename

# Open screencapture application
# -s flag means drag-n-drop mode
screencapture -s $local_path

# Upload through scp
scp $local_path YOUR_SERVER_HOST:/path/on/vps

# Remove temporary local file
rm $local_path

# Copy url into cliboard
echo "https://your.domain.org/$filename" | pbcopy
  1. Follow this guide to setup a new service+keyboard shortcut for the above script; http://web.onassar.com/blog/2012/06/30/osx-bash-script-execution-through-keyboard-shortcut/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment