Skip to content

Instantly share code, notes, and snippets.

View taylorreiter's full-sized avatar

Taylor Reiter taylorreiter

View GitHub Profile
@taylorreiter
taylorreiter / vim-cheat-sheet.md
Created July 26, 2023 21:50
vim-cheat-sheet.md

Vim Cheat Sheet

Insert vs. command mode

  • i: insert mode
  • o: insert mode, but one line below
  • esc: exit insert mode and return to command mode

Navigation

library(dplyr)
library(readr)
library(metacoder)
# read in gdtb rs207 lineage/taxonomy information and format
# csv available here: https://osf.io/p6z3w/
gtdb_lineages <- read_csv("gtdb-rs207.taxonomy.csv.gz") %>% # read in gtdb rs207 lineage information
mutate(full_lineage = paste(sep = ";", superkingdom, phylum, class, order, family, genus, species)) %>% # format lineage into single string
select(ident, full_lineage) # keep columns that will be used by metacoder
@taylorreiter
taylorreiter / summit_commands.md
Last active April 14, 2022 20:55
commands useful for operating on the summit hpc

Login (requires password and duo authentication)

ssh -l <your-xsede-username> login.xsede.org
gsissh rmacc-summit
# OR to get a specific login node
gsissh login12.colorado.xsede.org

Check disk usage

@taylorreiter
taylorreiter / parse_carpentries_past_wokrshop_json.R
Last active November 10, 2020 15:40
Parse the carpenties workshop information into an R dataframe
library(jsonlite)
library(dplyr)
carpentries_json <- read_json("https://feeds.carpentries.org/dc_past_workshops.json")
carpentries_df <- do.call(rbind, lapply(carpentries_json, rbind))
carpentries_df <- carpentries_df %>%
as.data.frame() %>%
mutate_all(as.character)
################################################################################
## Intro to plotting with ggplot2: other goodies 2020-02-20
################################################################################
# Getting started ---------------------------------------------------------
# First let's download a data set called "portal_data_joined.csv"
# We'll put it in our data folder inside of our project directory.
# If you don't already have a data directory, you can create one in
@taylorreiter
taylorreiter / rmarkdown_formatting.txt
Last active February 4, 2020 00:21
contains rmarkdown formatting strings that I use all the time and always forget.
Create a horizontal scroll bar for code chunks in an html doc:
```{css, echo=FALSE}
pre, code {white-space:pre !important; overflow-x:auto}
```
Change the width of a markdown figure:
![](figures/dag_quant.png){ width=30% }
#! /usr/bin/env python
import sourmash
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-k", "--ksize", type=int, default=51)
knitr::purl(input = "/path/to/file.Rmd", "/path/to/output_script.R", documentation = 0)

Sum over a column in a csv:

cat file.csv| cut -d "," -f 2 | paste -sd+ - | bc

Pretty view a csv in less:

cat file.csv | column -t -s, | less -S
git checkout -b tr_sourmash_2019 origin/tr_sourmash_2019 --track