Created
July 12, 2019 04:36
-
-
Save luiscoms/b746a72a6f1129769c28cca8ef121a34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
--https://www.tutorialspoint.com/lua/lua_quick_guide.htm | |
requests = require 'requests' | |
inspect = require 'inspect' | |
response = requests.get{'http://httpbin.org/get', timeout=1} | |
json_data = response.json() | |
print(json_data.origin) | |
file = io.open('test.txt', "a") | |
file:write(json_data.origin, "\n") | |
file:write(json_data.asdf or '', "\n") | |
print("Hello World!") | |
local handle = io.popen("ls -la") | |
local result = handle:read("*a") | |
print(result) | |
handle:close() | |
--https://github.com/APItools/middleware/blob/master/middleware/http-cache/http_cache.lua | |
cert_url = 'https://www.googleapis.com/oauth2/v1/certs' | |
response = requests.get{cert_url, timeout=1} | |
print(inspect(response.headers)) | |
json_data = response.json() | |
kid = "6e5508d27965ad7907c232212defa48ed763727e" | |
--kid = "6e5508d27965ad7907c232212defa48ed763727a" | |
print(json_data[kid]) | |
cert = json_data[kid] | |
command = ('echo "${cert}" | openssl x509 -pubkey -noout'):gsub('${cert}', cert) | |
local handle = io.popen(command) | |
local pem = handle:read("*a") | |
print(pem) | |
--local path = os.getenv("PATH") | |
--print(path) | |
--ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment