Skip to content

Instantly share code, notes, and snippets.

View seekshreyas's full-sized avatar
🐼
\_(*|*)_/

Shreyas seekshreyas

🐼
\_(*|*)_/
  • DocuSign
  • San Francisco, CA
View GitHub Profile
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@seekshreyas
seekshreyas / python-pandas-redshift.py
Last active August 29, 2015 14:06 — forked from elliottcordo/gist:59d3c90b158331fe6ed7
Connecting python to redshift
import sys
import logging
import psycopg2
import pandas as pd
import pandas.io.sql as sqlio
import ConfigParser
import argparse
import statistics
from pandas import pivot_table, crosstab
from datetime import datetime
@seekshreyas
seekshreyas / JS-variation.js
Last active August 29, 2015 14:06
JS-variation.js template for A/B tests
// Experiment Jira Id: WAT-195
// Optimizely Experiment Id: 2767601388
// Experiment Name: "(WAT-195) Bitbucket: homepage messaging + small signupform";
// Experiment URL: https://bitbucket.org
// ------------
// VARIATION:: HEADER 1
// ------------
// Author: Shreyas
// Email: shreyas@atlassian.com
@seekshreyas
seekshreyas / JS-PersistentCookie.js
Last active August 29, 2015 14:05
Create a persistent cookie
var setCookie = function(name, val) {
//reference: http://stackoverflow.com/a/8733385/1887264
var expiration_date = new Date();
var cookie_string = '';
expiration_date.setFullYear(expiration_date.getFullYear() + 1);
// Build the set-cookie string:
cookie_string = name + '=' + val + '; path=/; expires=' + expiration_date.toGMTString();
// Create/update the cookie:
document.cookie = cookie_string;
@seekshreyas
seekshreyas / JS-Comment-Title.js
Created August 25, 2014 19:18
JS-Comment-Title
/*
** Experiment Jira Id: WAT-122
** Experiment Name: "Remove Solo-JIRA trial as an option on the try page";
** Experiment URL: https://extranet.atlassian.com/jira/browse/WAT-122
** ------------
** Author: Shreyas
** Email: shreyas@atlassian.com
*/
/*
** Experiment Jira Id: WAT-122
** Experiment Name: "Remove Solo-JIRA trial as an option on the try page";
** Experiment URL: https://extranet.atlassian.com/jira/browse/WAT-122
** ------------
** Author: Shreyas
** Email: shreyas@atlassian.com
*/
@seekshreyas
seekshreyas / AS-pauseGrowl.scpt
Last active August 29, 2015 14:05 — forked from deviantintegral/Growl Pause and Resume.scpt
AppleScript to pause Growl
(**
* Pause and resume Growl. Use in a launcher like Quicksilver or Alfred to
* pause and resume Growl when the menu bar icon is disabled.
*
* Author: Andrew Berry, deviantintegral@gmail.com
*)
tell application "Growl"
register as application "Growl pause/resume" all notifications {"Growl paused", "Growl resumed"} default notifications {"Growl paused", "Growl resumed"} icon of application "Growl"
if is paused then
resume
@seekshreyas
seekshreyas / ObidroidMDSD3
Last active August 29, 2015 13:57
mds plot for obidroid
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
# -*- mode: ruby -*-
# vi: set ft=ruby :
$master_script = <<SCRIPT
#!/bin/bash
cat > /etc/hosts <<EOF
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
@seekshreyas
seekshreyas / probab
Created November 13, 2013 08:14
Probability problem
var probability = function(a,b, num_games){
if (a === num_games) return 1;
if (b === num_games) return 0;
return 0.5*probability(a+1, b, num_games) + 0.5*probability(a,b+1, num_games)
}