Skip to content

Instantly share code, notes, and snippets.

View Flova's full-sized avatar

Florian Vahl Flova

View GitHub Profile
@Flova
Flova / script.ts
Last active August 8, 2023 19:36
Foxglove DSD active action user script
// Parses the debug json message from the DSD and publishes the currently active action
import { Input } from "./types";
// Define message
type Output = {
name: string;
};
interface DSDDebugDataElement {
@Flova
Flova / plot_grad_flow.py
Last active May 20, 2024 13:02
Plot the gradient flow (PyTorch)
# Based on https://discuss.pytorch.org/t/check-gradient-flow-in-network/15063/10
def plot_grad_flow(named_parameters):
'''Plots the gradients flowing through different layers in the net during training.
Can be used for checking for possible gradient vanishing / exploding problems.
Usage: Plug this function in Trainer class after loss.backwards() as
"plot_grad_flow(self.model.named_parameters())" to visualize the gradient flow'''
ave_grads = []
max_grads= []
@Flova
Flova / nginx_dump.sh
Last active February 16, 2024 11:22
Creates a memory dump of a running nginx. Usefull for getting lost config files from a running machine.
# Get the process id of nginx
NGINX_PID=$(pgrep -o 'nginx')
echo Nginx server PID: $NGINX_PID
# Get the memory parts that are used by nginx.
# That make gdb dump commands with it and dump the corresponding memory into files
cat /proc/$NGINX_PID/maps \
| awk '
$6 !~ "^/" {split ($1,address,"-");
print "dump memory mem_" address[1] " 0x" address[1] " 0x" address[2] ;}
@Flova
Flova / karma_mlp.ipynb
Last active August 26, 2020 11:17
Karma Regression MLP
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.