Skip to content

Instantly share code, notes, and snippets.


Noam Tamim noamtamim

View GitHub Profile
noamtamim /
Created Apr 21, 2021
Get AWS Region (with cache)
def get_region_name():
from urllib import request, error
me = get_region_name
if hasattr(me, 'cache'):
return me.cache
with request.urlopen("", timeout=1) as res:
me.cache =
noamtamim /
Created Apr 18, 2021
Kinesis Stream Reader
#!/usr/bin/env python3
import boto3
import time
from pprint import pprint
import json
import sys
client = boto3.client('kinesis')
noamtamim /
Last active Apr 12, 2021
macOS Terminal Tricks



This command writes (pastes) the content of the clipboard to stdout.

To use - copy (cmd-c) some text; then in the terminal type pbpaste and enter:

$ pbpaste
Hello, World!
View bitrates.csv
Country WIFI 2G 3G 4G
AD 3500 148 2200 5300
AE 3500 95 490 690
AF 470 95 810 1400
AG 1100 148 2200 3200
AI 3500 200 2200 1400
AL 3500 132 2200 3200
AM 2000 132 970 2000
AO 1100 95 970 5300
AR 2000 115 970 2000
noamtamim /
Last active Feb 25, 2020
AWS: IP ranges of API Gateway in us-east-1
# Assuming jq ( and curl are installed.
# Show only the entries for region = us-east-1 and service = API_GATEWAY.
curl -s | jq --raw-output '.prefixes[] | select(.region=="us-east-1" and .service=="API_GATEWAY") | .ip_prefix'
<< ////
noamtamim / docker-compose.yml
Created Nov 29, 2019
Simple Prometheus Docker Compose setup
View docker-compose.yml
version: '3.7'
prometheus_data: {}
# Setup:
# The app root directory contains an "etc" subdir with the config files required by all containers.
# Docker Compose creates an internal network for all containers so they can call each other by name.
noamtamim /
Last active Mar 21, 2021
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

noamtamim /
Created May 15, 2019
Convert mp4 files to mp3 (extract audio from mp4)

Convert mp4 files to mp3 (extract audio from mp4)

Assuming a simple mp4 with one video stream and one audio stream.

for f in *.mp4
  ffmpeg -i "$f" "${f%mp4}mp3"
<< ////
The script creates 'licenses' under '$ANDROID_HOME' and creates a file which proves
that the SDK license was accepted by the user.
Please copy this to your own account/gist/server. Every time there's an updated license, update the file with the new
license hash.
Legally if you run this script (or your own version of it), it means YOU accepted the license - don't trust someone else.
The hashes below are supposed to be taken from $ANDROID_HOME/licenses/android-sdk-license on YOUR machine, after you