Skip to content

Instantly share code, notes, and snippets.

@rohieb
Created June 10, 2016 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohieb/0d3cd157bb4a2e04fd922d7997f25cd9 to your computer and use it in GitHub Desktop.
Save rohieb/0d3cd157bb4a2e04fd922d7997f25cd9 to your computer and use it in GitHub Desktop.
copy etherpad contents
#!/bin/sh
PADURL='https://pad.stratum0.org/p'
APIURL='https://pad.stratum0.org/api/1'
APIKEY=FIXME_FILL_THIS_IN
template_pad=stratumnews-template
target_pad=sandkastennonexistent ## FIXME: change this to your needs.
urlescape() {
perl -MURI::Escape -e 'while(<STDIN>){print uri_escape($_)};'
}
template_text=$(curl $PADURL'/'$template_pad'/export/txt' | urlescape)
curl $APIURL'/createPad?apikey='$APIKEY'&padID='$target_pad
curl $APIURL'/setText?apikey='$APIKEY'&padID='$target_pad'&text='$template_text
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment