Skip to content

Instantly share code, notes, and snippets.

View noamtamim's full-sized avatar

Noam Tamim noamtamim

View GitHub Profile
@noamtamim
noamtamim / mcp_client.py
Created September 16, 2025 09:45
Simple HTTP MCP Client
#!/usr/bin/env python3
"""
Generic MCP client for communicating with Streamable HTTP MCP servers.
Very basic. Doesn't support any kind of auth.
No external dependencies.
Output is always JSON, unless there's an error.
DON'T use in an app or if performance matters.
@noamtamim
noamtamim / server.py
Created June 10, 2025 13:17
Server that returns whatever you ask it to
import wsgiref
import threading
@asynccontextmanager
async def http_server(headers: dict, body: bytes):
def app(_, start_response):
start_response("200 OK", list(headers.items()))
return [body] if body else []
server = wsgiref.simple_server.make_server("localhost", 0, app)
@noamtamim
noamtamim / server.py
Created March 28, 2025 13:43
Smallest possible Python web server
# This server returns an empty JSON object, no matter what.
from wsgiref.simple_server import make_server
import threading
def start_server():
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'application/json')])
return [b'{}']
@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">