# install.packages(c("httr", "jsonlite"))
colorgorical <- function(n = 10) {
post_body <- jsonlite::toJSON(
auto_unbox = TRUE,
list(
'paletteSize' = n,
'weights' = list(
'ciede2000' = 0,
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
// Ported from Stefan Gustavson's java implementation | |
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
// Read Stefan's excellent paper for details on how this code works. | |
// | |
// Sean McCullough banksean@gmail.com | |
/** | |
* You can pass in a random number generator object if you like. | |
* It is assumed to have a random() method. | |
*/ |
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 | |
# Script for automatic setup of SOCKS proxy through SSH connection. | |
# It automatically teardowns SOCKS configuration before stopping. | |
# It's supposed to work on Mac OS X 10.6+ | |
# | |
# Author: Adam Stankiewicz (@sheerun) | |
# | |
[[ -n "$1" ]] || { echo "Usage: proxy [email protected]"; exit 1; } |
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 | |
""" | |
optimize_html.py | |
Kamil Slowikowski | |
November 14, 2016 | |
Optimize base64 encoded PNG images in an HTML file. | |
USAGE | |
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
#' --- | |
#' title: "pngquant demo" | |
#' author: "Kamil Slowikowski" | |
#' date: "`r Sys.Date()`" | |
#' output: | |
#' html_document: | |
#' self_contained: true | |
#' --- | |
#+ setup, include=FALSE |
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 | |
# pdfoptim.sh | |
# | |
# Optimize a PDF with Ghostscript | |
# | |
# Usage: bash pdfoptim.sh FILE.pdf | |
# | |
# This will copy the input file to FILE-original.pdf | |
# And write an optimized file to FILE.pdf | |
# |
The lmtest package provides a Granger Test function:
set.seed(42)
x <- rnorm(10)
y <- rnorm(10)
lmtest::grangertest(x, y, order = 1)
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 | |
""" | |
gallery.py | |
Description: | |
Create an HTML file with a gallery of images in the current folder. | |
Usage: |
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
# Try this with: | |
# - https://github.com/jefworks/genesets | |
# - https://github.com/slowkow/tftargets | |
#' Compute a hypergeometric p-value for your gene set of interest relative to | |
#' a universe of genes that you have defined. | |
#' | |
#' @param ids A vector with genes of interest. | |
#' @param universe A vector with all genes, including the genes of interest. |
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 | |
""" | |
usage_brief.py | |
Kamil Slowikowski | |
August 11, 2016 | |
(Works with Python 2 and 3) | |
# USAGE |