Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Quarantine Code Ninja

Konrad Heidler khdlr

🏡
Quarantine Code Ninja
View GitHub Profile
@khdlr
khdlr / sane_quiver.py
Created Aug 13, 2021
How to get sane arrow plotting in matplotlib
View sane_quiver.py
ax.quiver(x, y, dx, dy,
scale=1, scale_units='xy', angles='xy')
View check_optimizers.py
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
khdlr / klib.py
Created Apr 12, 2017
File to automatically import in a Jupyter Notebook session to get to work quickly
View klib.py
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
khdlr / pipeline.py
Created Nov 30, 2016 — forked from alexmacedo/pipeline.py
Unix pipeline pattern in python
View pipeline.py
#! /usr/bin/env python
class Pipeline(object):
def __init__(self):
self.source = None
def __iter__(self):
return self.generator()
def generator(self):
View Stuff_I_Keep_Forgetting.sh
# 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