Skip to content

Instantly share code, notes, and snippets.

# load test image
using Makie
using AbstractPlotting: limits
# The data
"""
Very simple resampling of an index range
"""
function resample(range)
# Instructions on how to build the owl OCaml scientific library (https://github.com/owlbarn/owl)
# Debian, Option 3: Pin the Dev-Repo, with distro's native OpenBLAS/LAPACKE packages
docker run --rm -it debian bash -eux -c 'apt-get update
# basic tools needed for opam to work:
apt-get install -y curl patch unzip make gcc bzip2 git
# we cannot automate running the install.sh from opam because it is interactive, instead we just download the opam binary:
curl -sL https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux --output /usr/local/bin/opam
chmod +x /usr/local/bin/opam
@dayne
dayne / 0-WSL-SSH-README.md
Last active June 30, 2024 05:22
WLS-Helpers

Install linux subsystem Ubuntu 18.04

See Microsoft's WSL install guide for windows 10 for details.

Work-in-progress - command line only install:

  • Open Powershell as Administrator and run:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Open Windows App Store
    • Search for "Ubuntu" and install Ubuntu 18.04

(work in progress - command line install steps):

@baiwfg2
baiwfg2 / CMakeLists.txt
Created September 29, 2018 12:42
How to use add_custom_target and add_custom_command correctly in cmake
# References:
# https://cmake.org/cmake/help/latest/command/add_custom_target.html
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
# https://gist.github.com/socantre/7ee63133a0a3a08f3990
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777
cmake_minimum_required(VERSION 3.10)
@mcattarinussi
mcattarinussi / gpg-ssh-setup.md
Last active May 3, 2025 18:26
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@ryandvmartin
ryandvmartin / c_interop.f90
Last active September 28, 2021 03:05
Fortran Character Arrays and Python Ctypes .... the pain is real.
! testing in the ipython notebook with the fortran code in one cell:
! %%file test.f90
! and with the build call in the following cell:
! `!gfortran -shared test.f90 -o test.dll`
! note: some useful stuff found here: https://stackoverflow.com/a/13880611/5545005
module c_interop
use iso_c_binding
implicit none
integer, parameter :: STRLEN = 64
contains
@mbinna
mbinna / effective_modern_cmake.md
Last active May 2, 2025 03:17
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@sir-deenicus
sir-deenicus / #Probabilistic Programming in the Browser.md
Last active December 29, 2018 18:14
Discrete Probability Monad with F# computation Expressions that runs in Fable.

Discrete Probability Monad with F# computation Expressions that runs in Fable

Copy and paste each part in turn into http://fable.io/repl/. Probabilistic programming part should start around line 220. Should be compatible with almost everything in http://greenteapress.com/wp/think-bayes/

Also provides text histogram plots!

@evertrol
evertrol / Makefiles.md
Last active February 23, 2025 11:34
Makefile cheat sheet

Makefile cheat sheet

Mostly geared towards GNU make

I've used ->| to indicate a tab character, as it's clearer to read than

  • Set a target, its dependencies and the commands to execute in order
target: [dependencies]
->| 
@aradi
aradi / .emacs
Created May 17, 2017 19:42
Emacs Fortran settings
;;
;; Add this settings to your ~/.emacs file
;;
;; Fortran settings
(setq fortran-continuation-string "&")
(setq fortran-do-indent 2)
(setq fortran-if-indent 2)
(setq fortran-structure-indent 2)