Skip to content

Instantly share code, notes, and snippets.

Avatar

Allan L. R. Hansen AllanLRH

  • Copenhagen, Denmark
View GitHub Profile
@AllanLRH
AllanLRH / latex-clean.sh
Last active Dec 18, 2015 — forked from djsutherland/latex-clean.sh
Bash script for cleaning up after a LaTeX run
View latex-clean.sh
#!/bin/bash
exts=".ind .out .sync .idx .ilg .fls .log .aux .fdb_latexmk .bbl .blg .brf .lof .lol .lot .nav .snm .tdo .thm .toc .synctex.gz .run.xml -blx.bib"
for x in "${@:-.}"; do
arg=$(echo ${x:-.} | perl -pe 's/\.(tex|pdf)$//')
if [[ -d "$arg" ]]; then
for ext in $exts; do
rm -f "$arg"/*$ext
@AllanLRH
AllanLRH / subl.m
Created Jan 17, 2014
Open file in Matlab path in Sublime text, from the command line in Matlab.
View subl.m
%% subl: Open file in Sublime Text <3
% How to use it:
% subl filename
% or
% subl('filename')
%
% ... if you insist on doing it the hard way.
%
% Put the file somewhere in you MATLAB path, like "username"/Documents/MATLAB.
% The filename should be "subl.m"
@AllanLRH
AllanLRH / latexclean.py
Created Apr 16, 2014
Cleans the files left over from LaTeX compulation
View latexclean.py
#!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import division
from __future__ import print_function
from os import listdir, remove
from sys import argv
fileEndings = {'aux',
@AllanLRH
AllanLRH / timeDifference.py
Created Aug 13, 2014
Calculate time difference from strings formattet HH:MM:SS, using datetime module.
View timeDifference.py
from datetime import datetime
def timeDifference(t0, t1):
FMT = '%H:%M:%S'
timeDelta = datetime.strptime(t1, FMT) - datetime.strptime(t0, FMT)
return timeDelta
if __name__ == '__main__':
t0 = '08:00:00'
@AllanLRH
AllanLRH / readPicoScopeCSV.m
Last active Aug 29, 2015
Read Picoscope 6 csv files.
View readPicoScopeCSV.m
%% readPicoScopeCSV: Reads a picoscope csv file.
% Returns a matrix with [m N] matrix with [x, y1, y2, ... ym] as columns
% Output may be captured like: [x, y1, y2, ... ym] = readPicoScopeCSV('path/to/csv/file.csv')
function varargout = readPicoScopeCSV(csvFilePath)
data = csvread(csvFilePath, 3); % Three header lines
nColumns = size(data, 2);
if nargout == 1
varargout{1} = data;
return;
elseif nargout == nColumns
@AllanLRH
AllanLRH / doNotUpdateSpotify.sh
Last active Nov 19, 2020
Disable Spotify autoupdate on Mac OS X (testet on Yosemite).
View doNotUpdateSpotify.sh
# This script prevents Spotifys Autoupdating on OS X (testet on Yosemite)
# Based on this tutorial:
# http://supraliminal.net/blog/2013/4/21/how-to-revert-back-to-the-older-better-spotify-client
#
# This script must be run as root:
# sudo sh doNotUpdateSpotify.sh
#
FILE="/tmp/out.$$"
if [ "$(id -u)" != "0" ]; then
View 01.configure
2015-04-01 01:45:33 +0200
./configure
--disable-osx-universal-binary
--prefix=/usr/local/Cellar/imagemagick/6.9.0-10
--disable-dependency-tracking
--enable-shared
--disable-static
--without-pango
--with-modules
@AllanLRH
AllanLRH / latexMWE.tex
Last active Feb 4, 2016
LaTeX MWE (Minimal Working Example)
View latexMWE.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=5cm,type=eps,ext=.1.eps,read=.1.eps]{example}
\end{document}
View Numpy_broadcasting.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanLRH
AllanLRH / plotCausalGraph.py
Created Apr 7, 2017 — forked from nimezhu/plotCausalGraph.py
plot directed graph (python matplotlib)
View plotCausalGraph.py
#!/usr/bin/python
# programmer : zhuxp
# usage:
import sys
from getopt import getopt
import networkx as nx
import matplotlib.pyplot as plt
def show_help():
print >>sys.stderr,"\n\nplotCausalGraph.py: drawing causal graph from LiNGAM output equation matrix B"
print >>sys.stderr,"Library Dependence: networkx , matplotlib\n\n"
You can’t perform that action at this time.