This file contains hidden or 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
unset AWS_PROFILE | |
google_sso_idp='' | |
google_sso_sp='' | |
profile='default' | |
region='us-east-1' | |
# Put code into a function so that we can quick escape without using 'exit 1' considering | |
# if this code gets sourced into bash (which it should for proper usage) using 'exit 1' will kill the process. | |
function fn_aws_google_login() { |
This file contains hidden or 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
const generateId = () => Math.random().toString(36).substring(2, 8) + Math.random().toString(36).substring(2, 8) | |
function instrumentFunction(name, originalFn, cbPosition = 0) { | |
return function enhancedFunction(...args) { | |
const ident = generateId() | |
const callerLine = `(${new Error().stack.split('\n')[2].trim()})` | |
const enhancedCB = function (...cbArgs) { | |
console.log(`${ident}: ${name} starting ${callerLine}`) | |
try { | |
args[cbPosition].bind(this)(...cbArgs) |
This file contains hidden or 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
const ipRegex = /([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/ | |
const getIpDigits = (ip) => { | |
const digits = ipRegex.exec(ip) | |
if (!digits) { | |
return [-1, -1, -1, -1] | |
} | |
return ipRegex.exec(ip).splice(1).map(stringDigit => +stringDigit) | |
} |
This file contains hidden or 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
;(() => { | |
const url = "https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs-insights:queryDetail=~(end~0~start~-900~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*20*40timestamp*2c*20*40message*0a*20*7c*20limit*2020~isLiveTail~false~queryId~'CW_LOG_NAME~source~'CW_LOG_NAME)"; | |
const regionFromUrl = /.*\?region=(.+?)#.*/; | |
const logGroupFromCloudwatch = /.*group=([^;]*?)(;|$)/; | |
const logGroupFromLambda = /.*functions\/([^?]*)/; | |
const logGroupToken = /CW_LOG_NAME/g; | |
let logGroup = null; | |
const regionResult = regionFromUrl.exec(window.location.href); |
This file contains hidden or 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
JSON.stringify({ | |
Records: [{ | |
Sns: { | |
Message: JSON.stringify({ | |
Records: [{ | |
"s3": { | |
bucket: "inmarb2b-dev-ao-environment", | |
object: { | |
key: "EnvironmentConfigs/preprod/cloudformation.json" | |
} |
This file contains hidden or 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
(() => { | |
const envMap = [ | |
['preprod.aws-nonprod', 'prod.aws-prod'], | |
['prod.aws-prod', 'preprod.aws-nonprod'], | |
['dev.eretail-dev', ['staging.eretail-dev', 'prod.eretail']], | |
['staging.eretail-dev', ['dev.eretail-dev', 'prod.eretail']], | |
['prod.eretail', ['dev.eretail-dev', 'staging.eretail-dev']], | |
['dev.inmartgrocery.com', ['staging.inmartgrocery.com', 'inmartgrocery.com']], | |
['staging.inmartgrocery.com', ['dev.inmartgrocery.com', 'inmartgrocery.com']], | |
['inmartgrocery.com', ['dev.inmartgrocery.com', 'staging.inmartgrocery.com']] |
This file contains hidden or 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
// selects do not fire change events if their value or selectedIndex is updated directly (only if their _options_ change), | |
// unfortunately, js frameworks typically update selects via direct calls to the value or selectdIndex. We need to be able to fire an event | |
// for either of these when they are set so we can communicate the changes to the choices.js library. | |
function enhanceSelectPrototype() { | |
if (HTMLSelectElement.prototype.__inmHasBeenEnhanced) { | |
return | |
} | |
const valueDescriptor = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value') | |
const selectedIndexDescriptor = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'selectedIndex') |
This file contains hidden or 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
function build(buildArn, projectName, status = "SUCCEEDED") { | |
return JSON.stringify({ | |
Records: [{ | |
Sns: { | |
Message: JSON.stringify({ | |
detail: { | |
"build-id": buildArn.trim(), | |
"project-name": projectName, | |
"build-status": status | |
} |
This file contains hidden or 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
javascript: | |
const token = '<TOKEN>'; | |
const opts = {}; | |
if (token !== '<TOKEN>') { | |
opts.headers = { | |
'Authorization': 'token ' + token | |
} | |
}; | |
(b => fetch('https://api.github.com/repos/' + b[1] + '/commits?sha=' + (b[2] || ''), opts) | |
.then(c => Promise.all([c.headers.get('link'), c.json()])) |
This file contains hidden or 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
Math.seed = function(s) { | |
return function() { | |
s = Math.sin(s) * 10000 | |
return s - Math.floor(s) | |
} | |
} | |
/** | |
* Get a random floating point number between `min` and `max`. | |
* |