This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
capture confirm file file.txt | |
if _rc == 0 { | |
<code if file exists> | |
} | |
else { | |
<code if the file does not exist> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSH_ENV="$HOME/.ssh/agent-environment" | |
function start_agent { | |
echo "Initialising new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null | |
/usr/bin/ssh-add $HOME/.ssh/id_lars2016_rsa; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://api.zotero.org/groups/(GROUP-ID)/items?format=bibtex&limit=150 | |
where (GROUP-ID) is the numeric identifier associated with your group library. | |
This will download a BIB file. Other formats, see the Zotero API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is needed by the main.yml | |
# Goes into ${ROOT}/bin | |
DOCS="main" | |
DEST="docs" | |
[[ -d $DEST ]] || mkdir $DEST | |
# xelatex does not work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R version 3.6.3 (2020-02-29) -- "Holding the Windsock" | |
Copyright (C) 2020 The R Foundation for Statistical Computing | |
Platform: x86_64-w64-mingw32/x64 (64-bit) | |
R est un logiciel libre livré sans AUCUNE GARANTIE. | |
Vous pouvez le redistribuer sous certaines conditions. | |
Tapez 'license()' ou 'licence()' pour plus de détails. | |
R est un projet collaboratif avec de nombreux contributeurs. | |
Tapez 'contributors()' pour plus d'information et |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'$. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################### | |
# 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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |