Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Michael Hirsch scivision

💭
I may be slow to respond.
View GitHub Profile
@scivision
scivision / edisonBTsound
Created Dec 30, 2015
Bluetooth sound on Intel Edison
View edisonBTsound
opkg install alsa-utils kernel-module-snd-usb-audio bluez5 gstreamer pulseaudio
opkg install kernel-module-ftdi-sio
rfkill unblock bluetooth
bluetoothctl
power on
agent on
scan on
@scivision
scivision / setup_apt-get_requirements.py
Last active Apr 22, 2021
Python setup.py that installs requirements.txt using apt-get install (useful for ARM systems like Raspberry Pi and Beaglebone without Anaconda Python)
View setup_apt-get_requirements.py
#!/usr/bin/env python
from setuptools import setup
import subprocess
import sys,os
with open('requirements.txt', 'r') as f:
req = f.read().split('\n')
req = [os.path.basename(sys.executable) + '-' + r for r in req if r]
try:
@scivision
scivision / CMakeLists.txt
Last active Oct 18, 2018
Minimal Fortran Intel MKL CMake -- assuming you want MKL BLAS
View CMakeLists.txt
cmake_minimum_required(VERSION 3.1)
project(mytest Fortran)
# NOTE: -fdefault-integer-8 -m64 are crucial for MKL to avoid SIGSEGV at runtime!
add_compile_options(-fdefault-integer-8 -m64)
add_executable(inteld intel_dgemm.f90)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
View wc_josh-katz.c
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
// This is a "chunk" of characters that we can pull out and handle
// at one time. Since arrays in C are just collections of bytes we
// can iterate through a char array and pretend it was an int array.
// Using this union you can still get at the individual characters.
View keybase.md

Keybase proof

I hereby claim:

  • I am scivision on github.
  • I am michaelhirsch (https://keybase.io/michaelhirsch) on keybase.
  • I have a public key ASBVl-XHulfiM2wIc_VVlWTjcERM88PPv9RxzP3zxX3qhgo

To claim this, I am signing this object:

@scivision
scivision / opencv3-extras-cmake-output.txt
Last active Jul 25, 2019
CMake output from OpenCV 3 + OpenCV 3 contrib extra modules
View opencv3-extras-cmake-output.txt
# on Ubuntu 17.10
# https://www.scivision.dev/compiling-opencv3-with-extra-contributed-modules/
$ cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=OFF -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") -DPYTHON_EXECUTABLE=$(which python) -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
-- The CXX compiler identification is GNU 7.2.0
-- The C compiler identification is GNU 7.2.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
@scivision
scivision / opencv3-extras-cmake-output-raspi3.txt
Created Nov 16, 2017
Cmake OpenCV 3 output for Raspberry Pi 3 on Debian 9 stretch
View opencv3-extras-cmake-output-raspi3.txt
# Raspberry Pi 3 with Debian 9 stretch
$ cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=OFF -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") -DPYTHON_EXECUTABLE=$(which python) -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
-- The CXX compiler identification is GNU 6.3.0
-- The C compiler identification is GNU 6.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
View oct2pyIssue135.txt
#--- shell (Ubuntu 17.10, Octave 4.2.1, Python 3.6.4)
pip install oct2py==4.0.6
#--- Python
x=[0.,0,0,0,0,1,1,1,1,0,0,0,0,0]
from oct2py import Oct2Py
with Oct2Py() as oc:
oc.eval('pkg load signal')
y = oc.sgolayfilt(x,3,5)
@scivision
scivision / sunriseSunset.py
Last active Feb 3, 2021 — forked from drhirsch/pyephem_sunrise_sunset.py
Python example of computing sunrise/sunset using PyEphem
View sunriseSunset.py
import ephem
import datetime
Boston=ephem.Observer()
Boston.lat='42.3462'
Boston.lon='-71.0978'
Boston.date = datetime.datetime.now()
# %% these parameters are for super-precise estimates, not necessary.
Boston.elevation = 3 # meters
Boston.pressure = 1010 # millibar
@scivision
scivision / matmul.log
Last active Apr 17, 2018
Python-Performance reuslts
View matmul.log
/RunMatmul.py
Fortran -->
GCC version 6.2.0
--param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=35840 -mtune=broadwell -march=x86-64 -auxbase-strip CMakeFiles/matmul.dir/matmul.f90.o -g -O3 -Wall -Werror=array-bounds -Wextra -Wpedantic
double DGEMM (sec): 0.753308
single SGEMM (sec): 25.260954
double intrinsic (sec): 0.411206
single intrinsic (sec): 0.206234
--> Julia 0.6.2