Skip to content

Instantly share code, notes, and snippets.

Lars Vilhuber larsvilhuber

Block or report user

Report or block larsvilhuber

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@larsvilhuber
larsvilhuber / program.R
Created Jan 30, 2020
Conditional handling of (non-distributable) absent data
View program.R
# this project might have some confidential data that cannot be distributed
# Rather than break the program, or worse, ask replicators to comment out lines,
# provide a clean skip of those things, or even an alternate output (robustness check?)
basepath <- c("/path/to/project")
# or :
# basepath <- here::here()
# set filepaths relative to basepath
confidential <- file.path(basepath,"data","confidential")
@larsvilhuber
larsvilhuber / aeagit
Created Jan 27, 2020
bitbucket shortcut for AEA
View aeagit
#!/bin/bash
AEASRC=git@bitbucket.org:aeaverification
call=$0
urlbase=https://aeadataeditors.atlassian.net/browse/AEAREP-
os=$(uname)
codeeditor=$(which code)
function code {
case $os in
Linux)
View hamming.tex
The \emph{Hamming} metric on $\mscr X^n$ is $H: \mscr X^n \times \mscr X^n \rightarrow \ZZ^{\geq 0}$, defined by $H(\ul x,\ul x') =\# \{i \mid x_i\neq x'_i\}$. %In other words, the Hamming distance counts the number of entries that differ between $X$ and $X'$.
@larsvilhuber
larsvilhuber / git_remotes.bash
Created Aug 5, 2019
git setup all remote branches
View git_remotes.bash
#!/bin/bash
# Credit:
# https://stackoverflow.com/questions/67699/how-to-clone-all-remote-branches-in-git
for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do
git branch --track "${branch##*/}" "$branch"
done
View global-libraries.R
####################################
# global libraries used everywhere #
####################################
# Package lock in - optional
MRAN.snapshot <- "2019-01-01"
options(repos = c(CRAN = paste0("https://mran.revolutionanalytics.com/snapshot/",MRAN.snapshot)))
pkgTest <- function(x)
{
if (!require(x,character.only = TRUE))
View Uploading to repositories
figshare: https://github.com/elifesciences/datacapsule-crossref
zenodo: https://developers.zenodo.org/#quickstart-upload
dataverse: https://github.com/IQSS/dataverse-uploader/wiki/DVUploader,-a-Command-line-Bulk-Uploader-for-Dataverse
@larsvilhuber
larsvilhuber / acrodefs.tex
Created Dec 20, 2018
acronyms frequently used by me
View acrodefs.tex
%TCIDATA{Version=5.00.0.2570}
%TCIDATA{LaTeXparent=0,0,sw-edit.tex}
% $Id: acronyms.tex 11537 2014-05-27 03:52:54Z vilhuber $
% $URL: https://trac.vilhuber.org/svn/LEHD/branches/ticket983-snapshot2012/05_documentation/acronyms.tex $
%
% Define acronyms to be used in the text here. See
% http://www.mackichan.com/index.html?techtalk/456.htm~mainFrame for usage in
% Scientific workplace context
@larsvilhuber
larsvilhuber / latex-files.sh
Created Dec 8, 2018
Get all files used by a LaTeX compile
View latex-files.sh
#/bin/sh
# from https://tex.stackexchange.com/questions/24542/create-list-of-all-external-files-used-by-master-latex-document
# use the perl script mkjobtexmf available with every TeX distribution and run it like
latex_file=test
mkjobtexmf --jobname $latex_file --cmd-tex pdflatex
#
#it creates an file <latex file>.fls which shows all used files, e.g. for a testfile named latex6:
#
#PWD /home/voss/Documents
#INPUT /usr/local/texlive/2011/texmf.cnf
@larsvilhuber
larsvilhuber / biblatex-doc.tex
Last active Dec 29, 2018
Default biblatex setup
View biblatex-doc.tex
%!TeX TXS-program:bibliography = txs:///biber
\documentclass{article}
\usepackage{authblk}
\usepackage[%
plainpages,%
colorlinks,% removes the boxes around links
urlcolor=black,%
filecolor=black,%
citecolor=Blue,% requires xcolor with option dvipsnames
pdfpagemode=UseOutlines,%
@larsvilhuber
larsvilhuber / remap_dell.sh
Created Nov 19, 2018
Re-adjust X11 and touch screen when using laptop and touch screen monitor
View remap_dell.sh
#!/bin/bash
# get Wacom IDS
[[ -z $1 ]] && undo= || undo=yes
WACOM_IDS=$(xinput --list | grep "Wacom" | awk -F= '{ print $2 } ' | awk ' { print $1 } ')
# get device
INTERNAL=LVDS1
for arg in $WACOM_IDS
do
xinput --map-to-output $arg $INTERNAL
done
You can’t perform that action at this time.