Skip to content

Instantly share code, notes, and snippets.

View dangom's full-sized avatar

Daniel Gomez dangom

  • Cambridge, MA
View GitHub Profile
@dangom
dangom / ob-skewer.el
Created May 18, 2016 14:25 — forked from zot/ob-skewer.el
Small hack to let orgmode babel JS blocks use skewer if it's currently connected
;; modify ob-js to redirect to skewer if it is currently connected
;; this code can go in an emacs settings file
(require 'ob-js)
(require 'cl)
(advice-add 'org-babel-execute:js :around 'bill/org-babel-execute:skewer)
;;(advice-remove 'org-babel-execute:js #'bill/org-babel-execute:skewer)
(defun bill/org-babel-execute:skewer (oldFunc body params)
(if (skewer-ping)
(lexical-let* ((result-type (cdr (assoc :result-type params)))

Keybase proof

I hereby claim:

  • I am dangom on github.
  • I am dangom (https://keybase.io/dangom) on keybase.
  • I have a public key ASBKgWA4c8boXP8dXRDZtHTRQ9v9JGGiwsVY8x8Dg1br3Qo

To claim this, I am signing this object:

#! /usr/bin/python
#
# Author: Gaute Hope ([email protected]) / 2015
#
# based on example from matlab sinc function and
# interpolate.m by H. Hobæk (1994).
#
# this implementation is similar to the matlab sinc-example, but
# calculates the values sequentially and not as a single matrix
# matrix operation for all the values.
@dangom
dangom / matlab_engine_python_3_6.org
Last active May 21, 2020 14:32
Installing matlab-engine on python 3.6

How to install Matlab Engine on Python 3.6

Preparation

If you’ve tried recently to install matlab engine on a Python 3.6, you’ve seen a message saying that the platform is not supported. That doesn’t make any sense, since Python 3.5 is supported, right?

The problem is that Mathworks hardcodes a list with valid versions, I guess to reduce pressure on their customer service in case something goes wrong with untested versions. Well, that doesn’t mean that we shouldn’t be allowed to try it anyway, right?

@dangom
dangom / bart_centos_installer.bash
Last active November 22, 2020 02:57
Install Berkeley Advanced Reconstruction Toolbox without admin rights on a CentOS machine.
#!/bin/bash
# Time-stamp: <2017-07-19 15:06:39 dangom>
# Script for installing BART and dependencies from source on a CentOS machine without admin rights.
# Steps:
# 1. Build OpenBLAS from source to enable support for LAPACKE C API.
# 2. Build FFTW3 from source to enable float32 support (fftw defaults to double precision. BART doesn't)
# 3. Link against Matlab2016, because something changed in Matlab2017 and the BART build breaks.
# 4. Download Cmake >= 3 since cluster ships with old cmake 2.8
@dangom
dangom / partial_corr.py
Created November 22, 2017 13:57 — forked from fabianp/partial_corr.py
Partial Correlation in Python (clone of Matlab's partialcorr)
"""
Partial Correlation in Python (clone of Matlab's partialcorr)
This uses the linear regression approach to compute the partial
correlation (might be slow for a huge number of variables). The
algorithm is detailed here:
http://en.wikipedia.org/wiki/Partial_correlation#Using_linear_regression
Taking X and Y two variables of interest and Z the matrix with all the variable minus {X, Y},
@dangom
dangom / getFirafonts.sh
Created February 26, 2018 19:45 — forked from muammar/getFirafonts.sh
Download and install Fira fonts in Linux or Mac OS X
#!/bin/bash
## cf from http://programster.blogspot.com/2014/05/ubuntu-14-desktop-install-fira-sans-and.html
cd /tmp
# install unzip just in case the user doesn't already have it.
if [[ `uname` = Linux ]]; then
sudo apt-get install unzip -y
wget "http://www.carrois.com/downloads/fira_4_1/FiraFonts4106.zip"
@dangom
dangom / jq-insert-var.sh
Created April 13, 2018 15:47 — forked from joar/jq-insert-var.sh
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
import subprocess
import io
import pandas as pd
# The fslcc binary to use
FSLCC = '/opt/fsl/5.0.11/bin/fslcc'
# Parameters for the command line. No thresholding, report 4 digits.
FSLCC_PARAMS = ['-t', '0', '-p', '4']
@dangom
dangom / discrete_cmap.py
Created July 31, 2018 14:57 — forked from jakevdp/discrete_cmap.py
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""