I hereby claim:
- I am sudosoul on github.
- I am sudosoul (https://keybase.io/sudosoul) on keybase.
- I have a public key ASCOPcy1Ua_ZHRfCuBuurqDOQ0C01F_cgHjOXWJ94XIzcwo
To claim this, I am signing this object:
const res = await saveToCache(1, 1); // Will `res` resolve with the response from the request made in the below function? | |
async function saveToCache(numberOfPills, numberOfPermutations) { | |
Request({ | |
url : process.env.cacheUrl, | |
method : 'POST', | |
body : {pills: numberOfPills.toString(), permutations: numberOfPermutations.toString()}, // Even though these values are defined as Numbers in Dynamo, we have to pass them as a string in the request body for the API GW -> Dynamo proxy mapping to work. | |
headers : {'Content-Type': 'application/json'} | |
}, (err, res, body) => { | |
if (err) throw new Error('Error: Internal Error Making POST Request to Cache Service - ' +err); | |
if (res.statusCode !== 200) throw new Error('Error: POST Request to Cache Service failed - ' +res); |
const Request = require('request'); | |
async function r() { | |
return new Promise((resolve, reject) => { | |
Request('https://google.com', (err, res, body) => { | |
resolve(body); | |
}); | |
}); | |
} |
/** | |
* Accepts either a URL or querystring and returns an object associating | |
* each querystring parameter to its value. | |
* | |
* Returns an empty object if no querystring parameters found. | |
*/ | |
function getUrlParams(urlOrQueryString) { | |
if ((i = urlOrQueryString.indexOf('?')) >= 0) { | |
const queryString = urlOrQueryString.substring(i+1); | |
if (queryString) { |
/** | |
* Accepts either a URL or querystring and returns an object associating | |
* each querystring parameter to its value. | |
* | |
* Returns an empty object if no querystring parameters found. | |
*/ | |
function getUrlParams(urlOrQueryString) { | |
if ((i = urlOrQueryString.indexOf('?')) >= 0) { | |
const queryString = urlOrQueryString.substring(i+1); | |
if (queryString) { |
// Using location.search (gets querystring from current URL) | |
let urlParams = getUrlParams(location.search); // Assume location.search = "?a=1&b=2b%202" | |
console.log(urlParams); // Prints { "a": 1, "b": "2b 2" } | |
// Using a URL string | |
const url = 'https://example.com?a=A%20A&b=1'; | |
urlParams = getUrlParams(url); | |
console.log(urlParams); // Prints { "a": "A A", "b": 1 } | |
// To check if a parameter exists, simply do: |
I hereby claim:
To claim this, I am signing this object:
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>MY APP</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
</head> | |
<body> | |
{ | |
"encodedImages": [ | |
{ | |
"type": "high_pass", | |
"encodedImage": "a very long base64 encoded image string" | |
}, | |
{ | |
"type": "red_channel", | |
"encodedImage": "a very long base64 encoded image string" | |
}, |
--- | |
########################################################################################## | |
# HTTP Digest Auth with URI Module POC | |
# | |
# Usage: | |
# 1. Create a new playbook called `test.yml` | |
# | |
# 2. Run it via: | |
# ``` | |
# ansible-playbook test.yml \ |
#!/bin/bash | |
while [ true ]; do | |
open \ | |
-na 'Google Chrome' \ | |
--args \ | |
--new-window 'https://i.imgur.com/RIN87.jpg' \ | |
&& sleep 5; | |
done |