Create a main.go
file:
package main
import (
import { Construct } from 'constructs'; | |
import { CfnOutput, Stack } from 'aws-cdk-lib'; | |
import * as cdk from 'aws-cdk-lib'; | |
export function output(scope: Construct, name: string, value: string) { | |
return new CfnOutput(scope, name, { | |
value, | |
exportName: `${Stack.of(scope).stackName}:${name}`, | |
}); | |
} |
# $(call secret,region,account,secret_id) | |
define secret | |
$(shell aws secretsmanager get-secret-value \ | |
--region $(1) --secret-id arn:aws:secretsmanager:$(1):$(2):secret:$(3) \ | |
--output text --query SecretString) | |
endef | |
.npmrc: NPM_TOKEN ?= $(call secret,eu-west-1,1234567890,npm-readonly-token) | |
.npmrc: | |
@test -n "${NPM_TOKEN}" || (>&2 echo "Error: NPM_TOKEN is missing"; exit 1) |
import os | |
from time import sleep | |
import boto3 | |
from utils import dump as _print, list_all | |
import cache | |
FORCE = False | |
ROLE_NAME = os.environ['ROLE_NAME'] |
aws organizations list-accounts --query Accounts \ | |
| jq -r 'sort_by(.Name) | .[] | [.Id,.Name] | @csv' \ | |
| sed 's/"//g' \ | |
| sed -E 's/^([0-9]+),/- [ ] `\1` /g' |
import http.server | |
class Handler(http.server.BaseHTTPRequestHandler): | |
def __getattr__(self, item): | |
if item.startswith('do_'): | |
return self.default | |
return getattr(super(), item) | |
def default(self): |
""" | |
Convert JSON to colorful YAML. | |
Example: | |
$ alias jaml="python .../jaml.py" | |
$ curl https://api.thecatapi.com/v1/images/search -s | jaml | |
License: MIT | |
""" |
function reveal_url() { | |
for (let el of document.getElementsByClassName("reveal-url")) { | |
let x = el.innerText.split("").reverse().join(""); | |
el.setAttribute("href", el.getAttribute("href") + x.replaceAll(" ", "")); | |
el.innerText = x; | |
} | |
} |