Skip to content

Instantly share code, notes, and snippets.

View Niknafs's full-sized avatar

Noushin Niknafs Niknafs

  • Johns Hopkins University
  • Baltimore, MD
View GitHub Profile
# if get recieve.denyCurrentBranch error try to pull from
# the repository instead of pushing. Alternatively just
# switch to a tmp branch.
# Permanently going back to previous commit
git reset --hard 123abc
# Checkout a previous commit into a separate branch
# without a branch name it will be in a headless state
git checkout -b old-state 123abc
@Niknafs
Niknafs / 0_reuse_code.js
Created July 3, 2014 18:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Niknafs
Niknafs / ggplot-R-combine.md
Last active April 30, 2018 18:29
Combining ggplot and regular [native] R graphics in the same figure

Background

Last week when trying to generate some awsome summary graphic, I came across the painful ordeal of trying to combine ggplot elements with a number of regular R graphic elements.

First things first, I had used grid.arrange module from gridExtra package to juxtapose ggplot elements in a panel figure. Furthermore, I had combined regular R [read non-ggplot] figures thru the good old par functionality.

Brief summary:

We will be making calls to viewport module from the gridBase package to generate---guess what---view ports into which ggplot objects are plotted. Interestingly, ggplot elements need not be a single simple ggplot object, but could be an arrangement of multiple objects bundled together using arrangeGrob module from gridExtra.

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8