Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
Catching Up

Zhian N. Kamvar zkamvar

🐌
Catching Up
View GitHub Profile
@zkamvar
zkamvar / renv.lock
Created Dec 15, 2021
renv.lock file from failing repo
View renv.lock
{
"R": {
"Version": "4.1.0",
"Repositories": [
{
"Name": "carpentries",
"URL": "https://carpentries.r-universe.dev"
},
{
"Name": "carpentries_archive",
View keybase.md

Keybase proof

I hereby claim:

  • I am zkamvar on github.
  • I am zkamvar (https://keybase.io/zkamvar) on keybase.
  • I have a public key ASDqVco4Xm3D5M11ckLrYgE9XyqlHFxA7MwqWszJxWvmSAo

To claim this, I am signing this object:

@zkamvar
zkamvar / subLoc.R
Last active Apr 10, 2021
Function for subsetting loci in a genind object by name
View subLoc.R
#' Subset loci in a genind object by name
#'
#' @param dat a genind object
#' @param ... names of the loci in character format OR numeric indices of the loci.
#'
#' @return the appropriate names to use for subsetting in a genind object
#' @examples
#' library(adegenet)
#' data(nancycats)
#' # Old way:
@zkamvar
zkamvar / README.md
Last active Aug 18, 2020
pandoc markdown_github with section-divs booboo
View README.md

This compares the differences between pandoc's markdown and markdown_github engines when parsing <div> tags within sections.

Problem

In essence, if a <div> tag contains a header out of order with the main document, its contents will be appended to the div in the html document with markdown_github. If the following div appears after a level 3 header:

<div class='boo'>

## level 2
View tink.R
# test file
sample_chunk <- "
```{r hello, testing=as.logical(1), another=1 + 1}
x <- 1 + 1 # this evaluates to two
```
the value of x is `r x`"
file = "sample.Rmd"
writeLines(sample_chunk, con = file)
# delete temp Rmd file
on.exit(unlink(file))
@zkamvar
zkamvar / Makefile
Last active Mar 18, 2020
Example SLURM script that records memory, time, and job id
View Makefile
FILES := file1.out \
file2.out \
file3.out \
file4.out \
file5.out \
file6.out \
file7.out \
file8.out \
file9.out
@zkamvar
zkamvar / Makevars
Created Jul 14, 2015
My R Makevars file to ensure that I build R packages with openmp
View Makevars
# This file's location is ~/.R/Makevars
# Default variables (no omp support):
# CXX=clang++
# CC=clang
# I followed the instructions at http://hpc.sourceforge.net/ to install gcc 4.9
CC=/usr/local/bin/gcc
CXX=/usr/local/bin/g++
FC=/usr/local/bin/gfortran
F77=/usr/local/bin/gfortran
View inkscape_pdf_font.pl
#!/usr/bin/perl
#
# This script was created because I had a problem with inkscape not recognizing
# fonts generated by R's pdf generator. This will go through and make these fonts
# scaleable.
#
# Workflow: Generate PDF > open in inkscape > save as svg > run this script
#
# Usage: perl -i inkscape_pdf_font.pl <my_file.svg>
#
@zkamvar
zkamvar / git_prompt.sh
Last active Jun 17, 2019
Command prompt functions to go in .bashrc or .bash_profile that will color the command line if there is a git repository.
View git_prompt.sh
#
#
#
#
#
#
#
#
# THIS IS NOW LOCATED AT https://raw.githubusercontent.com/zkamvar/config-files/master/.bash_prompt
#
@zkamvar
zkamvar / render-demo.R
Last active Aug 23, 2018
Render an R demo
View render-demo.R
#!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = TRUE)
if (length(args) != 2) {
msg <- "
usage:
render-demo.R <demo> <package>
This utility will render the code and figures from a given package as a PDF
and place them into a directory called `<demo>-generated_files`. This requires
knitr, rmarkdown and LaTeX to be installed on your system.