Skip to content

Instantly share code, notes, and snippets.

View rohanjoseph93's full-sized avatar

Rohan Joseph rohanjoseph93

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rohanjoseph93
rohanjoseph93 / mediumStoriesStats.js
Last active July 31, 2018 15:09 — forked from epintos/mediumStoriesStats.js
Export Medium Stats Stores to CSV
// Run Inspector Console in chrome and copy and paste the following code in the /stats/stories view
function download(filename, text) {
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
pom.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rohanjoseph93
rohanjoseph93 / CLT1.ipynb
Created September 3, 2018 22:44
CLT1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from wand.image import Image
from wand.display import display
%matplotlib notebook
# 1000 simulations of die roll
n = 1000
# In each simulation, there is one trial more than the previous simulation
avg = []
for i in range(1,n):
a = np.random.randint(1,7,10)
avg.append(np.average(a))
# sample 10 expected value of die rolls
# Function that will plot the histogram, where current is the latest figure
def clt(current):
# if animation is at the last frame, stop it
plt.cla()
if current == 1000:
a.event_source.stop()
plt.hist(avg[0:current])
plt.gca().set_title('Expected value of die rolls')
# Function that will plot the histogram, where current is the latest figure
def clt(current):
# if animation is at the last frame, stop it
plt.cla()
if current == 1000:
a.event_source.stop()
plt.hist(avg[0:current])
plt.gca().set_title('Expected value of die rolls')
a.save('C:/Users/rohan/Documents/clt2.gif', writer='imagemagick', fps=10)