Skip to content

Instantly share code, notes, and snippets.

lukeyeager /
Created Feb 3, 2021
Read from prometheus and write to influxdb
set -euo pipefail
# connecting to prometheus
readonly prometheus_uri='localhost:9090'
# prometheus query
readonly query='sum(irate(metric_total[20s])) without (job)'
readonly ts_start=1612280785
readonly ts_end=1612390785

Keybase proof

I hereby claim:

  • I am lukeyeager on github.
  • I am lyeager ( on keybase.
  • I have a public key ASBPxiENsOuJMwW9ypR9FcR0az00XyEHSPjxgl9hx_CPFAo

To claim this, I am signing this object:

set -e
sort_func () {
tr ' ' '\n' | sort -u | (grep -v '^$' || true)
cutoff=$(date -Is --date='10 days ago')
# Get list of images used recently
# NOTE: events store image names, not IDs.
lukeyeager /
Last active Feb 14, 2019
Set GPU power levels
set -e
case "$1" in
max) ;;
default) ;;
min) ;;
echo "Usage: $0 [max,default,min]"
exit 1
lukeyeager /
Created Feb 7, 2019
AWS EC2: set a node's hostname to it's tagged name
set -ex
# Sanity check
hostname="$(hostname --fqdn)"
if [[ "$hostname" != ip-*.internal ]]; then
echo hostname already updated
exit 0
lukeyeager /
Last active Sep 21, 2017
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
View Dockerfile.ccache
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 /
Last active May 16, 2017
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
lukeyeager /
Last active Feb 27, 2017
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 / Dockerfile
Last active Feb 2, 2017
NVcaffe on CentOS7
View Dockerfile
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 \