Skip to content

Instantly share code, notes, and snippets.

View prog893's full-sized avatar
🧨
best-effort deployments

Torgayev Tamirlan prog893

🧨
best-effort deployments
View GitHub Profile
@prog893
prog893 / iam_describe_role.sh
Last active November 15, 2023 15:48
The missing "aws iam describe-role" that outputs assume role document, and contents of all related inline and attached policies
#!/bin/bash
# Usage: ./iam_describe_role.sh ROLE_NAME
# Prerequisites: awscli and jq
if [ -z "$1" ]; then
echo "Role name not provided" >&2
exit 1
fi
@prog893
prog893 / test_documentdb.py
Created August 31, 2023 10:51
Glue pythonshell script to test connectivity to DocumentDB in VPC with TLS, without internet access
### Glue pythonshell script to test connectivity to DocumentDB in VPC with TLS, without internet access
# make sure to configure connections to provision an ENI in VPC for network access:
# https://docs.aws.amazon.com/glue/latest/dg/glue-connections.html
### install packages from script to avoid pip calling PyPI for deps
# considering wheels and CA bundle are available at S3 bucket
import boto3
import subprocess
@prog893
prog893 / README.md
Last active July 12, 2023 19:18
Duplicate file cleaner

Duplicate file cleaner

This Python script helps you to organize your files in a unique and efficient way. It performs three main tasks:

  1. (optional, off by default) Rename Files: The script helps you organize your files by slightly adjusting the way your folders are named. Imagine you have a file in a subfolder like this: X/A/B/file.txt. The script will change this to: X A/B/file.txt. This means that the deepest level of your folder structure is brought up one level. This can make it easier to see the overall structure of your files and folders at a glance.

  2. Delete Duplicate Files: The script identifies duplicate files based on their SHA-256 hashes. For each group of duplicates, it asks the user to choose which file to keep and deletes the rest. The user is presented with an alphabetically sorted list of file paths and can either enter the number of the file to keep or press enter to choose the shortest file path by default.

  3. Delete Empty Directories: After moving and deleting files, so

@prog893
prog893 / game-porting-toolkit-jp-walkthrough.sh
Last active June 8, 2023 13:50
Apple game-porting-toolkit steps for Japanese software
#!/bin/bash
# not intended to be run as a script, some steps require GUI actions
# install Rosetta 2
softwareupdate --install-rosetta
# switch to i386
# using full path here to prevent Homebrew-provided zsh, which is only arm64, to be invoked and return errors
arch -x86_64 /bin/zsh
@prog893
prog893 / awscli-aliases.sh
Last active July 22, 2022 15:19
awscli aliases
# Prerequisites: awscli, jq
## Show role details for a Lambda function
function get-function-role() {
aws lambda get-function --function-name "$1" | jq '.Configuration.Role' -j | sed 's/.*\///' | xargs aws iam get-role --role-name | jq
}
## Show Lambda function resource-based policy
# Useful for debugging integration with other services (like API Gateway, ALB and EventBridge)
# since permissions for invocations from them are written here

Keybase proof

I hereby claim:

  • I am prog893 on github.
  • I am prog893 (https://keybase.io/prog893) on keybase.
  • I have a public key ASB6us59KKAc3KzR88kcY3_I5mTfGJQQIXBn4TTHyEPO-Ao

To claim this, I am signing this object:

module "fargate_scheduled_task" {
source = "baikonur-oss/fargate-scheduled-task/aws"
version = "2.0.2"
name = "sample-batch"
schedule_expression = "cron(0 0 1 * ? *)"
target_cluster_arn = "example_cluster"
task_definition_arn = aws_ecs_task_definition.batch.arn
module "iam" {
source = "baikonur-oss/iam-nofile/aws"
version = "v2.0.0"
name = "example_name"
type = "ec2"
policy_json = <<EOF
{
@prog893
prog893 / sample_registry.tf
Created December 2, 2019 09:06
Sample of Registry module sourcing in Terraform
module "hoge" {
 source = "baikonur-oss/iam-nofile/aws"
  version = "1.0.2"
...
}
@prog893
prog893 / sample_git_ssh.tf
Created December 2, 2019 09:03
Sample of Git+SSH module sourcing in Terraform
module "hoge" {
source = "git+ssh://[email protected]/baikonur-oss/terraform-aws-iam-nofile?ref=v1.0.2"
...
}