Skip to content

Instantly share code, notes, and snippets.

@remlapmot
remlapmot / rstudio.sh
Created November 22, 2023 14:36
Open second instance of an app on macOS
open -n -a RStudio.app
@remlapmot
remlapmot / git-rebase-abort.sh
Created November 16, 2023 11:43
When GitHub Desktop hangs doing a squash or rebase
git rebase --abort
@remlapmot
remlapmot / .gvimrc
Last active November 5, 2023 19:22
Settings for MacVim
colorscheme shine
set guifont=Fira\ Code:h13
@remlapmot
remlapmot / update-packages.R
Last active May 29, 2024 09:59
Solution to: Warning: package '#' in library '/usr/lib/R/library' will not be updated
# Solution to Linux warning message
# Warning: package '#' in library '/usr/lib/R/library' will not be updated
update.packages(oldPkgs = old.packages(), ask = FALSE)
@remlapmot
remlapmot / swap-blas-and-lapack-for-r.sh
Created March 10, 2023 12:39
Hot swap BLAS and LAPACK for use with R on Debian/Ubuntu
#!/usr/bin/env bash
# OpenBLAS serial
sudo apt-get install libopenblas-serial-dev
sudo update-alternatives --set libblas.so.3-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/openblas-serial/libblas.so.3
sudo update-alternatives --set liblapack.so.3-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/openblas-serial/liblapack.so.3
# OpenBLAS pthread
# sudo apt-get install libopenblas-base
# sudo update-alternatives --set libblas.so.3-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
@remlapmot
remlapmot / test-twosamplemr-install.R
Created February 9, 2023 20:07
Test installation methods for TwoSampleMR package
#' ---
#' title: "Test TwoSampleMR installation methods"
#' date: "2023-02-09"
#' output: html_document
#' ---
remove.packages(c('TwoSampleMR'))
reprex::reprex({
remotes::install_github("MRCIEU/TwoSampleMR")
@remlapmot
remlapmot / fix-tinytex.bat
Created January 11, 2023 12:39
Fix TinyTeX on Windows to find external Ghostscript installation resources; run as Admin in Command Prompt
mklink %APPDATA%\TinyTeX\tlpkg\tlgs\Resource\Init\Fontmap "%ProgramFiles(x86)%\gs\gs9.56.1\Resource\Init\Fontmap"
mklink %APPDATA%\TinyTeX\tlpkg\tlgs\Resource\Init\Fontmap.GS "%ProgramFiles(x86)%\gs\gs9.56.1\Resource\Init\Fontmap.GS"
rd /s /q %APPDATA%\TinyTeX\tlpkg\tlgs\Resource\Font
mklink /d %APPDATA%\TinyTeX\tlpkg\tlgs\Resource\Font "%ProgramFiles(x86)%\gs\gs9.56.1\Resource\Font"
@remlapmot
remlapmot / texmf.cnf
Created December 8, 2022 18:15
Use external Ghostscript in TinyTeX i.e. TeXLive on Windows; Filepath: %appdata%/TinyTeX
% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
%
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
TEXMFLOCAL = $SELFAUTOPARENT/texmf-local
@remlapmot
remlapmot / Makevars
Last active December 8, 2023 19:22
~/.R/Makevars file - to make homebrew libraries available whilst compiling source packages on Apple Silicon computers
FC=/usr/local/bin/gfortran
F77=/usr/local/bin/gfortran
FLIBS=-L/usr/local/gfortran/lib
CFLAGS=-I/opt/homebrew/include
CPPFLAGS=-I/opt/homebrew/include
CXXFLAGS=-I/opt/homebrew/include
CXX11FLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib
install.packages("tinytex")
tinytex::install_tinytex()