Skip to content

Instantly share code, notes, and snippets.

@Hamcha
Created August 16, 2014 02:31
Show Gist options
  • Save Hamcha/5689b322596b92d947fd to your computer and use it in GitHub Desktop.
Save Hamcha/5689b322596b92d947fd to your computer and use it in GitHub Desktop.
Quick and dirty ix.io alternative for when ix is down or something - Completely backend free (requires ssh/cat and a webserver) - Assumes keyless auth
#!/bin/sh
SERVER_USER=<<your ssh user>>
SERVER_HOST=<<your ssh server address>>
PUBLIC_PATH="<<public url (ie https://myhost/pastes/)>>"
SERVER_PATH="<<server path (ie /var/www/pastes/)>>"
SERVER_FLAGS="<<additional flags (ex. custom ssh port)>>"
HASH=$(date +%s%N | shasum | head -c7)
ssh ${SERVER_USER}@${SERVER_HOST} ${SERVER_FLAGS} "cat > ${SERVER_PATH}${HASH}" && echo ${PUBLIC_PATH}${HASH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment