Skip to content

Instantly share code, notes, and snippets.

View ebenolson's full-sized avatar

Eben Olson ebenolson

  • Presco Engineering
  • Woodbridge, CT
View GitHub Profile
@ebenolson
ebenolson / Dockerfile
Created November 9, 2015 17:23
openslide dockerfile
FROM ubuntu:trusty
########################################
#
# openslide 3.4.1 image based on Ubuntu:trusty
#
#######################################
# Set Locale
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ebenolson
ebenolson / convert_mod.py
Created January 4, 2019 21:14
KiCAD Python script to convert old .mod footprint libraries to .kicad_mod
import sys
from pcbnew import *
infile = sys.argv[1]
outdir = sys.argv[2]
inplugin = IO_MGR.PluginFind(IO_MGR.GuessPluginTypeFromLibPath(infile))
outplugin = IO_MGR.PluginFind(IO_MGR.GuessPluginTypeFromLibPath(outdir))
for name in inplugin.FootprintEnumerate(infile):
#!/bin/bash
if [ ! -f convert_mod.py ]; then
wget https://gist.github.com/ebenolson/07af5bf0919dfa7f5585577ad073c120/raw/fc15e516ff21a503833d9157f52de9334139ce7b/convert_mod.py
fi
docker run -it -v `pwd`:`pwd`:rw -w `pwd` ebenolson/kicad:5.0.0 bash -c "python convert_mod.py $1 $2"
sudo chown -R $USER $2
@ebenolson
ebenolson / mouser.js
Created November 30, 2018 16:26
Export MPN from Mouser order page
javascript:(function(){
function copyStringToClipboard (str) {
var el = document.createElement('textarea');
el.value = str;
el.setAttribute('readonly', '');
el.style = {position: 'absolute', left: '-9999px'};
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
@ebenolson
ebenolson / draw_net.py
Created March 27, 2015 23:01
Functions to draw Lasagne networks with graphviz, like Caffe's draw_net.py
"""
Functions to create network diagrams from a list of Layers.
Examples:
Draw a minimal diagram to a pdf file:
layers = lasagne.layers.get_all_layers(output_layer)
draw_to_file(layers, 'network.pdf', output_shape=False)
Draw a verbose diagram in an IPython notebook:
# Context manager to generate batches in the background via a process pool
# Usage:
#
# def batch(seed):
# .... # generate minibatch
# return minibatch
#
# with BatchGenCM(batch) as bg:
# minibatch = next(bg)
# .... # do something with minibatch
@ebenolson
ebenolson / bvlc_googlenet.py
Created July 16, 2015 15:31
BVLC GoogleNet translated to Lasagne
from lasagne.layers import InputLayer
from lasagne.layers import DenseLayer
from lasagne.layers import ConcatLayer
from lasagne.layers import NonlinearityLayer
from lasagne.layers import GlobalPoolLayer
from lasagne.layers.dnn import Conv2DDNNLayer as ConvLayer
from lasagne.layers.dnn import MaxPool2DDNNLayer as PoolLayerDNN
from lasagne.layers import MaxPool2DLayer as PoolLayer
from lasagne.layers import LocalResponseNormalization2DLayer as LRNLayer
from lasagne.nonlinearities import softmax, linear
@ebenolson
ebenolson / preseed.cfg
Created October 14, 2015 18:00
packer ubuntu 14.04 esxi
choose-mirror-bin mirror/http/proxy string
d-i base-installer/kernel/override-image string linux-server
d-i clock-setup/utc boolean true
d-i clock-setup/utc-auto boolean true
d-i finish-install/reboot_in_progress note
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/method string lvm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.