Skip to content

Instantly share code, notes, and snippets.

@jayveeangeles
jayveeangeles / image_to_dockerfile.sh
Last active August 23, 2021 03:01
Parse Docker Image to become Dockerfile
#!/bin/sh
docker history --no-trunc $IMAGE | tac \
| tr -s ' ' | cut -d " " -f 5- | sed 's,^/bin/sh -c #(nop) ,,g' \
| sed 's,^/bin/sh -c,RUN,g' | sed 's, && ,\n & ,g' | sed 's,\s*[0-9]*[\.]*[0-9]*\s*[kMG]*B\s*$,,g' \
| head -n -1
@jayveeangeles
jayveeangeles / fancontrol.ino
Last active October 16, 2020 04:39
Sample PC Fan Controller (Arduino Leonardo)
// http://www.gammon.com.au/timers
// measure time from two triggers instead to get instantaneous readings
//
// create an overflow interrupt for Timer3 here and whenever there's an external interrupt,
// read the current value of Timer3 + the recorded overflows multiplied by 2^16 (Timer3
// counts up to 2^16 before overflowing). The external interrupt ISR will record the first
// and second time the ISR was triggered for a particular pin. The interrupt will also be
// disabled for that pin until the main loop is able to get the values for the start and
// finish times and calculate the frequency.
#define attachMyInterrupt(pin, mode) attachInterrupt(digitalPinToInterrupt(pin), +[](){ myInterruptHandler(pin); }, mode)
@jayveeangeles
jayveeangeles / send_ip.py
Last active January 28, 2021 06:16
Python3 script to send IP using Gmail SMTP
#!/usr/bin/python3
import socket
import argparse
import json
import logging
import os, sys
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
@jayveeangeles
jayveeangeles / cmake.txt
Created July 24, 2019 06:50
Example CMake config for build OpenCV for Jetson
/usr/local/bin/cmake \
-DWITH_TBB=ON \
-DWITH_CUDA=ON \
-DBUILD_opencv_python3=ON \
-DBUILD_opencv_python2=ON \
-DFORCE_VTK=ON \
-DBUILD_ZLIB=ON \
-DBUILD_TIFF=ON \
-DBUILD_JASPER=ON \
-DBUILD_JPEG=ON \
@jayveeangeles
jayveeangeles / pytensorrt.csv
Created July 24, 2019 06:44
Jetson container runtime plugin
dir /usr/lib/python3.6/dist-packages/tensorrt
dir /usr/lib/python2.7/dist-packages/tensorrt
dir /usr/lib/python3.6/dist-packages/tensorrt-5.1.6.1.dist-info
dir /usr/lib/python2.7/dist-packages/tensorrt-5.1.6.1.dist-info