Skip to content

Instantly share code, notes, and snippets.

View orrymr's full-sized avatar

Orry orrymr

View GitHub Profile
@orrymr
orrymr / gist:1158bd18361b3e1998736a8d221dc5ad
Created March 24, 2021 14:43
minikube start --alsologtostderr
I0324 16:41:21.750172 24757 out.go:239] Setting OutFile to fd 1 ...
I0324 16:41:21.752574 24757 out.go:291] isatty.IsTerminal(1) = true
I0324 16:41:21.752613 24757 out.go:252] Setting ErrFile to fd 2...
I0324 16:41:21.752619 24757 out.go:291] isatty.IsTerminal(2) = true
I0324 16:41:21.752712 24757 root.go:308] Updating PATH: /Users/orrymr/.minikube/bin
I0324 16:41:21.753937 24757 out.go:246] Setting JSON to false
I0324 16:41:21.793920 24757 start.go:108] hostinfo: {"hostname":"Orrys-MacBook-Pro.local","uptime":256360,"bootTime":1616340521,"procs":522,"os":"darwin","platform":"darwin","platformFamily":"Standalone Workstation","platformVersion":"11.0.1","kernelVersion":"20.1.0","kernelArch":"x86_64","virtualizationSystem":"","virtualizationRole":"","hostId":"d8523129-e878-38ba-a8e0-1d0e8d2470b7"}
W0324 16:41:21.794100 24757 start.go:116] gopshost.Virtualization returned error: not implemented yet
I0324 16:41:21.814198 24757 out.go:129] 😄 minikube v1.18.1 on Darwin 11.0.1
😄 minikube v1.18.1 o
@orrymr
orrymr / mean_value.R
Last active September 13, 2021 17:44
mean_value <- sum(seq(1:6) * (1 / 6))
print(mean_value)
# [1] 3.5
@orrymr
orrymr / dice_matrix.R
Last active September 13, 2021 18:17
row1 <- c(2, 3, 4, 5, 6, 7) / 2
row2 <- c(3, 4, 5, 6, 7, 8) / 2
row3 <- c(4, 5, 6, 7, 8, 9) / 2
row4 <- c(5, 6, 7, 8, 9, 10) / 2
row5 <- c(6, 7, 8, 9, 10, 11) / 2
row6 <- c(7, 8, 9, 10, 11, 12) / 2
dice <- matrix(c(row1, row2, row3, row4, row5, row6), nrow = 6, byrow = TRUE)
dice
@orrymr
orrymr / mean.R
Created September 13, 2021 17:54
number_of_rolls <- 1000000 # Or, we could manually roll a die 1 million times. Nah, let's let the computer do it.
mean(sample(1:6, number_of_rolls, replace = TRUE))
# [1] 3.499435
@orrymr
orrymr / roll.R
Created September 13, 2021 17:58
#roll, as in roll di(c)e
# m = number of times
# n = number of dice
roll <- function(m, n){
set.seed(1234)
means <- plyr::ldply(1:m, function(x){
return(mean(sample(1:6, n, replace = TRUE)))
})
}
n_ <- 1
m_ <- 10000
g <- ggplot(roll(m = m_, n = n_),
mapping = aes(x = V1)) +
geom_vline(xintercept = 3.5, colour = "tomato3") +
labs(
subtitle = str_interp('Density of means of dice
rolls for ${n_} dice over ${m_} rolls.'),
x = 'Mean Score',
g <- g +
geom_density()
g
@orrymr
orrymr / dens.R
Created September 13, 2021 18:05
n_ <- 2
m_ <- 10000
g <- ggplot(roll(m = m_, n = n_),
mapping = aes(x = V1)) +
geom_vline(xintercept = 3.5, colour = "tomato3") +
labs(
subtitle = str_interp('Density of means of dice
rolls for ${n_} dice over ${m_} rolls.'),
x = 'Mean Score',
n_ <- 4
m_ <- 10000
g <- ggplot(roll(m = m_, n = n_),
mapping = aes(x = V1)) +
geom_vline(xintercept = 3.5, colour = "tomato3") +
labs(
subtitle = str_interp('Density of means of dice
rolls for ${n_} dice over ${m_} rolls.'),
x = 'Mean Score',
n_ <- 20
m_ <- 10000
g <- ggplot(roll(m = m_, n = n_),
mapping = aes(x = V1)) +
geom_vline(xintercept = 3.5, colour = "tomato3") +
labs(
subtitle = str_interp('Density of means of dice
rolls for ${n_} dice over ${m_} rolls.'),
x = 'Mean Score',