Skip to content

Instantly share code, notes, and snippets.

View yermulnik's full-sized avatar
🇺🇦
Yz

George L. Yermulnik yermulnik

🇺🇦
Yz
  • Earth, Europe, Ukraine, Kyiv
  • 07:26 (UTC +03:00)
  • LinkedIn in/yermulnik
View GitHub Profile
@adtac
adtac / Dockerfile
Last active May 28, 2024 01:38
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@benkehoe
benkehoe / aws_console_launcher.py
Created October 5, 2022 17:17
Launch the AWS web console from the CLI
# Copyright 2022 Ben Kehoe
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
@alonlavian
alonlavian / vpc-inside.py
Created August 7, 2022 08:09
Describe resources inside an AWS VPC
import logging
import boto3
from argparse import ArgumentParser, HelpFormatter
from botocore.exceptions import ClientError, ProfileNotFound
# logger config
logger = logging.getLogger()
logging.basicConfig(level=logging.INFO,
format='%(message)s')
@v-rosa
v-rosa / gist:aa9c8afd44d66c3a81b9920a1bc90e42
Last active July 17, 2024 10:14
Use private GitHub hosted terraform modules with AFT v1.5.1

I'll try to share my approach to use private GitHub hosted terraform modules with AFT v1.5.1. It relies on GH App to create ephemeral tokens during Global Customization stage which will share with the target account so it can be used during Account Customization stage.

Relates to: aws-ia/terraform-aws-control_tower_account_factory#42

Pre-requirements:

  • Create a GH APP:
    • Permissions: allow the clone of repositories
    • Set to a restricted list of terraform modules repos
  • Create parameter store entries for GH_APP pem, id and installation_id under AFT_MGT account
@benkehoe
benkehoe / aws_assume_role.py
Last active November 13, 2022 13:48
Assumed role session chaining (with credential refreshing) for boto3
# *** WARNING ***
# This gist is no longer maintained
# It has been replaced by aws-assume-role-lib in PyPI
# Documentation at https://github.com/benkehoe/aws-assume-role-lib
# It is still a single-file library, you can find the stable version here:
# https://raw.githubusercontent.com/benkehoe/aws-assume-role-lib/stable/aws_assume_role_lib/aws_assume_role_lib.py
# (link also available in the docs)
# Copyright 2020 Ben Kehoe
#
cmake_minimum_required(VERSION 3.10)
project(cppgen VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(remapping remapping.cc)
target_link_libraries(remapping stdc++ "-framework Foundation" "-framework IOKit" objc)
#!/usr/bin/env python
"""
sort terraform variables
it's easy to do, just follow these steps:
python sort_terraform_variables.py variables.tf > sorted_variables.tf
mv sorted_variables.tf variables.tf
"""
from __future__ import print_function
import sys
@dimo414
dimo414 / _README.md
Last active November 28, 2022 07:25
Bash array expansion patterns for use with -u

Expanding Bash arrays safely with set -u

Prior to Bash 4.4 set -u treated empty arrays as "unset", and terminates the process. There are a number of possible workarounds using array parameter expansion, however almost all of them fail in certain Bash versions.

This gist is a supplement to this StackOverflow post.

# How to install:
# pre-commit install --install-hooks && pre-commit install --install-hooks -t commit-msg
# How temporary skip one of hooks: https://pre-commit.com/#temporarily-disabling-hooks
repos:
#######
# ALL #
#######
@avoidik
avoidik / AWS-AutoUnseal-HashiCorp-Vault.md
Created June 19, 2019 08:53 — forked from allthingsclowd/AWS-AutoUnseal-HashiCorp-Vault.md
HashiCorp Vault AWS KMS AutoUnseal Key Rotation Example (all keys are obsolete - just a demo)

A Walk through of Key Rotation of a HashiCorp VAULT cluster using AWS KMS to AutoUnseal

PGP (Keybase) is used to encrypt the recovery keys

Built base environment using HashiCorp's Learn Website

ubuntu@ip-192-168-100-194:~$ export VAULT_ADDR=http://127.0.0.1:8200

ubuntu@ip-192-168-100-194:~$ vault status