Skip to content

Instantly share code, notes, and snippets.

@danielhfrank
danielhfrank / pydantic.py
Created December 1, 2020 00:15
Pydantic with Numpy
from typing import Generic, TypeVar
import numpy as np
from pydantic.fields import ModelField
JSON_ENCODERS = {
np.ndarray: lambda arr: arr.tolist()
}
DType = TypeVar('DType')
@githubfoam
githubfoam / Mellanox OFED cheat sheet
Last active April 1, 2024 07:32
Mellanox OFED cheat sheet
--------------------------------------------------------------------------
# ofed_info -s
--------------------------------------------------------------------------
Find Mellanox Adapter Type and Firmware/Driver version
ConnectX-4 card
# lspci | grep Mellanox
0a:00.0 Network controller: Mellanox Technologies MT27500 Family [ConnectX-3]
# lspci -vv -s 0a:00.0 | grep "Part number" -A 3
# lspci | grep Mellanox | awk '{print $1}' | xargs -i -r mstvpd {}
@arthurd2
arthurd2 / git-latexdiff.sh
Last active April 17, 2016 02:25
Easy integration with GIT and Latexdiff
#!/bin/bash
TMPDIR=$(mktemp -d /tmp/git-latexdiff.XXXXXX)
ORIDIR=`pwd`
TEX=$1
VER=$2
if [ -z "$2" ];then
VER='HEAD'
fi
import IPython.core.display
import matplotlib as mpl
def clean():
# set mpl defaults for nice display
mpl.rcParams['font.size'] = 12
mpl.rcParams['figure.figsize'] = (18, 6)
mpl.rcParams['lines.linewidth'] = 1