Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Christian Himpe gramian

🙃
View GitHub Profile
@gramian
gramian / versioninfo.m
Created Feb 7, 2019
Clone of Julia's versioninfo for Octave and MATLAB on Linux
View versioninfo.m
function v = versioninfo()
%%% project: versioninfo (clone of Julia's versioninfo for Octave and MATLAB)
%%% version: 1.0 ( 2019-02-07 )
%%% authors: C. Himpe ( 0000-0003-2194-6754 )
%%% license: BSD 2-Clause License ( opensource.org/licenses/BSD-2-Clause )
%%% summary: Collect compute environment and version information on Linux
% Interpreter name
if(exist('OCTAVE_VERSION','builtin'))
v.name = 'OCTAVE';
@gramian
gramian / flamegraph.m
Created Jan 6, 2019
Flame graph visualization for Octave's profiler output.
View flamegraph.m
function flamegraph(profdata)
### project: flamegraph
### authors: Christian Himpe (0000-0003-2194-6754)
### version: 0.1 (2019-01-06)
### license: BSD-2-Clause (opensource.org/licenses/BSD-2-Clause)
### summary: Flame graph visualization for Octave's profiler output.
#
# USAGE:
#
# profiler on;
@gramian
gramian / build_oct.sh
Last active Jul 1, 2020
Build Octave and some dependencies from source in Ubuntu 18.04.
View build_oct.sh
#!/bin/bash
# project: build_oct
# version: 1.5 ( 2020-01-31 )
# authors: C. Himpe ( 0000-0003-2194-6754 ), M. Koehler ( 0000-0003-2338-9904 )
# license: BSD-2-Clause License ( opensource.org/licenses/BSD-2-Clause )
# summary: Build Octave and numerical dependencies from source in Ubuntu 18.04.
# requires packages: octave libpcre3-dev libreadline-dev libfreetype6-dev libgl2ps-dev libfontconfig1-dev libglu1-mesa-dev libgl-mesa-dev
# add to .bashrc: alias oct='$HOME/BUILT/bin/octave-cli'
@gramian
gramian / cropper
Created Nov 15, 2017
Convert all files in a directory from eps to pdf and crop the pdf to minimum area.
View cropper
#!/bin/sh
for i in *.eps; do
epspdf ${i}
done
for i in *.pdf; do
pdfcrop ${i} ${i}
done
@gramian
gramian / neotemp
Created Mar 28, 2017
Read CPU temperature of Nanopi Neo
View neotemp
#!/bin/sh
echo $((`cat /sys/class/thermal/thermal_zone0/temp` / 1000))
@gramian
gramian / texutils.tex
Created Jan 9, 2017
Useful TeX macros
View texutils.tex
\usepackage{adjustbox} % \ftitle
\usepackage{bbold} % for \1
% Text
%% Identifiers
\newcommand*{\doi}[1]{DOI \href{http://doi.org/#1}{\texttt{#1}}} % doi command
\newcommand*{\isbn}[1]{ISBN \href{http://www.worldcat.org/search?q=#1}{\texttt{#1}}} % isbn command
%% Colors
@gramian
gramian / ainv.m
Last active Jul 18, 2016
Approximate matrix inverse of quadratic complexity ( A⁻¹ ≈ D⁻¹ - D⁻¹ E D⁻¹ )
View ainv.m
function x = ainv(m)
% ainv - approximate inverse
% by Christian Himpe 2016
% released under BSD 2-Clause License ( opensource.org/licenses/BSD-2-Clause )
d = diag(m);
d(d~=0) = 1.0./d(d~=0);
n = numel(d);
x = bsxfun(@times,m,-d);
x = bsxfun(@times,x,d');
@gramian
gramian / hack4tex
Last active Apr 23, 2017
A small script to use the hack truetype font in pdflatex
View hack4tex
#!/bin/sh
# hack4tex 0.1
# Copyright (c) 2016 Christian Himpe
# released under BSD 2-Clause License ( opensource.org/licenses/BSD-2-Clause )
# based on Stephan Lehmke's answer to "How do I use TrueType Fonts with PDFTeX
# using otftotfm?" on tex.stackexchange.com/a/52902
#
# requires otftotfm which is part of lcdf-typetools
#
@gramian
gramian / bashrc
Last active Oct 20, 2018
bash helpers
View bashrc
HISTIGNORE='git *'
alias cd..='cd ..'
alias uncommit='git reset --soft HEAD~'
alias forcepull='git fetch --all && git reset --hard origin/master'
alias oct='octave-cli'
alias mem='/usr/bin/time -f "%M KB"'
alias nano='nano -c -S'
alias ls='ls -la'
@gramian
gramian / antijet.m
Created Sep 22, 2014
Antijet Colormap
View antijet.m
function m = antijet(n)
% antijet colormap
% by Christian Himpe 2014
% released under BSD 2-Clause License ( opensource.org/licenses/BSD-2-Clause )
if(nargin<1 || isempty(n)), n = 256; end;
L = linspace(0,1,n);
R = -0.5*sin( L*(1.37*pi)+0.13*pi )+0.5;
G = -0.4*cos( L*(1.5*pi) )+0.4;
You can’t perform that action at this time.