Skip to content

Instantly share code, notes, and snippets.

Quarantine Code Ninja

Konrad Heidler khdlr

Quarantine Code Ninja
View GitHub Profile
khdlr /
Created Aug 13, 2021
How to get sane arrow plotting in matplotlib
ax.quiver(x, y, dx, dy,
scale=1, scale_units='xy', angles='xy')
import torch
from torch.optim import *
def check_optimizer(optimizer_type, modify_grad=False):
testvar = torch.ones([])
testvar.requires_grad = True
if optimizer_type is SGD:
opt = optimizer_type([testvar], 1e-3)
khdlr /
Created Apr 12, 2017
File to automatically import in a Jupyter Notebook session to get to work quickly
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from IPython.display import display
from IPython import get_ipython
khdlr /
Created Nov 30, 2016 — forked from alexmacedo/
Unix pipeline pattern in python
#! /usr/bin/env python
class Pipeline(object):
def __init__(self):
self.source = None
def __iter__(self):
return self.generator()
def generator(self):
# Copy .iso to usb stick
dd bs=4M if=/*.iso of=/dev/sdx && sync
# Convert .pngs to .gif (imagemagick)
convert -delay 2 -layers OptimizePlus *.png anim.gif
# Rip CD into the current directory
abcde -xpPo vorbis -d /dev/disk/by-id/$drive # Specifying the device seems to result in faster rips