Skip to content

Instantly share code, notes, and snippets.

@lukeyeager
lukeyeager / compare_versions.py
Created September 30, 2015 21:39
Nobody sorts semantic versions correctly
#!/usr/bin/env python
import distutils.version
import pkg_resources
import random
import semantic_version
import sys
versions = sys.argv[1:]
@lukeyeager
lukeyeager / git-lg.cfg
Last active June 1, 2016 20:39
My version of `git lg`
# Add to ~/.gitconfig
[alias]
# http://stackoverflow.com/a/9074343/2404152
# Show parents of HEAD (1 line per commit)
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
# Show parents of HEAD (2 lines per commit)
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg = !"git lg1"
# Show all commits (1 line per commit)
lga = !"git lg --all"
#!/usr/bin/env python2
import argparse
import csv
from collections import OrderedDict
import os.path
import re
def parse_timings(input_filename, output_filename):
# Create a new virtualenv
# Allow it to use system standard packages
virtualenv venv --system-site-packages
# Activate the new environment
source venv/bin/activate
# Install any requirements that aren't already satisfied
pip install -r requirements.txt
FROM nvidia/cuda:8.0-cudnn5-devel-ubuntu16.04
MAINTAINER Luke Yeager <lyeager@nvidia.com>
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
emacs \
@lukeyeager
lukeyeager / Dockerfile
Last active February 2, 2017 20:26
NVcaffe on CentOS7
FROM nvidia/cuda:7.0-devel-centos7
RUN yum install -y epel-release
RUN yum install -y gcc gcc-c++ make cmake \
git \
gflags-devel glog-devel \
opencv-devel \
boost-devel \
openblas-devel \
@lukeyeager
lukeyeager / accuracy_layer.py
Last active February 27, 2017 12:07
Caffe - Rewrite Accuracy layer as a Python layer
import caffe
import json
class AccuracyLayer(caffe.Layer):
"""
Rewrite Accuracy layer as a Python layer
Accepts JSON-encoded parameters through param_str
Use like this:
@lukeyeager
lukeyeager / install-digits-centos7.sh
Last active May 16, 2017 21:54
Install DIGITS and NVcaffe on CentOS 7
# nvidia-docker run -ti nvidia/cuda:7.0-devel-centos7
yum update
yum install epel-release
yum install gcc gcc-c++ git vim python-devel python-pip make cmake \
blas-devel lapack-devel openblas-devel \
protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel gflags-devel glog-devel lmdb-devel libjpeg-devel libpng-devel
# Too old:
# yum install Cython scipy python-matplotlib
FROM ubuntu:trusty
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
asciidoc \
autoconf \
automake \
build-essential \
ca-certificates \
docbook-xml \
docbook-xsl \
@lukeyeager
lukeyeager / example.py
Last active September 21, 2017 19:38
DetectNet Python Inference
#!/usr/bin/env python2
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
"""
Classify an image using individual model files
Use this script as an example to build your own tool
"""
import argparse