Skip to content

Instantly share code, notes, and snippets.

View gramian's full-sized avatar
☯️

Christian Himpe gramian

☯️
View GitHub Profile
@gramian
gramian / build_oct.sh
Last active April 27, 2024 01:07
Build Octave and numerical dependencies from source in Ubuntu 20.04
#!/bin/bash
# project: build_oct
# version: 1.12 (2023-01-01)
# 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 20.04 with GCC >= 10.3).
# requires hardware: either X86-64 with AVX2 or ARM64 with NEON.
# requires software packages: octave libpcre2-dev libreadline-dev libgmp3-dev libmpfr-dev libfreetype6-dev libgl2ps-dev libfontconfig1-dev libglu1-mesa-dev
@gramian
gramian / arcadedbsql-cheatsheet.md
Last active February 18, 2024 19:58
ArcadeDB SQL Cheat Sheet | build: pandoc arcadedb-cheatsheet.md -f markdown -o arcadedb-sql.pdf -V geometry:margin=1.5cm,landscape -V pagestyle=empty -V colorlinks=true

ArcadeDB SQL Cheat Sheet

CRUD

INSERT INTO <type>|BUCKET:<bucket>|<index> [(<field>[,]*) VALUES (<expression>[,]*)[,]*]|
$~~~~~~~~~~~~~~~~~~~$[SET <field> = <expression>|<command>[,]*]|[CONTENT {<json>}] [RETURN <expression>] [FROM <query>]

SELECT [<projections>] [FROM <target> [LET <assignment>*]] [WHERE <condition>*] [GROUP BY <field>*] [ORDER BY <fields>* [ASC|DESC]*]
$~~~~~~~~~~~$[UNWIND *] [SKIP ] [LIMIT ] [TIMEOUT []]

@gramian
gramian / neotemp
Created March 28, 2017 18:35
Read CPU temperature of Nanopi Neo
#!/bin/sh
echo $((`cat /sys/class/thermal/thermal_zone0/temp` / 1000))
@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
@gramian
gramian / Dockerfile
Created February 28, 2023 23:58
Chicken Scheme Dockerfile
## Chicken Scheme Dockerfile
# Build: docker build -t chicken:latest .
# Usage: docker run -it chicken
FROM alpine:latest
RUN apk add --no-cache chicken
RUN chicken-install linenoise
# RUN chicken-install other-egg
RUN adduser -D -g '' chicken
USER chicken
WORKDIR /home/chicken
@gramian
gramian / init.sh
Last active November 16, 2022 20:21
ArcadeDB initialization
#!/bin/bash
# Usage: ./init.sh localhost 2480 mydb root password myscript.sql
## Assign input commandline arguments
HOST=$1
PORT=$2
NAME=$3
USER=$4
@gramian
gramian / flamegraph.m
Last active July 28, 2021 18:01
Flame graph visualization for Octave's profiler output.
function flamegraph(profdata)
### project: flamegraph
### authors: Christian Himpe (0000-0003-2194-6754)
### version: 0.3 (2021-02-06)
### license: BSD-2-Clause (opensource.org/licenses/BSD-2-Clause)
### summary: Flame graph visualization for Octave's profiler output.
#
# USAGE:
#
# profile on;
@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 / versioninfo.m
Created February 7, 2019 12:20
Clone of Julia's versioninfo for Octave and MATLAB on Linux
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 / 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'