Skip to content

Instantly share code, notes, and snippets.

@meresmclr
meresmclr / find_available_port.py
Last active December 30, 2015 18:04 — forked from dbrgn/gist:3979133
Find an available port from Python script
#!/usr/bin/env python3
""" for use from shell, returns on STDOUT a free port number.
Yes, there is a slight race condition where between end of this program and start of your shell program,
another program could grab this port.
Useful for scripts with SSH port forwarding for example, where you have one or more hops before the final host.
reference: http://stackoverflow.com/questions/1365265/on-localhost-how-to-pick-a-free-port-number
Michael Hirsch
@meresmclr
meresmclr / splitstring.f90
Last active October 4, 2015 07:06 — forked from ponderomotion/splitstring.f90
Split a string into 2 either side a delimiter in FORTRAN
! split a string into 2 either side of a delimiter token
function split(instr, delm)
implicit none
CHARACTER(len=80),intent(in) :: instr,delm
INTEGER :: idx
idx = scan(instr,delm)
split = instr(1:idx-1)
END function split

Keybase proof

I hereby claim:

  • I am scienceopen on github.
  • I am michaelhirsch (https://keybase.io/michaelhirsch) on keybase.
  • I have a public key whose fingerprint is 8761 AE12 C085 981A 367D F3DC 05F2 BD2A 5250 07DF

To claim this, I am signing this object:

@meresmclr
meresmclr / octave 4.0 configure output
Created July 17, 2015 18:18
octave 4.0 on Ubuntu 14.04 ./configure output
Octave is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation prefix: /opt/octave4.0
C compiler: gcc -pthread -fopenmp -Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual -g -O2
C++ compiler: g++ -pthread -fopenmp -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -g -O2
Fortran compiler: gfortran -O
Fortran libraries: -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../.. -lgfortran -lm -lquadmath
Lex libraries:
LIBS: -lutil -lm
@meresmclr
meresmclr / rst-cheatsheet
Last active August 29, 2015 14:25
RST ReStructured Text Cheatsheet of frequently used syntax
hyperlink: Here is `my website <https://scivision.co>`_
code: two ways to do this:
easy way: just indent each line of code with a tab, leaving one blank line above and below each line of code
better way with syntax highlighting:
here is my python code
.. code:: python
@meresmclr
meresmclr / gist:62543e43769f73d11dfb
Created June 18, 2015 19:35
Loading ISR and video data at same time using GeoDataMatlab
Loading ISR data and AVI video at the same times from disk
Michael Hirsch
My first thought on finding the nearest neighbor in time between instruments
is to use interp1().
Let's say I have a radar that samples once every three seconds, and a camera that samples
once per second. The code below is done in Matlab/Octave.
```
@meresmclr
meresmclr / python mayavi virtualbox opengl error
Created June 17, 2015 02:49
Errors using python / Mayavi in a VirtualBox 5.0 virtual machine with 3D aceeleration enabled
https://www.virtualbox.org/ticket/12746
```
pci id for fd 4: 80ee:beef, driver (null)
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
@meresmclr
meresmclr / opencv3.1 cmake
Last active July 18, 2016 18:33
OpenCV3 cmake output on Ubuntu 16.04
On Ubuntu 16.04
https://scivision.co/anaconda-python-opencv3/
$ cmake -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=OFF -DENABLE_AVX=ON -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DWITH_VTK=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") -DPYTHON3_EXECUTABLE=$(which python3) -DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
-- The CXX compiler identification is GNU 5.3.1
-- The C compiler identification is GNU 5.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info