Skip to content

Instantly share code, notes, and snippets.

View pmundt's full-sized avatar

Paul Mundt pmundt

View GitHub Profile
@pmundt
pmundt / Dockerfile Dart VM JIT
Created October 4, 2019 08:04
Dockerfile for JIT compilation of server-side app
FROM google/dart
WORKDIR /app
ADD pubspec.* /app/
RUN pub get
ADD . /app
RUN pub get --offline
CMD []
@pmundt
pmundt / Dockerfile Dart AOT
Created October 4, 2019 08:07
Multi-Stage Dockerfile for AOT compilation of server-side app
FROM google/dart AS dart-runtime
WORKDIR /app
ADD pubspec.* /app/
RUN pub get
ADD bin /app/bin/
ADD lib /app/lib/
RUN pub get --offline
RUN dart2aot /app/bin/server.dart /app/server.aot
@pmundt
pmundt / Dockerfile Dart Native
Created October 4, 2019 15:49
Multi-Stage Dockerfile for native compilation of server-side app using alpine-glibc base
FROM google/dart:2.6-dev AS dart-runtime
WORKDIR /app
ADD pubspec.* /app/
RUN pub get
ADD bin /app/bin/
ADD lib /app/lib/
RUN pub get --offline
RUN dart2native /app/bin/server.dart -o /app/server
@pmundt
pmundt / mro-clobber.py
Created October 8, 2019 14:37
Python MRO and Multi-class inheritance type clobbering
from abc import ABC, abstractmethod
from datetime import timedelta
class A1(ABC):
_value = "A1"
def __init__(self):
print("A1 type at init:", type(self._value))
def test_value(self):
@pmundt
pmundt / http-echo-service.yaml
Created May 5, 2020 15:20
http echo service
kind: Service
apiVersion: v1
metadata:
name: http-echo-service
spec:
type: NodePort
selector:
app: http-echo
ports:
@pmundt
pmundt / nano-echo-pod.yaml
Created May 5, 2020 15:21
http-echo-gpu-pod
apiVersion: v1
kind: Pod
metadata:
name: http-echo-gpu-pod
labels:
app: http-echo
spec:
containers:
- name: http-echo
image: adaptant/http-echo
@pmundt
pmundt / edgetpu-echo-pod.yaml
Last active May 30, 2020 21:10
HTTP Echo Service scheduled on an in-cluster EdgeTPU
apiVersion: v1
kind: Pod
metadata:
name: http-echo-edgetpu-pod
labels:
app: http-echo
spec:
containers:
- name: http-echo
image: adaptant/http-echo
@pmundt
pmundt / rpi4-ncs2-echo-pod.yaml
Created May 21, 2020 22:06
HTTP Echo Service for an RPi 4 B + Intel NCS2 attached via USB
apiVersion: v1
kind: Pod
metadata:
name: http-echo-rpi4b-ncs2-pod
labels:
app: http-echo
spec:
containers:
- name: http-echo
image: adaptant/http-echo
@pmundt
pmundt / edgetpu-devicequery.py
Created July 7, 2020 18:51
EdgeTPU Device Query Example
from edgetpu.basic import edgetpu_utils
version = edgetpu_utils.GetRuntimeVersion()
print(version)
all_edgetpu_paths = edgetpu_utils.ListEdgeTpuPaths(edgetpu_utils.EDGE_TPU_STATE_NONE)
print('Available EdgeTPU Device(s):')
print(''.join(all_edgetpu_paths))
@pmundt
pmundt / Dockerfile
Created July 7, 2020 18:53
EdgeTPU Device Query Dockerfile
FROM acceleratorbase/edgetpu-std
ADD devicequery.py /
CMD [ "python3", "devicequery.py" ]