Skip to content

Instantly share code, notes, and snippets.

@remlapmot
remlapmot / update-r-packages-macos
Last active January 22, 2025 07:24
Update brew packages and R 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 -e 'options(repos = c(personal = "https://remlapmot.r-universe.dev/", universe = "https://mrcieu.r-universe.dev/", CRAN = "https://cran.rstudio.com/")); if (length(pkgs <- setdiff(rownames(old.packages()), "pak")) > 0) {print(pkgs); pak::pkg_install(pkgs, upgrade = TRUE, ask = FALSE)}; update.packages(type = "source")'
# R -e 'options(repos = c(personal = "https://remlapmot.r-universe.dev/", universe = "https://mrcieu.r-universe.dev/", CRAN = "https://mac.r-project.org/")); 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
@remlapmot
remlapmot / update.sh
Last active January 2, 2025 14:02
Update Ubuntu apt packages and snaps
#!/usr/bin/env bash
sudo apt-get update && sudo apt-get --with-new-pkgs upgrade -y
sudo apt autoremove -y
sudo snap refresh
# remember to amend Ubuntu codename in repos URL
sudo R -e 'options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"]))); update.packages(repos = "https://p3m.dev/cran/__linux__/jammy/latest", ask = FALSE)'
@remlapmot
remlapmot / skhdrc
Last active December 30, 2024 07:48
skhd config ~/.config/skhd/
# App shortcuts
alt - c : open -a 'Google Chrome'
alt - d : open -a 'Docker Desktop'
alt - f : open -a 'Finder'
alt - g : open -a 'GitHub Desktop'
alt - m : open -a 'WhatsApp'
alt - o : open -a 'Microsoft Outlook'
alt - p : open -a 'Microsoft PowerPoint'
alt - r : open -a 'RStudio'
alt - s : open -a 'Slack'
@remlapmot
remlapmot / install
Last active December 19, 2024 08:51
Installing programs I use on Ubuntu
#!/usr/bin/env bash
# Git
sudo add-apt-repository ppa:git-core/ppa && sudo apt update -y && sudo apt install -y git
# R
# update indices
sudo apt update -qq -y
# install two helper packages we need
sudo apt install --no-install-recommends -y software-properties-common dirmngr
@remlapmot
remlapmot / settings.json
Last active November 8, 2024 08:35
Zed settings ~/.config/zed/
// 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 / .wezterm.lua
Last active November 7, 2024 10:53
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 = 13
@remlapmot
remlapmot / options.lua
Created November 1, 2024 11:17
NeoVim options ~/.config/nvim/lua/config
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
-- Enable line wrapping
vim.opt.wrap = true
@remlapmot
remlapmot / lazy.lua
Last active October 11, 2024 19:08
LazyVim config ~/.config/nvim/lua/config
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
@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"))