Skip to content

Instantly share code, notes, and snippets.

View AllanLRH's full-sized avatar

Allan L. R. Hansen AllanLRH

  • Copenhagen, Denmark
View GitHub Profile
@AllanLRH
AllanLRH / .hyper.js
Created June 16, 2017 22:36
.hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
@AllanLRH
AllanLRH / Vitual keystroke example
Created May 17, 2017 08:21 — forked from chriskiehl/Vitual keystroke example
Python win32api simple Vitual keystroke example
#Giant dictonary to hold key name and VK value
VK_CODE = {'backspace':0x08,
'tab':0x09,
'clear':0x0C,
'enter':0x0D,
'shift':0x10,
'ctrl':0x11,
'alt':0x12,
'pause':0x13,
'caps_lock':0x14,
@AllanLRH
AllanLRH / drAnalyse.ipynb
Last active April 12, 2017 10:55
DR 'kontanthjælps' plot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanLRH
AllanLRH / Numpy_broadcasting.ipynb
Last active March 21, 2017 16:16
Numpy broadcasting
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanLRH
AllanLRH / latexMWE.tex
Last active February 4, 2016 09:09
LaTeX MWE (Minimal Working Example)
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=5cm,type=eps,ext=.1.eps,read=.1.eps]{example}
\end{document}
@AllanLRH
AllanLRH / subl.m
Created January 17, 2014 00:10
Open file in Matlab path in Sublime text, from the command line in Matlab.
%% 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 / latex-clean.sh
Last active December 18, 2015 00:58 — forked from djsutherland/latex-clean.sh
Bash script for cleaning up after a LaTeX run
#!/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
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 / readPicoScopeCSV.m
Last active August 29, 2015 14:10
Read Picoscope 6 csv files.
%% 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 / timeDifference.py
Created August 13, 2014 13:46
Calculate time difference from strings formattet HH:MM:SS, using datetime module.
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'