Skip to content

Instantly share code, notes, and snippets.

function ∇tSTE(X::Array{Float64,2},
no_objects::Int64,
no_dims::Int64,
no_triplets::Int64,
triplets::Array{Int64,2},
λ::Float64,
α::Float64;
use_log = true::Bool)::Tuple{Float64,Array{Float64,2}}
P = Array{Float64}(Threads.nthreads())
function ∇tSTE(X::Array{Float64,2},
no_objects::Int64,
no_dims::Int64,
no_triplets::Int64,
triplets::Array{Int64,2},
λ::Float64,
α::Float64;
use_log = true::Bool)
P = 0.0::Float64
@kmundnic
kmundnic / pdf2eps.sh
Created August 7, 2017 16:31
PDF to EPS conversion
#!/bin/bash
# Convert PDF to encapsulated PostScript
# usage: pdf2eps <filename.pdf>
# Obtained from: https://tex.stackexchange.com/a/242265/62493
# Remove .pdf extension from input
filename=$(echo $1 | sed 's/.pdf//')
# Convert into .eps
pdftops $filename.pdf $filename-temp.ps
ps2eps $filename-temp.ps
@kmundnic
kmundnic / data_collection.js
Last active April 19, 2017 16:52
Logging bluetooth devices using a reelyActive reelceiver
// Karel Mundnich
// April 12, 2017
var reelib = require('reelib');
var barnacles = require('barnacles');
var barnowl = require('barnowl');
var chickadee = require('chickadee');
var sniffypedia = require('sniffypedia');
var fs = require('fs');
var keypress = require('keypress');
@kmundnic
kmundnic / save_to_svg.m
Created September 5, 2014 14:07
Resize and save MATLAB plots in SVG format
plot(data,'k');
rect = [0 0 1080 270]; % Resize to 4:1
set(gcf, 'OuterPosition', rect);
r = 150; % pixels per inch
set(gcf, 'PaperPosition', rect/r);
plot2svg('Figures/plot.svg');
@kmundnic
kmundnic / color_to_grayscale.py
Last active August 29, 2015 14:05
From a directory, select all .svg files and turn them into grayscale using Inkscape. Save as .pdf
import os
import subprocess
for filename in os.listdir('.'):
if filename[-3:] == 'svg':
subprocess.call(["inkscape",
"-f",
filename,
"--verb",
"EditSelectAll",
@kmundnic
kmundnic / argmin.m
Created August 9, 2014 17:42
argmin function for Matlab® vectors, matrices, and datacubes
function [ arg_min, minimum ] = argmin( A, dim )
%ARGMIN Find the argmin of a vector, matrix or datacube.
% A is the vector, matrix or data cube for which we want to find the
% minimum and the argument of the minimum.
% dim is the dimension of the data structure.
%% Error check for arguments
if dim > 3; error('Dimension must be 1 =< dim =< 3'); end
if dim < 1; error('Dimension must be 1 =< dim =< 3'); end
if isnan(A); error('A must be real'); end