A simple way to get AWS Service Quotas using Python
by Danny Quah, May 2020 (revised Jan 2022)
Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (lines of code, images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.
Here's how to do this:
Create the gist on GitHub and then clone it to your local filesystem:
To get the token:
export ARGOCD_SERVER="https://<<your-url>>"
export ARGOCD_ADMIN_PASSWORD=`aws secretsmanager get-secret-value --secret-id SecretText_odde-eks_eks1_argocd_initial-admin-secret --output json | jq -r ".SecretString"`
rm /tmp/creds.json
cat << EOF >> /tmp/creds.json
{
"username":"admin",
"password":"$ARGOCD_ADMIN_PASSWORD"| #!/bin/sh | |
| # Command-line world clock - source: https://stackoverflow.com/questions/370075/command-line-world-clock | |
| : ${WORLDCLOCK_ZONES:=$HOME/world_time_zones} | |
| : ${WORLDCLOCK_FORMAT:='+%Y-%m-%d %H:%M:%S %Z'} | |
| while read zone | |
| do echo $zone '!' $(TZ=$zone date "$WORLDCLOCK_FORMAT") | |
| done < $WORLDCLOCK_ZONES | | |
| awk -F '!' '{ printf "%-20s %s\n", $1, $2;}' |
| # Inspired by this great answer... | |
| # https://stackoverflow.com/a/60785401 | |
| import yaml | |
| class SafeUnknownConstructor(yaml.constructor.SafeConstructor): | |
| def __init__(self): | |
| yaml.constructor.SafeConstructor.__init__(self) | |
| def construct_undefined(self, node): |
| #!/bin/bash | |
| for f in *; do | |
| fuser -s "$f" || echo "$f" >> /tmp/files | |
| done |
Info Question to chatGPT 4:
python deep merge two dictionaries
Response:
def deep_merge_dicts(dict1, dict2):
"""
Recursively merge two dictionaries.
"""I hereby claim:
- I am nicc777 on github.
- I am nicc777 (https://keybase.io/nicc777) on keybase.
- I have a public key ASCw2KEtFioxkgSyfTkWNcXnjyg0xm2tNkOSqpbno20BOAo
To claim this, I am signing this object:
| import json | |
| import datetime | |
| from dateutil.tz import tzlocal # pip3 install python-dateutil | |
| your_dict = {} # Data... | |
| json.dumps(your_dict, sort_keys=True, default=str) |