This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use ImageMagick convert | |
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf | |
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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}' | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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))) |