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
using PyCall | |
@pyimport pickle | |
# This works for complex objects such as Scikit learn models. REB | |
# 20171129 | |
function mypickle(filename, obj) | |
out = open(filename,"w") | |
pickle.dump(obj, out) | |
close(out) |
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
""" | |
freedman_diaconis(x) | |
Estimates the required bin width for the distribution x. | |
Freedman, D. and Diaconis, P., 1981. On the histogram as a density | |
estimator: L 2 theory. Zeitschrift für Wahrscheinlichkeitstheorie und | |
verwandte Gebiete, 57(4), pp.453-476. | |
""" |
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
const MATLAB_EPOCH = Dates.DateTime(-0001,12,31) | |
""" | |
datenum(d::Dates.DateTime) | |
Converts a Julia DateTime to a MATLAB style DateNumber. | |
MATLAB represents time as DateNumber, a double precision floating | |
point number being the the number of days since January 0, 0000 |
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
using MAT | |
function mymatread(filename, varname) | |
file = matopen(filename) | |
x = read(file, varname) | |
close(file) | |
return x | |
end |
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
using PerceptualColourMaps | |
using Images | |
function myimagesc(A) | |
x = minimum(A) | |
y = maximum(A) | |
B = (A .- x) ./ (y - x) | |
imgc = applycolormap(B, cmap("R3")) # outputs a 3-dimensional array | |
imgc2 = colorview(RGB, permuteddimsview(imgc, (3,1,2))) | |
end |
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
""" | |
hysthresh(im, T1, T2) | |
Hysteresis thresholding | |
A simple port of Peter Kovesi's MATLAB method to Julia. | |
See http://www.peterkovesi.com/matlabfns/Spatial/hysthresh.m | |
Usage: bw = hysthresh(im, T1, T2) |
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
""" | |
bwselect(BW, c , r) | |
Select objects in a binary image. | |
Similar to the MATLAB function of the same name. | |
""" | |
function bwselect(BW, c, r) | |
# constants | |
north = CartesianIndex(-1, 0) |
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
# including this ensures that new gnome-terminal tabs keep the parent `pwd` ! | |
# https://ttboj.wordpress.com/2014/03/20/preserving-your-working-directory-in-gnome-terminal/ | |
if [ -e /etc/profile.d/vte.sh ]; then | |
. /etc/profile.d/vte.sh | |
fi |
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
nix-env -iA nixos.oraclejre8 | |
Unfortunately, we cannot download file jdk-8u131-linux-x64.tar.gz automatically. | |
Please go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to download it yourself, and add it to the Nix store | |
using either | |
nix-store --add-fixed sha256 jdk-8u131-linux-x64.tar.gz | |
or | |
nix-prefetch-url --type sha256 file:///path/to/jdk-8u131-linux-x64.tar.gz |
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
Connection='wireless' | |
Interface=wlp58s0 | |
Security='wpa-configsection' | |
Description="eduroam network" | |
IP='dhcp' | |
TimeoutWPA=30 | |
WPAConfigSection=( | |
'ssid="eduroam"' | |
'key_mgmt=WPA-EAP' | |
'eap=PEAP' |