Skip to content

Instantly share code, notes, and snippets.

View NilsFo's full-sized avatar
🐱
Why can't you trust MATLAB developers? They are always plotting something!

Nils NilsFo

🐱
Why can't you trust MATLAB developers? They are always plotting something!
View GitHub Profile
@butkej
butkej / gist:60d5ac9ceed1b9587d2856340f3f85d5
Last active May 14, 2021 13:41
Stuff I always forget since it comes up so rarely...

Misc.

  1. Fix matplotlib QXcb connection error (often happening when connected via ssh)
    import matplotlib as mlp
    mlp.use('Agg')
    import matplotlib.pyplot as plt
  1. Fix ident errors (when inheriting someones code)
@RUB-Bioinf
RUB-Bioinf / logger.m
Last active August 1, 2019 08:25
Logger - A concurrent Matlab logging method. Prints text to the console and an external file. Groups output into specidied IDs and adds a timestamp to every print.
% Displays a given text in the console and also appends it into a generic
% log file.
% A specific folder is created for all such log files.
% The log file is located in your current MATLAB path, in a new folder
% called "log".
% You can specifiy the log file by giving your log a unique ID. These ids
% are then grouped together and displayed in a single file.
%
% Works best for cases where you can't print to the console (eg. worker
% threads), but still need output to check later.
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@atiris
atiris / osmc-java-jdownloader-installer.sh
Last active September 8, 2023 13:01
Wizard to install the current version of JDownloader (jdownloader.org) on raspberry pi (running osmc or another linux). You can install (together or individually) latest java for RPI, download and install headless JDownloader (my.jdownloader.org) and create service to start JDownloader after boot and restart automatically after crash.
#!/bin/bash
# Script: osmc-java-jdownloader-installer.sh
# Author: Jozef Pažin
# Description: Wizard to install the current version of java and/or jdownloader on raspberry pi running osmc.
# License: MIT | use arbitrarily, attribution is not required
# How to run:
# - Check if this code is correct first because this script need to be run under root and run gist
# from web is not recommended in terms of security only that you know exactly what it does. Check it:
# curl -Ls https://gist.github.com/atiris/34dc670264274b3a472f2a718e4de83a/raw | nano -
@rbnvrw
rbnvrw / LaTeXScaleBars.md
Last active July 29, 2022 14:40
Adding scalebars to images in LaTeX

Scalebar with background

Scalebar with background

To change the backgroundcolor, adjust the scalebgcolor variable to use the desired color. Add the following code to your preamble:

\usepackage{tikz}
\usepackage[usenames, dvipsnames]{color}
\definecolor{scalebgcolor}{rgb}{0.08,0.52,0.80}
@daniellevass
daniellevass / android_material_design_colours.xml
Last active February 26, 2026 21:59
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@MaxBareiss
MaxBareiss / frechet.py
Last active July 7, 2023 13:36
Fréchet Distance in Python
# Euclidean distance.
def euc_dist(pt1,pt2):
return math.sqrt((pt2[0]-pt1[0])*(pt2[0]-pt1[0])+(pt2[1]-pt1[1])*(pt2[1]-pt1[1]))
def _c(ca,i,j,P,Q):
if ca[i,j] > -1:
return ca[i,j]
elif i == 0 and j == 0:
ca[i,j] = euc_dist(P[0],Q[0])
elif i > 0 and j == 0: