Skip to content

Instantly share code, notes, and snippets.

@nachmore
nachmore / interactive.py
Created Aug 23, 2021
Create an interactive Python shell at a specific line
View interactive.py
from IPython import embed
embed()
@nachmore
nachmore / aws-cost-anomaly-detector-sample.sns
Created Jul 15, 2021
Sample SNS message sent from AWS Cost Anomy
View aws-cost-anomaly-detector-sample.sns
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:us-east-1:[account-id]:CostAnomalyQueue:f6df06cb-a1be-48be-b560-85876b7821b2",
"Sns": {
"Type": "Notification",
"MessageId": "31236cc0-d7be-55ec-a6f7-35aaf7b15d43",
"TopicArn": "arn:aws:sns:us-east-1:[account-id]:CostAnomalyQueue",
@nachmore
nachmore / flapping-crash.js
Created Jul 14, 2021
Javascript function (in AWS Lambda form) that crashes ever other minute. Useful for testing Alarms.
View flapping-crash.js
exports.handler = async () => {
// causes a crash every other minute by returning an invalid value
return (new Date().getMinutes() % 2) ? () => {} : 1;
};
@nachmore
nachmore / all-variables.js
Last active Jul 13, 2021
Traverse a Javascript object. Particularly useful for dump(this) to grab everything.
View all-variables.js
dump = (target, match_re, depth, seen) => {
if (depth === undefined) depth = 0
if (seen === undefined) seen = [target]
Object.keys(target).forEach((i, idx) => {
value = target[i] ?? "null";
isObject = (value === Object(value));