Skip to content

Instantly share code, notes, and snippets.

View mohit2152sharma's full-sized avatar
🏠
Working from home

Mohit Sharma mohit2152sharma

🏠
Working from home
View GitHub Profile
@mohit2152sharma
mohit2152sharma / redis-cluster-local
Created January 18, 2024 06:10
Running Redis Cluster on macos locally
#!/bin/sh
# when installing redis from brew, it doesn't come with `utils` folder
# and because of which it's rather difficult to run redis cluster locally
# (`utils` folder has `create-cluster` script files, which automate the creation
# startup, stopping of redis cluster)
# this script is a workaround for that, basically, it checks if `utils` folder is
# there or not, if not, it downloads it and makes the necessary changes
# it assumes, you are running this on macos, with zsh shell
@mohit2152sharma
mohit2152sharma / anscombe_quartet.md
Last active September 6, 2020 11:40
anscombe quartet plotting and summarizing
library(ggplot2)
library(patchwork)
library(tidyr)
library(magrittr)
library(dplyr)

datasets::anscombe
#>    x1 x2 x3 x4    y1   y2    y3    y4
#> 1  10 10 10  8  8.04 9.14  7.46  6.58
population = rnorm(1000, mean = 10, sd = 1)

samples = replicate(100, sample(population, size = 10))

ext.confid.interval = function(s, mu){
confid.intervals = apply(s, 2, t.test, mu = mu)
n.samples = dim(s)[2]
lower.bound = vapply(confid.intervals, function(x) x$conf.int[1], FUN.VALUE = 100)
upper.bound = vapply(confid.intervals, function(x) x$conf.int[2], FUN.VALUE = 100)