Skip to content

Instantly share code, notes, and snippets.

@lukeyeager
lukeyeager / prometheus_to_influxdb.sh
Created Feb 3, 2021
Read from prometheus and write to influxdb
View prometheus_to_influxdb.sh
#!/bin/bash
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
View keybase.md

Keybase proof

I hereby claim:

  • I am lukeyeager on github.
  • I am lyeager (https://keybase.io/lyeager) on keybase.
  • I have a public key ASBPxiENsOuJMwW9ypR9FcR0az00XyEHSPjxgl9hx_CPFAo

To claim this, I am signing this object:

View remove_old_docker_images.sh
#!/bin/bash
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
lukeyeager / set_nvidia_pl.sh
Last active Feb 14, 2019
Set GPU power levels
View set_nvidia_pl.sh
#!/bin/bash
set -e
case "$1" in
max) ;;
default) ;;
min) ;;
*)
echo "Usage: $0 [max,default,min]"
exit 1
@lukeyeager
lukeyeager / ec2_set_hostname_from_tag.sh
Created Feb 7, 2019
AWS EC2: set a node's hostname to it's tagged name
View ec2_set_hostname_from_tag.sh
#!/bin/bash
set -ex
# Sanity check
hostname="$(hostname --fqdn)"
if [[ "$hostname" != ip-*.internal ]]; then
echo hostname already updated
exit 0
fi
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
lukeyeager / example.py
Last active Sep 21, 2017
DetectNet Python Inference
View example.py
#!/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.keras
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 \
View check-requirements.sh
# 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
View parse_caffe_timings.py
#!/usr/bin/env python2
import argparse
import csv
from collections import OrderedDict
import os.path
import re
def parse_timings(input_filename, output_filename):