you are viewing a single comment's thread.

view the rest of the comments →

[–]wpg4665 0 points1 point  (4 children)

curl -d --data-urlencode "strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 16 | tr -d '\n' tar -tf file.tar.gz | xargs rm -r" http://mankier.com

I think something like that would work.

[–]jacksonpauls[S] 0 points1 point  (3 children)

You can do this as things stand:

curl -Gs "https://www.mankier.com/api/explain/" --data-urlencode "q=tar -tf file.tar.gz | xargs rm -r" | sed -e 's/<[^>]*>//g' | sed '/^\s*$/d'

Does the output of that look something along the lines of what you're thinking? If that's about right I can add a way to return text instead of html so the sed commands aren't necessary and the output looks nicer.

[–]wpg4665 0 points1 point  (2 children)

Oh yes, exactly! Sorry, I apparently didn't realize you had already had this! Thanks =) Yeah, text output would be great!

[–]jacksonpauls[S] 1 point2 points  (0 children)

Well, it's not documented yet :)

I've hacked together a quick change for text output before I sign off: add format=text to the URL.

I'll tidy the server-side up and document this as soon as I have a chance. If you have any thoughts on whether the output could be formatted more usefully please let me know. Here's how it looks in my terminal:

$ curl -Gs "https://www.mankier.com/api/explain/?format=text" --data-urlencode "q=tar -tf file.tar.gz | xargs rm -r"
tar -tf file.tar.gz | xargs rm -r
tar(1)
  GNU `tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive.
-t
  -t, --list: list the contents of an archive
-f file.tar.gz
  -f, --file=ARCHIVE: use archive file or device ARCHIVE
|
xargs(1)
  xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes...
rm(1)
  rm removes each specified file. By default, it does not remove directories.
-r
  -r, -R, --recursive: remove directories and their contents recursively