Skip to content

Instantly share code, notes, and snippets.

@ozora-ogino
ozora-ogino / install_nvtop_ec2.sh
Created August 11, 2024 08:21
Install nvtop on EC2.
#!/bin/bash
# Install prerquirements.
pip3 install cmake
sudo yum -y install ncurses-devel systemd-devel libudev-devel libdrm-devel
# Install nvtop
NVTOP_PATH=~/nvtop
git clone https://github.com/Syllo/nvtop.git ${NVTOP_PATH} && cd ${NVTOP_PATH}
mkdir -p ${NVTOP_PATH}/build && cd ${NVTOP_PATH}/build

AWS Resource Account ID Finder

This Bash script helps retrieve AWS account IDs associated with specific AWS services in different regions. It's particularly useful for identifying service-linked account IDs, which are often required for setting up resource policies or cross-account access.

Features

  • Supports multiple AWS services: ELB, S3, CloudFront, IAM, Lambda, and API Gateway
  • Dynamically retrieves region-specific account IDs for services like ELB
  • Provides hardcoded global account IDs for services like S3 and CloudFront
  • Validates AWS region input to prevent errors

Overview

This Bash script helps find equivalent Amazon Machine Images (AMIs) across different AWS regions. It takes three inputs: the source region, target region, and an AMI ID. The script first retrieves details of the specified AMI from the source region, including its name and owner ID. It then searches for an AMI with the same name and owner in the target region. If found, it displays the details of the equivalent AMI in the target region. This tool is useful for maintaining consistency across multi-region deployments or setting up disaster recovery configurations in AWS.

Usage

AWS CLI needs to be installed and configured.

./find_ami.sh ap-northeast-1 us-east-2 ami-063c89f793deac642
@ozora-ogino
ozora-ogino / abstract_papaer.py
Last active January 22, 2024 12:09
Abstract PDF paper
"""
pip install pdfminer.six openai
"""
from argparse import ArgumentParser
import re
import io
import requests
import pdfminer