Skip to content

Instantly share code, notes, and snippets.

View remlapmot's full-sized avatar
💭
I am currently on annual leave - I may be slow to respond.

Tom Palmer remlapmot

💭
I am currently on annual leave - I may be slow to respond.
View GitHub Profile
@remlapmot
remlapmot / restart-gpgagent.sh
Created July 11, 2022 07:59
gpg-agent should restart when required after being killed as follows
#!/bin/bash
gpgconf --kill gpg-agent
@remlapmot
remlapmot / r-cmd-check-as-cran.R
Last active April 8, 2024 12:42
Run devtools::check() as CRAN
# Run check as CRAN (well sort of)
devtools::check(env_vars = c(NOT_CRAN = FALSE))
devtools::check(env_vars = c(NOT_CRAN = FALSE), cran = TRUE, force_suggests = TRUE, incoming = TRUE)
# Additionally not building/re-running the vignettes
devtools::check(
env_vars = c(NOT_CRAN = FALSE),
args = c(
'--no-manual',
# Amendment from https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Data-in-packages
# https://stat.ethz.ch/pipermail/r-devel/2022-July/081873.html
CheckLazyDataCompression <- function(pkg)
{
pkg_name <- sub("_.*", "", pkg)
lib <- tempfile(); dir.create(lib)
zs <- c("gzip", "bzip2", "xz")
res <- double(3); names(res) <- zs
for (z in zs) {
opts <- c(paste0("--data-compress=", z),
@remlapmot
remlapmot / settings.json
Last active April 3, 2024 11:05
Zed settings
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"theme": "Rosé Pine Moon",
@remlapmot
remlapmot / brew-install-temurin.sh
Created April 2, 2024 10:38
Installing Java on Apple Silicon macOS for rJava R package to work
brew install temurin
@remlapmot
remlapmot / update-r-packages-macos
Last active March 29, 2024 11:41
Update brew packages and R 4.2.# package for x86_64 and aarch64 and Stata on macOS
#!/usr/bin/env zsh
# Update Homebrew
brew upgrade
# Update packages on R Apple Silicon aarch64 arch
R -q -e 'if (!is.null(old.packages(repos = "https://mac.r-project.org/"))) update.packages(ask = FALSE, repos = "https://mac.r-project.org/", type = "source", Ncpus = 4); remotes::update_packages()'
# Update StataMP on 10th, 20th, 30th of each month
DD=$(date +%d)
@remlapmot
remlapmot / default.Rmd
Last active February 7, 2024 11:51
Default R Markdown file to use in RStudio (from v1.3). File location: %appdata%\rstudio\templates ; on Mac/Linux: ~/.config/rstudio/templates
---
title: "Title"
author: "My Name"
date: "`r format(Sys.time(), '%d %B %Y')`"
output:
html_document:
toc: true
toc_float:
collapsed: false
smooth_scroll: false
@remlapmot
remlapmot / 4k-windows-resize-after-sleep-fix.reg
Last active February 4, 2024 16:23
Windows 10 registry entry setting which fixes PrimSurfSize.cx, PrimSurfSize.cy, and Stride values for a 4K monitor, so windows do not resize after sleep (an issue which seems to affect some Dell computers)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\NOEDID_8086_3E98_00000000_00020000_31063^9B5CF2A2AB5D52EABA55D3D249C48521]
"SetId"="NOEDID_8086_3E98_00000000_00020000_31063"
"Timestamp"=hex(b):7c,f5,a9,74,7f,f1,d5,01
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\NOEDID_8086_3E98_00000000_00020000_31063^9B5CF2A2AB5D52EABA55D3D249C48521\00]
"PrimSurfSize.cx"=dword:00000f00
"PrimSurfSize.cy"=dword:00000870
"Stride"=dword:00003c00
@remlapmot
remlapmot / install-mate-desktop.sh
Last active December 21, 2023 19:51
Install MATE desktop on WSL 2
sudo apt update && sudo apt upgrade -y
sudo apt install ubuntu-mate-desktop --no-install-recommends -y
sudo apt-get install mate-desktop-environment-extras
sudo dpkg-reconfigure dbus && sudo service dbus restart
# install missing icons
sudo apt install ubuntu-mate-icon-themes
# install fira code font
sudo apt install fonts-firacode
@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