Skip to content

Instantly share code, notes, and snippets.

View google_sheets_histogram_binning.gs
function histogram(data, bins=5) {
const min = Math.min(...data)
const max = Math.max(...data)
const size = Math.ceil((max-min)/bins)
var histogram = new Array(bins).fill(0);
for (const item of data) {
@emorisse
emorisse / gganimate.savegif.R
Last active Sep 6, 2018
Create an ggplot animation with gganimate, and save it to a gif file. Set hight and width of image. Don't loop the gif animation.
View gganimate.savegif.R
p <- ggplot(tset2, aes(x=weekweek, y=count, group = term)) +
geom_line() +
geom_segment(aes(xend = max(tset$weekweek), yend = count), linetype=2) +
geom_point() +
geom_text(aes(x = max(tset$weekweek)+1, label = term)) +
scale_x_datetime() +
scale_y_continuous(labels=comma) +
transition_reveal(term, weekweek) +
ease_aes('linear') +
theme_tufte(base_family="Overpass")
View ARIMAtestForElephant.R
search <- read.csv("latest.search.csv", stringsAsFactors = FALSE)
openstack.month <- "2009-09"
search <- search[which(search$Month == openstack.month):nrow(search),]
search$austin <- 0
austin.month <- which(search$Month == "2016-04")
search[austin.month:nrow(search),]$austin <- 1
# test for stationary data
library(tseries)
@emorisse
emorisse / outlineGroupsOfCells.gs
Created Mar 15, 2018
Outline borders of groups of cells in google sheets.
View outlineGroupsOfCells.gs
function onOpen() {
var menu = [{name: "Borders for nonempty cells", functionName: "borders"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("Custom", menu);
}
function borders() {
var range = SpreadsheetApp.getActiveSheet().getRange("C2:O20");
range.setBorder(false, false, false, false, false, false);
var values = range.getValues();
var borders = range.getValues();
View NYC Recommendations.md

West Village

  • Gottino wine bar
  • Bluestone Lane cafe for breakfast and coffee
  • Woogies for wings and cheese steaks
  • walk the highline - park along old railroad tracks. Beautiful day or night.
  • Employees only cocktail bar
  • Big Gay Ice cream

Chelsea

  • Chelsea market for food
View CountdownFunction.sh
# Source: http://serverfault.com/a/532600
Floor ()
{
DIVIDEND=${1};
DIVISOR=${2};
RESULT=$(( ( ${DIVIDEND} - ( ${DIVIDEND} % ${DIVISOR}) )/${DIVISOR} ));
echo ${RESULT}
}
Timecount ()
{
@emorisse
emorisse / rsyslogHistogram.elasticsearch
Created Feb 2, 2016
Aggregated histogram with filters for elasticsearch
View rsyslogHistogram.elasticsearch
{
"aggs" : {
"messages" : {
"filters" : {
"filters" : {
"192.168.0.3" : { "term" : { "rsyslog.fromhost-ip" : "192.168.0.3" }},
"192.168.0.4" : { "term" : { "rsyslog.fromhost-ip" : "192.168.0.4" }},
"192.168.0.5" : { "term" : { "rsyslog.fromhost-ip" : "192.168.0.5" }},
"192.168.0.6" : { "term" : { "rsyslog.fromhost-ip" : "192.168.0.6" }},
"192.168.0.7" : { "term" : { "rsyslog.fromhost-ip" : "192.168.0.7" }},
View ProblemsInDataAnonymity.md