Skip to content

Instantly share code, notes, and snippets.

{
"id": "root",
"x": 0,
"y": 0,
"children": [{
"id": "n1",
"labels": [ { "text": "n1" } ],
"width": 10,
"height": 10,
"x": 24,
{
"id": "root",
"children": [{
"id": "n1",
"labels": [ { "text": "n1" } ],
"width": 10,
"height": 10
},{
"id": "n5",
"labels": [ { "text": "n5" } ],
nohup /bin/bash -c 'WORDS=("please help me" "i am so alone" "i am lonely" "pssssst" "hello" "hey, listen."); while [ 1 = 1 ]; do say "${WORDS[$[ $[ RANDOM % ${#WORDS[@]} ]]]}" -v Whisper -r 1.5; sleep 3; done' &
@semerj
semerj / fte_theme.R
Created February 12, 2015 23:32
FiveThirtyEight ggplot2 theme from http://minimaxir.com/2015/02/ggplot-tutorial/
# FiveThirtyEight ggplot2 theme from http://minimaxir.com/2015/02/ggplot-tutorial/
fte_theme <- function() {
# Generate the colors for the chart procedurally with RColorBrewer
palette <- brewer.pal("Greys", n=9)
color.background = palette[2]
color.grid.major = palette[3]
color.axis.text = palette[6]
color.axis.title = palette[7]
color.title = palette[9]
@semerj
semerj / pretty-pie.R
Last active January 3, 2016 10:38
Pretty pie charts using k-means clustering of images in R
# adapted from http://is-r.tumblr.com/post/36660147376/dominant-color-palettes-with-k-means
library(ggplot2)
library(reshape2)
library(EBImage)
imageLoader <- function(lib) {
rd <- readImage(lib)
longImage <- melt(rd)
rgbImage <- reshape(longImage, timevar="Var3", idvar=c("Var1", "Var2"), direction="wide")