Skip to content

Instantly share code, notes, and snippets.

@rbnvrw
rbnvrw / compress.sh
Created April 23, 2021 08:40
Compress PDF using ghostscript for online publication of a large book (e.g. a PhD thesis)
#!/bin/bash
# input file
INFILE=thesis.pdf
# output file
OUTFILE=thesis_compressed.pdf
# /printer compresses to ~300 DPI, various optimizations
# -dPrinted=false preserves PDF hyperlinks
@rbnvrw
rbnvrw / README.md
Last active March 10, 2020 10:36
Annotate, convert, crop, speed-up, scalebar overlay of an ND2 movie

See the Python notebook for the code. If you scroll down all the way down, you see an example of the last frame in a tracked, cropped and sped-up video. Features:

  • Convert an ND2 movie into avi/mp4/mov/wmv format
  • Add a scalebar of your choice to the movie
  • Speed-up the movie by a certain factor
  • With a csv file containing (frame,x,y,r,particle) columns: overlay the trajectories, particle number, circle of tracked radius
@rbnvrw
rbnvrw / build.sh
Last active May 14, 2016 20:12
Building Vim from source on Fedora 23 (see http://www.rubenverweij.nl/2016/05/building-vim-74-from-source-on-fedora-23.html for an explanation)
sudo dnf install -y ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
python3 python3-devel tcl-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed
# symlink xsubpp (perl) from /usr/bin to the perl dir
sudo ln -s /usr/bin/xsubpp /usr/share/perl5/ExtUtils/xsubpp
git clone https://github.com/vim/vim.git vim-src
cd vim-src
@rbnvrw
rbnvrw / .vimrc
Created March 15, 2016 21:38
Pandoc tables
function! s:tablePandoc() range
exe "'<,'>Tabularize /|"
let hsepline= substitute(getline("."),'[^|]','-','g')
exe "norm! o" . hsepline
exe "'<,'>s/-|/ |/g"
exe "'<,'>s/|-/| /g"
exe "'<,'>s/^| \\|\\s*|$\\||//g"
exe "'<,'>!pandoc -f markdown -t rst"
endfunction
command! -range=% TablePandoc :call <SID>tablePandoc()
@rbnvrw
rbnvrw / .vimrc
Last active March 12, 2016 20:32
Quick vim tips
" move vertically by visual line
nnoremap j gj
nnoremap k gk
" highlight just the 81st column of wide lines... (Damian Conway)
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" Enable code folding
set foldenable
@rbnvrw
rbnvrw / fix_after_scan.bimp
Created October 20, 2015 21:39
GIMP batch scripts (BIMP)
#BIMP 1.16
#MANIPULATION SET DEFINITION
[USERDEF0]
procedure=plug-in-despeckle
num_params=7
PARAM0=1
PARAM1=NOT_USED
PARAM2=NOT_USED
PARAM3=2
@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}
@rbnvrw
rbnvrw / latex-snippets.md
Last active August 29, 2015 14:23
Usefull LaTeX snippets

Framed equations

\usepackage{empheq}
\usepackage[many]{tcolorbox}

\tcbset{
  highlight math style={
    enhanced,
    colframe=black,
 colback=white,
@rbnvrw
rbnvrw / community_detection.py
Last active May 7, 2022 09:34
python-igraph example
from igraph import *
import numpy as np
# Create the graph
vertices = [i for i in range(7)]
edges = [(0,2),(0,1),(0,3),(1,0),(1,2),(1,3),(2,0),(2,1),(2,3),(3,0),(3,1),(3,2),(2,4),(4,5),(4,6),(5,4),(5,6),(6,4),(6,5)]
g = Graph(vertex_attrs={"label":vertices}, edges=edges, directed=True)
visual_style = {}
@rbnvrw
rbnvrw / diagram.svg
Last active October 14, 2015 21:02
Autolayout graph nodes for interrelation diagram
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.