Skip to content

Instantly share code, notes, and snippets.

@remlapmot
remlapmot / .wezterm.lua
Created July 25, 2024 15:12
WezTerm config file. Place in ~
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.font_size = 15
@remlapmot
remlapmot / r-cmd-check-as-cran.R
Last active July 22, 2024 09:18
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',
@remlapmot
remlapmot / pkgdown-delete-cache.R
Created July 9, 2024 08:39
Delete pkgdown cache - sometimes can get a corrupted .rds file somehow
fs::dir_delete(fs::path(tools::R_user_dir("pkgdown", "cache"), "http"))
@remlapmot
remlapmot / update-r-packages-macos
Last active June 6, 2024 17:13
Update brew packages and R 4.2.# package for x86_64 and aarch64 and Stata on macOS
#!/usr/bin/env zsh
# Update Homebrew packages
brew upgrade
# Update packages on R Apple Silicon aarch64 arch
R -q -e 'options(repos = c(personal = "https://remlapmot.r-universe.dev/", universe = "https://mrcieu.r-universe.dev/", CRAN = "https://cran.rstudio.com/")); if (!is.null(old.packages())) update.packages(ask = FALSE, type = "source", Ncpus = 4); remotes::update_packages()'
# Update StataMP on 10th, 20th, 30th of each month
DD=$(date +%d)
@remlapmot
remlapmot / local.conf
Created April 12, 2020 09:05
Allow WSL to use fonts installed on Windows. File location: /etc/fonts
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/mnt/c/Windows/Fonts</dir>
</fontconfig>
@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 / 4k-windows-resize-after-sleep-fix.reg
Last active May 6, 2024 17:22
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 / 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
# 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",