Skip to content

Instantly share code, notes, and snippets.

@ZedYeung
ZedYeung / how-to.md
Last active May 5, 2021 18:16 — forked from reywood/how-to.md
How to get a stack trace from a stuck/hanging python script

How to get a stack trace for each thread in a running python script

Sometimes a python script will simply hang forever with no indication of where things went wrong. Perhaps it's polling a service that will never return a value that allows the program to move forward. Here's a way to see where the program is currently stuck.

Install gdb and pyrasite

Install gdb.

# Redhat, CentOS, etc
@ZedYeung
ZedYeung / index.html
Created January 10, 2020 07:24
awesome-k8s
<h1 id="awesome-kubernetes">Awesome-Kubernetes</h1>
<h2 id="awesome-kubernetes-annotations">Copy from https://github.com/ramitsurana/awesome-kubernetes, used for learning</h2>
<p><a href="https://github.com/sindresorhus/awesome"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"></a>
<a href="https://travis-ci.org/ramitsurana/awesome-kubernetes"><img src="https://travis-ci.org/ramitsurana/awesome-kubernetes.svg?branch=master" alt="Build Status"></a>
<a href="https://semaphoreci.com/ramitsurana/awesome-kubernetes"><img src="https://semaphoreci.com/api/v1/ramitsurana/awesome-kubernetes/branches/master/badge.svg" alt="Build Status"></a>
<a href="http://creativecommons.org/licenses/by-nc/4.0/"><img src="https://img.shields.io/badge/License-CC%204.0-brightgreen.svg?style=flat-square" alt="License"></a>
<a href="https://hub.docker.com/r/ramitsurana/awesome-kubernetes"><img src="https://img.shields.io/docker/build/ramitsurana/awesome-kubernet
@ZedYeung
ZedYeung / v8_profile.sh
Last active July 16, 2019 20:39
nodejs
FILE="example"
node --prof --no-logfile-per-isolate --log --logfile=${FILE}.log ${FILE} && node --prof-process ${FILE}.log | less && rm ${FILE}.log
ab -n 100 -c 10 -m POST http://localhost:8080/processFileSync
loadtest -n 100 -c 10 -m POST http://localhost:8080/processFileSync
#!/bin/bash
sudo cp -r ~/myfonts /usr/share/fonts/truetype
sudo fc-cache -fv
You can ssh into the VM by finding the IP (from kubectl config view) and using username "docker" password "tcuser":
ssh docker@192.168.XX.XX
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
POSINT \b(?:[1-9][0-9]*)\b
NONNEGINT \b(?:[0-9]+)\b
@ZedYeung
ZedYeung / .zshrc
Last active August 16, 2018 05:36
plugins=(
git
docker
encode64
history
systemd
)
# docker compose autocompletion
# autoload -Uz compinit && compinit -i
#!/bin/bash
# shadowsocks-libev
sudo apt install shadowsocks-libev
sudo ufw allow 8389
sudo tee /etc/shadowsocks-libev/config.json > /dev/null<<EOF
{
"server":"192.168.1.109",
"server_port":8389,
import re
import glob
# https://www.elastic.co/blog/strings-are-dead-long-live-strings
files = glob.glob('./*19_mapping.json')
for file in files:
print(file)
with open(file) as f:
text = f.read()