Skip to content

Instantly share code, notes, and snippets.

// almost word-for-word transcribed from the qrLMM R package
// if you want to operate in unconstrained space,
// mu can be left be
// sigma should be > 0, so log transform
// p should be 0 < p < 1, so logit transform
namespace ald {
// density function
template<class Type>
Type dald(Type y, Type mu, Type sigma, Type p) {
@aforren1
aforren1 / octave_from_source.sh
Created February 20, 2017 16:44
Condensed instructions for building octave from source on ubuntu 16.04
# install dependencies, lzip (for extracting compressed file), and checkinstall (for easy uninstall)
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot-x11 libgraphicsmagick++1-dev libhdf5-serial-dev openjdk-8-jdk libsndfile1-dev llvm-dev lpr texinfo libgl1-mesa-dev libosmesa6-dev pstoedit portaudio19-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libqt4-opengl-dev libsuitesparse-dev texlive libxft-dev zlib1g-dev autoconf automake bison flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar lzip checkinstall
# make an octave directory
cd ~
mkdir octave
cd octave
# fetch and extract files -- go to https://ftp.gnu.org/gnu/octave/
# to see if there's a more recent version

We'll stick to 32-bit installation (to make iohub happy?)

  1. Install python 2.7.12 x86 (make sure to add python to your PATH var, just for ease-of-use)
  • We use this version solely for compatibility with the nidaqmx package (2.7.14 being compatible when it comes out)
  • Ideally, psychopy will eventually support 3.x, which is actively developed
  1. Install wheels for numpy and scipy from http://www.lfd.uci.edu/~gohlke/pythonlibs/
  • for instance, use numpy‑1.12.1+mkl‑cp27‑cp27m‑win32.whl because we're using python 2.7 on 32 bit
  • python -m pip install <path_to_numpy_whl>.whl
  • We install these two globally because they're cumbersome to keep re-installing and rather large

IDE

  • rstudio

Reproducible research tools

  • packrat - roughly equivalent to python's virtualenv (isolated package env)
  • drake/remake - like GNU make (I think drake is better maintained at this point, but few examples)
  • RStudio's projects - at least drops you in the right working directory & ties in with packrat
  • Make a package! - higher startup cost, but user installation is trivial
  • rocker (R through Docker)
class Experiment(Machine):
def is_line_crossed(self): return self.line_crossed
def reset_line(self): self.line_crossed = False
def done_countdown(self):
self.countdown_done = True
print "Done the countdown"
def start_countdown(self):
# Install preemptive kernel
apt install build-essential git linux-image-rt-amd64 -y # check with `uname -r`
# Install miniconda (update later via `conda update conda`
wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda # accept license, add to path
echo 'export PATH="$HOME/miniconda3/bin:$PATH"' >> ~/.bashrc
# update audio settings
Install raspbian (https://www.raspberrypi.org/downloads/raspbian/)
run `sudo apt update && sudo apt upgrade --yes`
Turn on desktop GL in `sudo raspi-config`
(sudo apt install mesa-utils & run glxgears for verification)
edit /boot/config.txt and add `gpu_freq=500` (overclocks the GPU from 400->500) and `gpu_mem=320` (gives the GPU more memory)
@aforren1
aforren1 / tmp
Last active March 17, 2019 16:19
https://ci.appveyor.com/api/buildjobs/9lty5fdd9a8y133i/artifacts/dist/ratcave-0.8.0-cp37-cp37m-win_amd64.whl
# Speech 2
## Gratitude
Great job to <maid of honor>! I was tearing up there at the end.
I'd like to say a few words of thanks:
First and foremost to Natasha and Matt, for inviting all of us to share in their special day
@aforren1
aforren1 / bgfx-drawstress
Last active November 8, 2020 21:38
glmark2 for the NVIDIA Jetson Nano 2GB, fullscreen and default settings
Usually 10648 draw calls (22 Dim) at 60fps