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
> aws-vault exec some-developer -- env | grep AWS | |
AWS_ACCESS_KEY_ID=*** | |
AWS_SECRET_ACCESS_KEY=*** | |
AWS_SESSION_TOKEN=*** |
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
> cat ~/.aws/config | |
[default] | |
region=us-east-1 | |
aws_access_key_id=*** | |
aws_secret_access_key=*** | |
> aws s3 ls |
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 boto3 | |
session = boto3.Session( | |
region_name='us-east-1', | |
aws_access_key_id=AWS_ACCESS_KEY_ID, | |
aws_secret_access_key=AWS_SECRET_ACCESS_KEY, | |
) | |
session.client('s3').list_buckets() |
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
name: Dynamic Matrix | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
someInput: | |
description: 'Some input' | |
required: true | |
type: choice | |
options: [ one, two, three ] |
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
""" | |
Main Steps: | |
1. Create blob for each file | |
2. Create tree with the blobs on top of the specific branch | |
3. Commit the tree | |
4. Update the branch to point to the new commit | |
""" | |
import os |
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
# 3 important steps: | |
# | |
# A) Create a role for the integration (allowing PutEvents) | |
# B) Create the integration resource (specify that role) | |
# C) Create a route targeting that integration | |
resource "aws_apigatewayv2_integration" "api-gw-v2-integration-to-event-bridge" { | |
api_id = aws_apigatewayv2_api.some-api-gw-v2.id | |
integration_type = "AWS_PROXY" | |
integration_subtype = "EventBridge-PutEvents" |
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
"""This example shows how easy it is to generate and export ECDSA keys with python. | |
This program is similar to `ssh-keygen -t ecdsa` with no passphrase. | |
To export the private key with a passphrase, read paramiko.pkey.PKey._write_private_key method. | |
""" | |
import paramiko | |
from cryptography.hazmat.primitives.serialization import ( | |
Encoding, PrivateFormat, PublicFormat, NoEncryption | |
) |
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 typing import List | |
def cycle_sort(lst: List[int]) -> None: | |
"""The Cycle sort algorithm. | |
The sorted list is placed in place. | |
Wikipedia: https://en.wikipedia.org/wiki/Cycle_sort | |
""" | |
for i in range(len(lst) - 1): |
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 typing import List | |
def selection_sort(lst: List[int]) -> None: | |
"""The Selection sort algorithm. | |
The sorted list is placed in place. | |
Wikipedia: https://en.wikipedia.org/wiki/Selection_sort | |
""" | |
for i in range(len(lst) - 1): |
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 typing import List | |
def insertion_sort(lst: List[int]) -> None: | |
"""The Insertion sort algorithm. | |
The sorted list is placed in place. | |
Wikipedia: https://en.wikipedia.org/wiki/Insertion_sort | |
""" | |
for i in range(1, len(lst)): |