Skip to content

Instantly share code, notes, and snippets.

View HenrikBengtsson's full-sized avatar

Henrik Bengtsson HenrikBengtsson

View GitHub Profile

I use Ubuntu (20.04 LTS, now 22.04 LTS) as my main operating system. Some background on switching from OS X to Ubuntu here: https://github.com/bjohas/Ubuntu-keyboard-map-like-OS-X. I don't really use Windows at all, and I am surprised with how the intial setup of Windows has gone wrong for some of my friends (missing dlls, etc etc). However, there are a few 'OS X / Windows only things' and with a larger SSD on a new laptop, I thought I'd preserve Windows. E.g., 'OS X / Windows only things' include Adobe Creative Suite, as well as using Oculus/Meta Quest 2 via a PC connection.

Dual booting Ubuntu and Windows with encryption (for Ubuntu 22.04 LTS)

I used these instructions to dual-boot-ubuntu-and-windows-with-encryption.md https://www.mikekasberg.com/blog/2020/04/08/dual-boot-ubuntu-and-windows-with-encryption.html

Dual-booting with encrypted storage should not be this hard in 2020 2022.

@abraithwaite
abraithwaite / chill-zoom.sh
Last active May 8, 2024 08:43
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"
@nuest
nuest / switching-from-XML-to-xml2.md
Last active March 6, 2024 17:07
Switching an R package from XML to xml2

Switching from XML to xml2

Rationale

The R package XML for parsing and manipulation of XML documents in R is not actively maintained anymore, but used by many:

The R package xml2 is an actively maintained, more recent alternative.

This file documents useful resources and steps for moving from XML to xml2.

@gmbecker
gmbecker / argify.R
Created April 4, 2018 18:21
Add argument specification to a function call
argify = function(expr, recursive = FALSE) {
if(is.character(expr))
expr = parse(text = expr)
else if(!is.call(expr))
expr = substitute(expr)
stopifnot(is.call(expr))
if(recursive && length(expr) > 1) {
for(i in 2:length(expr)) {
if(is.call(expr[[i]]))
expr[[i]] = argify(expr[[i]], TRUE)
# This makes a feature-complete macOS-centric CRAN mirror that ends up being ~72GB
# for most ops: recurse, preserve mod times, preserve symlinks, ensure compression for xfers and delete extraneous files
# get macOS pkg binaries
rsync -rlptDz --delete cran.r-project.org::CRAN/bin/macosx/mavericks/contrib/3.2/ /cran/bin/macosx/mavericks/contrib/3.2/
rsync -rlptDz --delete cran.r-project.org::CRAN/bin/macosx/mavericks/contrib/3.3/ /cran/bin/macosx/mavericks/contrib/3.3/
rsync -rlptDz --delete cran.r-project.org::CRAN/bin/macosx/mavericks/contrib/3.4/ /cran/bin/macosx/mavericks/contrib/3.4/
rsync -rlptDz --delete cran.r-project.org::CRAN/bin/macosx/el-capitan/ /cran/bin/macosx/el-capitan/
@ctesta01
ctesta01 / qsf_explanation.md
Last active July 6, 2024 21:17
How does a Qualtrics Survey File work?

Quickstart Guide to undertsanding the Qualtrics Survey File

This information is likely to quickly become outdated when Qualtrics next changes the formatting of the QSF file. This guide was started February 2017. I hope that it is a useful introduction to understanding the contents of the QSF file that one can download from Qualtrics.

This document includes:

#!/bin/sh
# -*- mode:R -*-
#PBS -l nodes=1:ppn=8,mem=30gb
'\' >/dev/null 2>&1 || true
# This is bash code to set up the environment
echo "Hello from bash!"
echo "Args are: $@"
--- R-3.2.1/src/main/memory.c.orig 2015-07-31 23:15:07.017151621 -0700
+++ R-3.2.1/src/main/memory.c 2015-07-31 23:17:10.185150073 -0700
@@ -3724,11 +3724,21 @@
static FILE *R_MemReportingOutfile;
static R_size_t R_MemReportingThreshold;
+static void printLineNum(FILE *file, SEXP srcref) {
+ if (srcref && !isNull(srcref)) {
+ int line = asInteger(srcref);
+ fprintf(file, "#%d ", line);
@btoone
btoone / curl.md
Last active June 29, 2024 16:01
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream