Skip to content

Instantly share code, notes, and snippets.

View hyginn's full-sized avatar
💭
:-|

Boris Steipe hyginn

💭
:-|
  • University of Toronto
View GitHub Profile
@hyginn
hyginn / grepSrc.md
Last active April 3, 2019 16:36
Utility to find strings in (source) files
# Author: Boris Steipe (ORCID: 0000-0002-1134-6758)
# License: (c) Author (2019) + MIT
# Date: 2019-04-03

Grep in source files

In a current project, we recently merged in a number of pull requests and I thought they had passed all checks ... but after everything was done, Check produced a warning:

@hyginn
hyginn / makeMD5.md
Last active January 29, 2023 17:39
The making of MD5 files
# Author: Boris Steipe (ORCID: 0000-0002-1134-6758)
# License: (c) Author (2019) + MIT
# Date: 2019-01-17

What are MD5 files good for anyway?

I recently contributed to Siegfried Köstlmeier's qrandom package and overlooked to update the package MD5 file. That got me thinking - these files are actually not mentioned in Writing R Extensions, and they are not mentioned in Hadley Wickham's R Packages either. We find them in the wild - but I did not find an explicit source regarding their format. In fact, there is a puzzled post from 2016 by Matthew Lueder on Stack Overflow "What is the MD5 file in R packages used for? How is it generated?" ... and the sole answer on the page misunderstood the question.

@hyginn
hyginn / qUUID.R
Last active January 15, 2019 16:56
Quantum-random UUIDs in R using the qrandom package
# qUUID.R
#
# Author: Boris Steipe (ORCID: 0000-0002-1134-6758)
# License: (c) Author (2018) + MIT
# Date: 2019-01-14
#
# A utility to generate UUIDS from qrandom::qrandom() quantum random bits.
# ==== intro ===================================================================
@hyginn
hyginn / x2int.R
Last active January 15, 2019 16:56
Full-range, quantum random integers in R from hexadecimals via the qrandom package
# x2int.R
#
# Author: Boris Steipe (ORCID: 0000-0002-1134-6758)
# License: (c) Author (2018) + MIT
# Date: 2019-01-14
#
# A utility to use qrandom::qrandom() to get integers from the full range
# of machine representable integers
# ==== intro ===================================================================
@hyginn
hyginn / grepPackage.R
Created January 1, 2019 03:27
`grepPackage.R` - when I develop packages, I often need to look for code in a variety of files, only to realize I missed one of them after I push to GitHub. This tool helps. It searches through the package directories and files and reports if a regex pattern was found in a file, and where.
# grepPackage.R
# Author: Boris Steipe (ORCID: 0000-0002-1134-6758)
# License: (c) Author (2018) + MIT
# Date: 2018-12-31
#
# This R-script grep()s a pattern in all relevant files of an RStudio
# project/package. For expected directories and files, see:
# https://cran.r-project.org/doc/manuals/r-release/R-exts.html
#
# Issues:
@hyginn
hyginn / checkLinks.R
Last active August 20, 2021 12:10
R script to check an HTML document for broken links. Save, source and try the example at the bottom.