Skip to content

Instantly share code, notes, and snippets.

apiVersion: v1
kind: Pod
metadata:
name: gpu-test-vector-add
spec:
runtimeClassName: nvidia
restartPolicy: Never
containers:
- name: cuda-container
image: nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda10.2
@stantonk
stantonk / Dockerfile
Last active May 6, 2020 21:40
example of using docker container to package a python application
FROM python:3.7
RUN mkdir -p /data
COPY p.py /p.py
RUN pip install click
WORKDIR /
ENTRYPOINT ["python", "p.py"]
@stantonk
stantonk / Dockerfile
Created June 12, 2019 19:00 — forked from calavera/Dockerfile
Dockerfile to build the Go version of Execsnoop and run it with JSON output format
FROM ubuntu:18.04
# Install BCC Tools
RUN set -ex; \
echo "deb [trusted=yes] http://repo.iovisor.org/apt/bionic bionic-nightly main" > /etc/apt/sources.list.d/iovisor.list; \
apt-get update -y; \
DEBIAN_FRONTEND=noninteractive apt-get install -y auditd bcc-tools curl gcc git libelf1 libbcc-examples;
# Install Go
ENV GO_SHA 1dfe664fa3d8ad714bbd15a36627992effd150ddabd7523931f077b3926d736d
# from: http://www.slsmk.com/getting-the-size-of-an-s3-bucket-using-boto3-for-aws/
# modified to return rounded sizes in Gigabytes
# and sorted by descending total storage size
import boto3
import datetime
now = datetime.datetime.now()
cw = boto3.client('cloudwatch')
@stantonk
stantonk / statsd.py
Created January 30, 2018 15:59
statsd demo code in python
import re
import time
import sys
from socket import socket
from socket import AF_INET
from socket import SOCK_DGRAM
import os
@stantonk
stantonk / Vagrantfile
Last active July 26, 2017 19:57
python and dockerd in an Ubuntu VM.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :shell, :inline => <<-EOS
sudo apt-get update && sudo apt-get install -y python-dev python-pip git
sudo apt-get install python-pip
@stantonk
stantonk / Program.out
Last active June 29, 2017 03:49
Demonstrating classic thread safety issue with object reference being reused and passed to another thread
Thread-0 Person{name='Init', age=0}
Thread-0 Person{name='Init', age=0}
Thread-0 Person{name='Init', age=0}
main Person{name='Foo', age=-1356876606}
Thread-0 Person{name='Foo', age=-1356876606}
Thread-0 Person{name='Foo', age=-1356876606}
Thread-0 Person{name='Foo', age=-1356876606}
main Person{name='Bar', age=1050348248}
Thread-0 Person{name='Bar', age=1050348248}
Thread-0 Person{name='Bar', age=1050348248}
@stantonk
stantonk / jdk_download.sh
Created June 3, 2017 06:42 — forked from P7h/jdk_download.sh
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@stantonk
stantonk / Dockerfile
Created May 7, 2017 20:37
barebones Docker base image w/ Oracle JVM
FROM ubuntu:16.04
# Install Java8
# Presumes you have downloaded / accepted the license file from Oracle's website.
# https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps
RUN mkdir /opt/jdk
COPY ./jdk-8u112-linux-x64.tar.gz /tmp/
RUN tar -zxvf /tmp/jdk-8u112-linux-x64.tar.gz -C /opt/jdk
RUN update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_112/bin/java 100
RUN update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_112/bin/javac 100