Skip to content

Instantly share code, notes, and snippets.

View nijine's full-sized avatar

Dmitriy Loshakov nijine

  • NYSHEX
  • New York, NY
View GitHub Profile
@nijine
nijine / setup_docker.sh
Created April 19, 2022 14:14
Docker easy setup script
#!/usr/bin/env bash
set -e
sudo apt update
sudo apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
@nijine
nijine / aws_cred_check_tool
Created October 15, 2020 21:43
Rudimentary AWS credentials observation tool, written for python 3.x, requires botocore module to be installed (packaged with boto3 module).
#!/usr/bin/env python3
import os
import traceback
from botocore import exceptions, session
try:
session_obj = session.get_session()
credentials = session_obj.get_credentials()
@nijine
nijine / bucket_mpu.py
Last active September 26, 2020 21:21
Quick and dirty way to output the sum of all multipart uploads in an s3 bucket, optionally limiting the output to objects that match a given prefix.
import boto3
from sys import argv, exit
def get_bucket_mpus_size(bucket_name, object_prefix=''):
aws_session = boto3.session.Session() # Uses either EC2/ECS metadata, ~/.aws/credentials file, or env vars for auth.
s3 = aws_session.resource('s3')
bytes_per_gb = 1024 * 1024 * 1024