Skip to content

Instantly share code, notes, and snippets.

@vm-wylbur
vm-wylbur / running_script.R
Created January 1, 2019 00:13
get name of the running script in R (or RStudio)
.get_running_name <- function() {
#' returns name of current script
if (interactive()) {
fname <- rstudioapi::getActiveDocumentContext()$path
} else {
# via commandArgs, look for file=
cmdArgs = commandArgs(trailingOnly = FALSE)
needle <- '--file='
fname <- grep(needle, cmdArgs, value=TRUE)
}
@vm-wylbur
vm-wylbur / Makefile
Created January 1, 2019 02:12
create LaTeX from Rmd, using a Makefile, the HRDAG way
#
# Authors: PB
# Maintainers: PB
# Copyright: 2018, HRDAG, GPL v2 or later
# ============================================
R_OPTS=--no-save --no-restore --no-init-file --no-site-file
KNITR="rmarkdown::render('$<', output_format='md_document', output_dir='output/')"
all: output/some-file.tex \
#!/usr/bin/env python3
# set expandtab ts=4 sw=4 ai fileencoding=utf-8
#
# Author: PB
# Maintainer(s): PB
# License: (c) HRDAG 2019, GPL v2 or newer
#
# -----------------------------------------------------------
# archiver/bin/getpix.py
@vm-wylbur
vm-wylbur / noise_noise.ino
Created September 6, 2019 05:33 — forked from StefanPetrick/noise_noise.ino
The complete code for the noise controlled noise.
/*
A FastLED matrix example:
A simplex noise field fully modulated and controlled by itself
written by
Stefan Petrick 2017
Do with it whatever you like and show your results to the FastLED community
https://plus.google.com/communities/109127054924227823508
*/
#include "FastLED.h"
@vm-wylbur
vm-wylbur / git-lfs-fixer.sh
Created July 22, 2021 16:36
fixing git lfs "Encountered 1 file(s) that should have been pointers, but weren't:"
# make sure all work is committed, and then:
git lfs uninstall
git reset --hard
git lfs install
git lfs pull
@vm-wylbur
vm-wylbur / thin-space.R
Created January 1, 2019 02:09
use non-breaking thin space as thousands separator in rmarkdown
myNum <- function(n) {
# use in markdown with variable some_number:
# `r myNum(some_number)` and the thousands separator is a
# nonbreaking thin space, which is ISO 30-1
return(prettyNum(n, big.mark='&thinsp;'))
}