This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# interactive heatmap : | |
install.packages("heatmaply") | |
library(heatmaply) | |
a<- | |
heatmaply(mtcars, k_col = 2, k_row = 3) %>% layout(margin = list(l = 130, b = 40)) | |
dev.off () | |
# mtcars | |
# x <- heatmapr(mtcars) | |
library(heatmaply) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show colour palettes (RColorBrewer palettes) | |
library(tmaptools) | |
palette_explorer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from here: https://www.r-statistics.com/2013/03/updating-r-from-r-on-windows-using-the-installr-package/ | |
rm(list=ls()) | |
if(!require(installr)) { | |
install.packages("installr"); require(installr)} #load / install+load installr | |
updateR() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from here: https://stackoverflow.com/questions/16260752/using-for-loop-to-get-the-hamming-distance-between-2-strings | |
public class Hamming | |
{ | |
private String compOne; | |
private String compTwo; | |
public Hamming(String one, String two) | |
{ | |
compOne = one; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# BASH function to get the result | |
# of a ^ b when a, b are in the | |
# following hexadecimal string | |
# form: AF396463D8705 ... | |
# Obtained from here: | |
# http://www.codeproject.com/Tips/470308/XOR-Hex-Strings-in-Linux-Shell-Script | |
# Author is Sanjay1982 (see http://www.codeproject.com/Members/Sanjay1982) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvg) | |
library(ggplot2) | |
library(officer) | |
doc <- read_pptx() | |
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") | |
doc <- ph_with_vg(doc, code = barplot(1:10), type = "body") | |
print(doc, target = "my_plot.pptx") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from: https://stackoverflow.com/questions/4090169/elegant-way-to-check-for-missing-packages-and-install-them | |
# This checks for missing packages and installs them. You will need to load them manually | |
list.of.packages <- c("ggplot2", "magrittr") | |
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] | |
if(length(new.packages)) install.packages(new.packages) | |
# library(ggplot2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# usage for a table called filename.txt: transpose.sh filename | |
# from here: https://stackoverflow.com/questions/1729824/an-efficient-way-to-transpose-a-file-in-bash | |
transpose () { | |
awk ' | |
{ | |
for (i=1; i<=NF; i++) { | |
a[NR,i] = $i | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Option 1, from here: https://spin.atomicobject.com/2016/05/28/log-bash-history/ | |
# more history settings, date wise, infinite | |
export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi' | |
Add to ~/.bashrc, Make the ~/.logs folder, and you are set forever | |
Then, you can do a grep 'whatever script or data name' ~/.logs/* | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git clone --depth 1 https://github.com/PhysiBoSS/PhysiBoSS.git && cloc PhysiBoSS && rm -rf PhysiBoSS |
NewerOlder