Skip to content

Instantly share code, notes, and snippets.

View scivision's full-sized avatar
💭
I will be slow to respond.

scivision

💭
I will be slow to respond.
View GitHub Profile
@scivision
scivision / edisonBTsound
Created December 30, 2015 05:47
Bluetooth sound on Intel Edison
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 April 22, 2021 19:41
Python setup.py that installs requirements.txt using apt-get install (useful for ARM systems like Raspberry Pi and Beaglebone without Anaconda Python)
#!/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 October 18, 2018 17:08
Minimal Fortran Intel MKL CMake -- assuming you want MKL BLAS
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
#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.

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 July 25, 2019 03:03
CMake output from OpenCV 3 + OpenCV 3 contrib extra modules
# 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 November 16, 2017 14:43
Cmake OpenCV 3 output for Raspberry Pi 3 on Debian 9 stretch
# 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
#--- 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 January 31, 2024 20:47 — forked from drhirsch/pyephem_sunrise_sunset.py
Python example of computing sunrise/sunset using PyEphem
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 April 17, 2018 04:42
Python-Performance reuslts
/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