Skip to content

Instantly share code, notes, and snippets.

View aaronsaunders's full-sized avatar

Aaron Marc Saunders aaronsaunders

View GitHub Profile
@agarman
agarman / org-mode-cheat-sheet.org
Last active September 15, 2017 09:10
A cheat sheet for org-mode (gist incorrectly renders as markdown, view/print raw)

Headlines

Visibility cycling

TAB
Cycle subtree folded -> children -> subtree
S-TAB, C-u TAB
Cycle buffer
C-u C-u C-u TAB
Expand all
#+STARTUP: `overview`|`content`|`showall`
Startup options

Motion

C-c C-n
Next heading
@aaronsaunders
aaronsaunders / nix-cheat.sh
Last active January 25, 2021 06:54
Quick reference for nix command line commands that I can never remember...
# Unix shell
# run if zero exit
cd tmp/a/b/c && tar xvf ~/archive.tar # untar if dir exists
# run if non-zero exit
cd tmp/a/b/c || mkdir -p tmp/a/b/c
cd tmp/a/b/c || mkdir -p tmp/a/b/c && tar xvf -C tmp/a/b/c ~/archive.tar
which
whereis
@aaronsaunders
aaronsaunders / Manipulating_data
Created August 8, 2013 10:45
Manipulating data
with()
within()
round(x, n) # rounds x to n decimal places
ceiling(x) # vector x of smallest integers > x
floor(x) # vector x of largest interger < x
as.integer(x) # truncates real x to integers (compare to round(x, 0)
as.integer(x < cutpoint) # vector x of 0 if less than cutpoint, 1 if greater than cutpoint)
@aaronsaunders
aaronsaunders / ggplot_help.R
Created August 5, 2013 18:41
ggplot tricks
# ggplot2 implements the idea of a "grammar of graphics". The grammar implemented
# by ggplot2 could be summarized as follows:
#
# plot: coord, scale, facet(?) + layers
# layer: data mapping stat geom position?
#
# A plot is defined by a coordinate system (coord), one or more scales (scale), an
# optional faceting specification (facet), and one or more layers (layer). A layer
# is defined as an R data frame (data), a specification mapping columns of that
# frame into aesthetic properties (mapping), a statistical approach to summarize

Very Bad Things

Originally, I named this document "very bad things" because it does some stuff that proper folks should not do, like mixing bash and python and leaving filehandles unclosed. It's about a function I wrote to get sh*t done.

I've been doing bioinformatics for about 10 years now. I used to joke with a friend of mine that most of our work was converting between file formats. We don't joke about that anymore.