Skip to content

Instantly share code, notes, and snippets.

@omidmt
omidmt / gdb.py
Last active January 8, 2021 13:56
PicoCTF OTP Implementation by GDB Python API
import time
import gdb
def deref_str(addr):
plong = gdb.lookup_type('char' ).pointer()
val = gdb.Value(addr).cast(plong)
return val.string('ascii')
class MyBreakpoint(gdb.Breakpoint):
@omidmt
omidmt / vscode-container-dataflow.docker
Created January 14, 2021 02:45
VSCode Python DevContainer Docker + Dataflow (beam + gcloud)
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.154.2/containers/python-3/.devcontainer/base.Dockerfile
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
ARG VARIANT="3"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
# [Option] Install Node.js
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
@omidmt
omidmt / components.yaml
Created June 19, 2023 04:36
K8S Metric Server - private network
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: metrics-server
name: metrics-server
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
@omidmt
omidmt / PyJS Redirect
Last active October 23, 2023 10:33
Sample PyJS
from http.server import SimpleHTTPRequestHandler, HTTPServer
import json
class CustomHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
html_code = '''
@omidmt
omidmt / pub clipboard.md
Last active October 20, 2025 10:44
pub clipboard
We couldn’t find that file to show.