Pasted from http://stackoverflow.com/questions/8283668/cygwin-running-script-from-one-batch-file
Start a WINDOWS CMD script with :
: <<TRAMPOLINE
@echo off
bash -c "exit 0" || (echo.No bash found in PATH! & exit /b 1)
bash "%~f0" "%*"
goto :EOF
| #!/bin/bash | |
| # | |
| # note: jq is a lightweight and flexible command-line JSON processor, https://stedolan.github.io/jq/manual/ | |
| > SPARK_TOKEN="xxxxxxxxxxxxxxxxxxxxxx" | |
| # Number of rooms by default | |
| > curl -X GET -H "Authorization: Bearer $SPARK_TOKEN" "https://api.ciscospark.com/v1/rooms" | jq ".items | length" | |
| 100 |
| // Example of a POST request sent from the Tropo scripting platform | |
| // Note that this example comes from : https://support.tropo.com/hc/en-us/articles/206241213-REST-POST-and-GET-in-each-Scripting-language | |
| // | |
| // Quick setup : | |
| // - go to http://requestb.in and create a new POST bin | |
| // - create a tropo scripting application with this gist source | |
| // https://gist.github.com/ObjectIsAdvantag/9ced65903766cfba7ba1760df2fb394a/raw/tropo-post-request.js | |
| // - invoke the tropo application via its text or voice token URL | |
| // do not forget to add a requestBinId query parameter | |
| // ex : https://api.tropo.com/1.0/sessions?action=create&token=XXXXXXXXXXXXXXXX&requestBinId=1k6xjg51 |
| // This function writes the log parameter to a Spark Room | |
| // Invoke this function from the Tropo token-url with the "sparkIntegration" parameter set to the incoming Webhook ID you'll have prepared | |
| function log2spark(newLogEntry) { | |
| log("TROPO-LOGS-TO-SPARK: checking integration is well defined"); | |
| if (!sparkIntegration) { | |
| log("TROPO-LOGS-TO-SPARK: integration not defined, cannot send request to spark"); | |
| throw { message: ("no incoming integration identifier") }; | |
| } | |
| log("TROPO-LOGS-TO-SPARK: integration defined, continuing"); |
| call(phonenumber, { network: "SMS" }); | |
| say (msg); | |
| // Is it an incoming call ? | |
| if (currentCall) { | |
| log("TROPO_EU_TESTERS, incoming call"); | |
| log("TROPO_EU_TESTERS, callId: " + currentCall.id); | |
| log("TROPO_EU_TESTERS, sessionId: " + currentCall.sessionId); | |
| if (currentCall.channel == "VOICE") { | |
| log("TROPO_EU_TESTERS, incoming call, network:VOICE"); | |
| say("Thanks for joining Tropo Europe Testers service."); | |
| wait(1000); |
| import json | |
| import urllib2 | |
| version = "v20160417 - 0720" | |
| log( version ) | |
| webhook = "http://requestb.in/zd4mlazd" | |
| answer() |
| import urllib | |
| import urllib2 | |
| version = "v20160417 - 0702" | |
| log( version ) | |
| answer() | |
| say( "Welcome to the python v" + version ) |
| import urllib2 | |
| log( "v20160417 - 0602" ) | |
| answer() | |
| say( "Welcome to the python Yahoo weather reader" ) | |
| log( "outgoing call: before" ) | |
| urlRead = urllib2.urlopen( "http://requestb.in/zd4mlazd" + "?input=hello" ) |
| # To add a comment to this gist via Postman : | |
| POST https://api.github.com/gists/054ac70210d3c5e246db/comments | |
| > Content-Type: application/json | |
| > Authorization: token 8432627eacef6b3da4c1e2530986c66ZZZZZZZ | |
| { | |
| "body": "My comment from the API Workshop by Cisco DevNet" | |
| } | |
| # Get the whole Postman collection : |
Pasted from http://stackoverflow.com/questions/8283668/cygwin-running-script-from-one-batch-file
Start a WINDOWS CMD script with :
: <<TRAMPOLINE
@echo off
bash -c "exit 0" || (echo.No bash found in PATH! & exit /b 1)
bash "%~f0" "%*"
goto :EOF