Skip to content

Instantly share code, notes, and snippets.

@ihrke
ihrke / prf_freq.ipynb
Created June 24, 2025 08:44
Frequency spectrum of the accumulated tonic responses
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ihrke
ihrke / nicequote.typ
Created February 14, 2025 08:30
Nice looking quotation box in Typst.
#show quote: it => {
block([
#place(rect(width: 20pt, height: 20pt, fill: white), top+left, dx: -10pt, dy: -10pt)
#place(text("“", size: 30pt, fill: blue.darken(40%)), top+left, dx: -10pt, dy: -10pt)
#text(it.body, fill: blue.darken(40%))
], inset: 8pt, fill: luma(255), radius: 6pt, stroke: .2pt+blue.darken(20%))
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>15_eval_13rfe</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
% Encoding: UTF-8
@Manual{rlanguage,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2015},
url = {https://www.R-project.org/},
}
@article{schonbrodtbfda,
@ihrke
ihrke / 01_test.R
Created March 28, 2018 13:01
RRM Stan implementation
library(ProjectTemplate)
load.project()
theme_set(theme_bw())
library(rstan)
options(mc.cores = parallel::detectCores())
bname<-tools::file_path_sans_ext(basename(this.file.name()))
### MCMC parameters iterations
@ihrke
ihrke / progressbar_R.R
Created September 27, 2017 07:38
one-line, fail-safe display of progressbar in for-loop
for(k in 1:nrep){
tryCatch(svMisc::progress(k, nrep, progress.bar = TRUE, init=(k==1)), error=function(x){})
}
@ihrke
ihrke / mclapply_expand_grid.R
Created May 31, 2017 14:52
how to use (mc)lapply together with expand.grid
library(tidyverse)
effs=seq(0, 1.0, by=0.05) # effect-sizes for which to calculate the design
rscales=c(sqrt(2)/2, 1, sqrt(2))
pars <- expand.grid(effs, rscales) %>% setNames(c("eff", "rscale"))
pars
lapply(data.frame(t(pars)), function(x) print(x))
@ihrke
ihrke / downsize_pdf.sh
Created May 30, 2017 07:01
reduce file size of PDF
##
## replace /screen with /ebook or /prepress for increasing levels of quality
##
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
@ihrke
ihrke / stallo_jupyter.sh
Created May 30, 2017 07:00
run jupyter notebook on stallo
## install everything (see other snippet)
# submit interactive job: http://hpc.uit.no/docs/guides/user/jobs
qsub -q express -I -lnodes=1,walltime=8:00:00
# start notebook on computing machine
source local/python/ipy3/bin/activate
ipython notebook --no-browser --port=8889
# on stallo login-node, enable port-forwarding: