View rotating-3d-mp4.R
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(data.table) | |
library(glue) | |
library(rgl) | |
# https://github.com/google/palette.js/blob/master/palette.js | |
mpn65 <- c( | |
'#ff0029', '#377eb8', '#66a61e', '#984ea3', '#00d2d5', '#ff7f00', '#af8d00', | |
'#7f80cd', '#b3e900', '#c42e60', '#a65628', '#f781bf', '#8dd3c7', '#bebada', | |
'#fb8072', '#80b1d3', '#fdb462', '#fccde5', '#bc80bd', '#ffed6f', '#c4eaff', | |
'#cf8c00', '#1b9e77', '#d95f02', '#e7298a', '#e6ab02', '#a6761d', '#0097ff', |
View copy-to-google.sh
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 | |
#$ -N MY_JOB_NAME | |
#$ -o /path/on/broad/server/ | |
#$ -e /path/on/broad/server/ | |
#$ -cwd | |
#$ -j y | |
#$ -l h_rt=12:00:00 | |
#$ -pe smp 8 -R y -binding linear:8 | |
#$ -l h_vmem=2G | |
# |
View plot-umap-experiment.R
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(uwot) | |
library(scattermore) | |
library(foreach) | |
library(doParallel) | |
library(data.table) | |
library(ggplot2) | |
library(scales) | |
library(glue) | |
# This code snippet assumes we have these objects: |
View pay-water-bill.py
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 python3 | |
# pay-water-bill.py | |
# 2021-05-02 | |
""" | |
Pay your water bill in Baltimore City | |
===================================== | |
Steps: |
View montage.py
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 python | |
""" | |
montage.py | |
2020-12-23 | |
Kamil Slowikowski | |
Usage | |
----- | |
Write montage.png from a list of PDF files, each panel 500px wide: |
View rsa-example.R
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 Rscript | |
# rsa-example.R | |
# | |
# Inspired by Alex Van de Sande | |
# https://twitter.com/avsa/status/1318672796415819776 | |
last_digit <- function(x) { | |
x_char <- as.character(x) | |
as.numeric(substr(x_char, nchar(x_char), nchar(x_char))) | |
} |
View income.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View writeMMgz.R
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
#' @param x A sparse matrix from the Matrix package. | |
#' @param file A filename that ends in ".gz". | |
writeMMgz <- function(x, file) { | |
mtype <- "real" | |
if (is(x, "ngCMatrix")) { | |
mtype <- "integer" | |
} | |
writeLines( | |
c( | |
sprintf("%%%%MatrixMarket matrix coordinate %s general", mtype), |
View needleman-wunsch.py
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 python | |
""" | |
The Needleman-Wunsch Algorithm | |
============================== | |
This is a dynamic programming algorithm for finding the optimal alignment of | |
two strings. | |
Example | |
------- |
View read_cellranger.R
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
# install.packages(c("Matrix", "rhdf5", "tidyverse")) | |
library(Matrix) | |
library(rhdf5) | |
library(tidyverse) | |
library(glue) | |
my_h5_files <- Sys.glob( | |
"path/to/cellranger-per-channel/output/*/filtered_feature_bc_matrix.h5" | |
) |
NewerOlder