Skip to content

Instantly share code, notes, and snippets.

View dfsp-spirit's full-sized avatar

Tim Schäfer dfsp-spirit

View GitHub Profile
@dfsp-spirit
dfsp-spirit / cmake_install_ubuntu.bash
Created July 14, 2023 09:07
Compile and install clang into user home under Ubuntu Linux
#!/bin/sh
#
# This is a recipe, you should type things manually and check for errors
# after each command instead of treating this as a fire & forget shell script.
#
# This follows the official clang docs at https://clang.llvm.org/get_started.html
#
# Done under Ubuntu 22.04 LTS, with clang fetched from Github on 2023-07-04, commit 61e0822ef.
#
# This does not require root, but it uses cmake. If you don't have that, building it is easy, or just use autotools.

How to install heat (for Python) on MPCDF cluster

in bash:

module load anaconda/3/2021.11
conda init bash # most likely done already.
conda create -n heat python=3.9
conda activate heat
# Installing jekyll under Ubuntu 22.04
This was quite a pain, and I tried several things. This is a method that worked, but I do not
have much Ruby experience and cannot tell you whether its the best method. This method uses a local ruby installation in your user directory, so it is very low-risk.
1. Install reub-install from https://github.com/postmodern/ruby-install:
```shell
wget -O ruby-install-0.8.5.tar.gz https://github.com/postmodern/ruby-install/archive/v0.8.5.tar.gz
tar -xzvf ruby-install-0.8.5.tar.gz
@dfsp-spirit
dfsp-spirit / test_h5py_copy.py
Created August 30, 2022 11:46
Copy hdf5 file created with python using shutil
#!/usr/bin/env python
import h5py
import shutil
import numpy as np
import os
filename = "test.h5"
copy_filename = 'test_cpy.h5'
@dfsp-spirit
dfsp-spirit / gist:d63a6b56f2c11c92086a81911138b453
Last active September 7, 2021 20:08
Modyfying meshes in fsbrain's interactive view using a pre-render hook
# This currently requires fsbrain dev, >= 0.5.0.
#
# You will need to install with:
#
# devtools::install_github("dfsp-spirit/fsbrain", ref="geodesic");
#
# until 0.5.0 is available on CRAN.
#
library(fsbrain)
@dfsp-spirit
dfsp-spirit / fsbrain_register_post_render_hook.R
Last active August 27, 2021 15:21
Register a post-render-hook in fsbrain >= 0.5.0
library(fsbrain)
# We use thickness on fsaverage as demo data
sjd = fsaverage.path();
sj = "fsaverage";
# Visualize once with standard settings:
vis.subject.morph.native(sjd, sj, "thickness");
# Register a post-render callback function that can do whatever you want:
@dfsp-spirit
dfsp-spirit / read_freesurfer_morph.R
Last active September 17, 2020 09:14
Reading FreeSurfer morphometry data in R
#!/usr/bin/env Rscript
#
# This script illustrates how to load FreeSurfer morphometry data in R.
#
# If you do not have 'freesurferformats' yet, you need to install it:
# install.packages('freesurferformats');
library('freesurferformats');
subjects_dir = "~/data/study1"; # Replace with your data (or with example data from the 'fsbrain' package).
@dfsp-spirit
dfsp-spirit / read_write_freesurfer_morph.R
Last active September 17, 2020 09:13
How to load FreeSurfer morphometry data in R, transform it and save as new file
#!/usr/bin/env Rscript
#
# This script illustrates how to load morphometry data in R, apply some
# transformation (a simple log in this example), and save the result
# to a new file.
#
# If you do not have 'freesurferformats' yet, you need to install it:
# install.packages('freesurferformats');
library('freesurferformats');