Skip to content

Instantly share code, notes, and snippets.

@kamalbanga
kamalbanga / ctmdata.py
Last active May 12, 2016 09:43
Generate random data for input to CTM algorithm. Run as "python2.7 ctmdata.py".
from random import randint
from random import uniform, gauss
def gaussian(mu, sigma = 0.1):
prob = gauss(mu, sigma)
if prob < 0:
return 0.0
elif prob > 1:
return 1.0
else:
@kamalbanga
kamalbanga / setup.sh
Last active May 17, 2016 12:48
Setup Dataproc
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade gensim
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kamalbanga
kamalbanga / monte_carlo.py
Last active March 1, 2020 17:40
Monte Carlo simulations of some problems; to estimate probabilities
from random import choices, sample
from statistics import mean
def common_birthday(k):
'''Generate k independent uniformly random birthdays & check if there are any repeats'''
birthdays = choices(range(1, 366), k=k)
return len(set(birthdays)) != k
>>> mean(common_birthday(23) for _ in range(10000))
0.4979
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kamalbanga
kamalbanga / privacy.md
Created August 31, 2024 11:49
Drjee Privacy Policy

Privacy Policy

This privacy policy applies to the Drjee app (hereby referred to as "Application") for mobile devices that was created by (hereby referred to as "Service Provider") as a Free service. This service is intended for use "AS IS".

Information Collection and Use

The Application collects information when you download and use it. This information may include information such as

  • Your device's Internet Protocol address (e.g. IP address)
  • The pages of the Application that you visit, the time and date of your visit, the time spent on those pages