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
python - <<EOF | |
from json2html import * | |
with open("report.json", "r") as f: | |
with open("report.html", "w") as nf: | |
nf.write(json2html.convert(json = f.read())) | |
EOF |
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
terraform graph | dot -Tsvg > graph.svg | |
inkscape -z -e frontofficev2.png -w 1000 -h 1000 graphg.svg |
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
from aws_cdk import ( | |
core, | |
aws_elasticloadbalancingv2 as elbv2, | |
aws_secretsmanager as sm | |
) | |
[...] | |
secret_bundle = sm.Secret.from_secret_arn( | |
self, |
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
# Talk to an AWS IAM protected ElasticSearch cluster | |
# Since its pretty hard to resort for this kind of stuff to curl (or extentions on it) we use Python | |
# Also, since its bothersome to check for the correct credentials place (disk, env, metadata endpoint, containerdata endpoint) | |
# its better to just peel out SigV4Auth from botocore.auth | |
# pip3 install boto3 requests | |
import boto3 | |
from botocore.auth import SigV4Auth | |
from botocore.awsrequest import AWSRequest | |
import requests, sys |
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
from requests_aws4auth import AWS4Auth | |
import boto3 | |
import requests | |
credentials = boto3.Session().get_credentials() | |
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, 'eu-central-1', 'es', session_token=credentials.token) | |
r = requests.get(url, auth=awsauth) |
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
import json | |
import os | |
import requests | |
from requests.structures import CaseInsensitiveDict | |
headers = {"Accept": "application/json","Content-Type": "application/json" ,"Authorization": "Bearer " + os.environ['grafana_pw']} | |
# package dashboard with on the fs since usually the string is too long | |
with open("dashboard.json") as file: |
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
from schema.your_schema_openapiv3 import Event | |
from schema.your_schema_openapiv3 import AWSEvent | |
from schema.your_schema_openapiv3 import Marshaller | |
import json | |
def lambda_handler(event, context): | |
"""function | |
Parameters | |
---------- |
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
# Lets take a simple event | |
# and event.json is the jsonschema of it | |
# { | |
# "administration": "YOURBACKOFFICECODE", | |
# "personNumber": 1337 | |
# } | |
import json | |
from logging import getLogger, INFO |
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
{ | |
"openapi": "3.0.1", | |
"info": { | |
"title": "fwhoof", | |
"version": "2021-10-17T18:09:20Z" | |
}, | |
"servers": [ | |
{ | |
"url": "https://whoof.corp" | |
} |
OlderNewer