Skip to content

Instantly share code, notes, and snippets.

View shjwudp's full-sized avatar

Jianbin Chang shjwudp

View GitHub Profile
@stas00
stas00 / tb-rename-events.py
Created October 15, 2021 03:16
tensorboard rename event tags (based on https://stackoverflow.com/a/60080531/9201239)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# this script renames event names in tensorboard log files
# it does the rename in place (so make back ups!)
#
# example:
#
# find . -name "*.tfevents*" -exec tb-rename-events.py {} "iteration-time" "iteration-time/iteration-time" \;
#
@reywood
reywood / how-to.md
Last active April 15, 2025 16:37
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
from graphviz import Digraph
from torch.autograd import Variable
import torch
def make_dot(var, params=None):
if params is not None:
assert isinstance(params.values()[0], Variable)
param_map = {id(v): k for k, v in params.items()}
@bynil
bynil / config-git-proxy.txt
Last active September 27, 2025 17:07
Use git over socks5 proxy
Port: 1080
1. Create a file /YOUR PATH/gitproxy.sh with content:
#!/bin/sh
nc -X 5 -x 127.0.0.1:1080 "$@"
2. Edit your ~/.gitconfig
# For git://