Skip to content

Instantly share code, notes, and snippets.

View salilpa's full-sized avatar

Salil Panikkaveettil salilpa

View GitHub Profile
@salilpa
salilpa / bayesian_ab_test.py
Last active May 18, 2017 07:50
Simple formula to find Bayesian A/B test confidence
import math
def calc_ab(conversion_a, interaction_a, conversion_b, interaction_b):
# more generic function which takes conversions and interactions. Calculates failures internally
# total is the confidence that b is doing better than a
alpha_a = conversion_a + 1
alpha_b = conversion_b + 1
beta_a = interaction_a - conversion_a + 1
beta_b = interaction_b - conversion_b + 1
total = 0.0
Please read these Terms and Conditions ("Terms", "Terms and Conditions") carefully before using the https://www.adnabu.com website (the "Service") operated by Nabu Marketing Private Limited ("us", "we", or "our").
Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms. These Terms apply to all visitors, users and others who access or use the Service.
By accessing or using the Service you agree to be bound by these Terms. If you disagree with any part of the terms then you may not access the Service.
Accounts
When you create an account with us, you must provide us information that is accurate, complete, and current at all times. Failure to do so constitutes a breach of the Terms, which may result in immediate termination of your account on our Service.
@salilpa
salilpa / AdNabu Privacy Policy
Last active January 1, 2024 03:26
Open source privacy policy for Startups
Nabu Marketing Private Limited ("us", "we", or "our") operates the https://www.adnabu.com website (the "Service").
This page informs you of our policies regarding the collection, use and disclosure of Personal Information when you use our Service.
We will not use or share your information with anyone except as described in this Privacy Policy.
We use your Personal Information for providing and improving the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, accessible at https://www.adnabu.com
Information Collection And Use
@salilpa
salilpa / django-ajax-selects.md
Last active August 29, 2015 14:15
django-ajax-selects JS and CSS files are not loaded

For some reason the required css and js files were not loaded for the default installation.

This is how i solved it.

  1. add jquery ui jss and css files
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
@salilpa
salilpa / style.css
Created July 11, 2014 06:04
Bootstrap styling for jQuery UI autocomplete. CSS minified version
.ui-autocomplete{position:absolute;top:100%;left:0;z-index:1000;float:left;display:none;min-width:160px;_width:160px;padding:4px 0;margin:2px 0 0 0;list-style:none;background-color:#ffffff;border-color:#ccc;border-color:rgba(0, 0, 0, 0.2);border-style:solid;border-width:1px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;*border-right-width:2px;*border-bottom-width:2px}.ui-autocomplete .ui-menu-item > a.ui-corner-all{display:block;padding:3px 15px;clear:both;font-weight:normal;line-height:18px;color:#555555;white-space:nowrap}.ui-autocomplete .ui-menu-item > a.ui-corner-all.ui-state-hover,.ui-autocomplete .ui-menu-item > a.ui-corner-all.ui-state-active{color:#ffffff;text-decoration:none;background-color:#0088cc;border-radius:0px;-webkit-border-radius:0px;-moz-border
@salilpa
salilpa / style.css
Created July 11, 2014 06:03
Bootstrap styling for jQuery UI autocomplete. CSS expanded version
.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@salilpa
salilpa / style.scss
Created July 11, 2014 06:01 — forked from daz/style.scss
.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@salilpa
salilpa / pymongoBackup.py
Created October 23, 2013 17:21
How to backup a collection using pymongo. Read the documents using pymongo's find and filter the result using limitimg_query Insert all the matched documents by converting the cursor to a list
from pymongo import MongoClient
from datetime import datetime
target_client = MongoClient('localhost', 12345)
from_db = target_client['existing_db']
from_col = 'collection'
to_db = target_client['backup_db']
to_col = 'backup'
def createBackup(from_db, from_col, to_db, to_col, limiting_query=None):
back_up_cursor = from_db[from_col].find(limiting_query)
@salilpa
salilpa / fixMongoTime.py
Created October 7, 2013 08:02
Sample Python script to convert a property in MongoDB from text to date type using pymongo. This script finds all documents which has to be changed and changes it one by one using the id attribute. more info at http://salilpa.com/home/content/how-convert-property-mongodb-text-date-type-using-pymongo
from pymongo import MongoClient
from datetime import datetime
def fixTime(host, port, database, collection, attr, date_format):
#host is where the mongodb is hosted eg: "localhost"
#port is the mongodb port eg: 27017
#database is the name of database eg : "test"
#collection is the name of collection eg : "test_collection"
#attr is the column name which needs to be modified
#date_format is the format of the string eg : "%Y-%m-%d %H:%M:%S.%f"