Skip to content

Instantly share code, notes, and snippets.

View dapperfu's full-sized avatar

dapperfu (+++ATH0) dapperfu

View GitHub Profile
@dapperfu
dapperfu / csv_logger.py
Created January 6, 2017 03:22
Log data from serial in to a csv file.
import serial
import sys
import datetime
port = sys.argv[1]
ser = serial.Serial(port=port, baudrate=115200, timeout=5)
try:
while 1:
data = "{},{},{}".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"),
port,
@dapperfu
dapperfu / numba.md
Last active November 17, 2017 11:07
Using GPU Numba with Vanilla Python on Linux.

NUMBAPRO_CUDALIB is undocumented and buried in numba/cuda/cudadrv/libs.pyto find.

My numba cuda checking scripts:

check.sh

@dapperfu
dapperfu / cuda.sh
Created January 8, 2017 23:44
CUDA
# CUDA.
apt-get install wget
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
apt-get update -y
# Recomends on a bare system installs a *ton* of 'junk', including the Ubuntu desktop. debtree chokes on telling you why.
apt-get install --no-install-recommends cuda
# NVIDIA CUDA® Deep Neural Network library (cuDNN)
# https://developer.nvidia.com/cud
@dapperfu
dapperfu / opencv320.sh
Last active November 28, 2019 09:49
Build .deb package for OpenCV 3 w/Python3 bindings.
#!/usr/bin/env bash
# Config
MAINTAINER="Jed Frey"
VERSION=3.2.0
# Adapted from http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
apt-get install --yes libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev \
libswscale-dev libxvidcore-dev libx264-dev libv4l-dev liblapacke-dev libgtk-3-dev \
libopenblas-dev libhdf5-dev libtesseract-dev libleptonica-dev \
def main():
print("{:3s} {:7s} {:s} {:s}".format("Dec","Float","hex","Hex"))
for count in range(0,256):
print("{0:3d} {0:5.1f} 0x{0:02x} 0X{0:02X}".format(count))
# Main body
if __name__ == '__main__':
main()
@dapperfu
dapperfu / Makefile.config
Last active January 29, 2017 17:05
Caffe Makefile
## Python3 Caffe Makefile.config
# Supports virtualenv
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
@dapperfu
dapperfu / Numba_16.04.md
Last active July 1, 2020 13:36
Installing Numba (requiring llvm) on Ubuntu 16.04

Installing Numba from pip fails since Ubuntu 16.04 only has up through llvm-3.8 in its repositories.

As of version 0.16.0, llvmlite requires LLVM 3.9. It does not support earlier or later versions of LLVM.

Install LLVM-3.9 through the LLVM's Debian/Ubuntu packages (http://apt.llvm.org/).

Add:

@dapperfu
dapperfu / Jenkins.bat
Created March 19, 2017 04:15
Jenkins skeletons for running Matlab from Jenkins.
@echo off
REM This batch file is a short example of how to call
REM MATLAB from the command line.
REM Options:
REM -nosplash Don't display the MATLAB Splash screen
REM -wait Don't return to the script until MATLAB is closed.
REM -c explicitly specify the license file.
REM -logfile Log all script output to the logfile.
REM -r Run the specified matlab commands.
@dapperfu
dapperfu / pkg_scratch.m
Created August 8, 2017 04:06
Programmatic Packaging
service = com.mathworks.toolbox_packaging.services.ToolboxPackagingService;
configKey = service.openProject(project_name);
@dapperfu
dapperfu / all_py.sh
Created October 2, 2017 17:28
Make all the Pythons. For unit testing.
VERS="2.4.6 2.5.6 2.6.9 2.7.14 3.0.1 3.1.5 3.2.6 3.3.7 3.4.7 3.5.4 3.6.3 3.7.0a1"
for VER in VERS
do
URL = https://www.python.org/ftp/python/${VER}/Python-${VER}.tgz
echo $URL
curl -L ${URL} | tar xzv
cd Python-${VER}
./configure --prefix=/opt/python