Skip to content

Instantly share code, notes, and snippets.

View gramian's full-sized avatar
☯️

Christian Himpe gramian

☯️
View GitHub Profile
@gramian
gramian / hack4tex
Last active April 23, 2017 08:52
A small script to use the hack truetype font in pdflatex
#!/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 October 20, 2018 10:08
bash helpers
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 September 22, 2014 23:57
Antijet Colormap
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;
@gramian
gramian / matlab-octave.m
Last active June 24, 2023 19:15
Octave and Matlab Snippets
%% Math %%
si = @(x) sin(x) ./ (x + (x==0)); % cardinal sine without pi multiplied argument
hsin = @(x) 0.5 * (1.0 - cos(x)); % haversed sine
hcos = @(x) 0.5 * (1.0 + cos(x)); % haversed cosine
sigm = @(x,k) 0.5 * tanh(0.5 * k * x) + 0.5; % sigmoid function to (exp(-kx)+1)^-1