Skip to content

Instantly share code, notes, and snippets.

View noamtamim's full-sized avatar

Noam Tamim noamtamim

View GitHub Profile
@noamtamim
noamtamim / quadrangulars.mmd
Last active February 6, 2025 13:31
מרובעים
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noamtamim
noamtamim / concise.mmd
Last active February 19, 2025 17:23
Concise
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noamtamim
noamtamim / kube.sh
Created June 10, 2024 08:34
Kubernetes aliases
# Aliases taken from https://github.com/PaulRoze/mezeze/blob/main/mezeze.sh
# To avoid cluttering the global shell namespace, only load them when `kube` is entered in the terminal.
function kube() {
alias k="kubectl"
alias kx="/usr/local/bin/kubectx"
alias kn="/usr/local/bin/kubens"
alias ke="kubectl exec -it"
alias kl="kubectl logs"
alias kg="kubectl get"
@noamtamim
noamtamim / dockers.md
Last active February 26, 2024 12:58
Dockers

Dockers

Redis

# Run
docker run -d --name redis -p 6379:6379 redis

# Stop
docker stop redis
@noamtamim
noamtamim / httprint.mjs
Last active January 3, 2024 15:13
Simple NodeJS http server that prints requests to stdout
// Usage:
// node httprint.mjs [PORT]
//
// The default port is 3000.
// Prints to stdout the request method, url, headers and body.
// Always returns 200 with an empty JSON object as the body and application/json as the content type.
import { createServer } from "node:http";
const port = process.argv[2] || 3000;
@noamtamim
noamtamim / kube.sh
Last active January 18, 2023 14:33
kubectl shortcuts
# Source this file to use
_podget() {
kubectl --namespace $NS get pods
}
_podnames() {
_podget | tail -n +2 | cut -d " " -f1
}
@noamtamim
noamtamim / redoc.html
Created July 5, 2021 21:52
redoc openapi template
<!DOCTYPE html>
<html>
<head>
<title>FastAPI - ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
@noamtamim
noamtamim / get-aws-region.py
Created April 21, 2021 16:11
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
try:
with request.urlopen("http://169.254.169.254/latest/meta-data/placement/region", timeout=1) as res:
me.cache = res.read().decode().strip()
@noamtamim
noamtamim / kinesis_reader.py
Created April 18, 2021 13:46
Kinesis Stream Reader
#!/usr/bin/env python3
import boto3
import time
from pprint import pprint
import json
import sys
client = boto3.client('kinesis')
@noamtamim
noamtamim / README.md
Last active April 12, 2021 14:22
macOS Terminal Tricks

Clipboard

pbpaste

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!