Skip to content
Sergey Mudrik edited this page Jan 15, 2017 · 13 revisions

Examples usages for shell2http

Clone *.jpg.to service

Get first image from image search

shell2http -cgi / 'curl -Ls https://yandex.ru/images/search\?text=$(echo $PATH_INFO | sed "s/\///") | perl -nE "m/class=.serp-item__thumb.+?src=.(\S+).\s/; say \$1 if \$1" | xargs -I@ curl -Ls https:@'

And get images from http://localhost:8080/cat, http://localhost:8080/dog, http://localhost:8080/github ...

Add CORS header, for get data from another host

shell2http -cgi /data "echo "Access-Control-Allow-Origin: *\n"; echo 'some data for another host'"

Simple static-dir handler

shell2http -cgi /static/ 'file=$(echo $PATH_INFO | sed "s/^\///" | sed "s/\.\.//g"); if [ -d $file ]; then ls -l $file; else cat $file; fi'

Wallpaper generator

shell2http -one-thread /wp 'convert -size 2560x1600 plasma:fractal -blur 20x20 -swirl 270 jpg:-'

Clone this wiki locally