Skip to content

Instantly share code, notes, and snippets.

View shantanuo's full-sized avatar

Shantanu Oak shantanuo

  • oksoft
  • mumbai
View GitHub Profile
# -*- coding: utf-8 -*-
"""
Sample report generation script from pbpython.com
This program takes an input Excel file, reads it and turns it into a
pivot table.
The output is saved in multiple tabs in a new Excel file.
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""
Sample report generation script from pbpython.com
This program takes an input Excel file, reads it and turns it into a
pivot table.
The output is saved in multiple tabs in a new Excel file.
"""
# -*- coding: utf-8 -*-
"""
Sample report generation script from pbpython.com
This program takes an input Excel file, reads it and turns it into a
pivot table.
The output is saved in multiple tabs in a new Excel file.
"""
from SimpleCV import Image, Color, Display
# Make a function that does a half and half image.
def halfsies(left,right):
result = left
# crop the right image to be just the right side.
crop = right.crop(right.width/2.0,0,right.width/2.0,right.height)
# now paste the crop on the left image.
result = result.blit(crop,(left.width/2,0))
# return the results.
from itertools import izip
import re
output_file = 'dataset.csv'
input_files = {
'train/X_train.txt': 'train/y_train.txt',
'test/X_test.txt': 'test/y_test.txt'
}
def getOutputLines(filenames):
@shantanuo
shantanuo / README.md
Last active August 29, 2015 14:24 — forked from grantland/README.md
@shantanuo
shantanuo / gist:bb4ff2d7af929df431bc
Last active September 3, 2015 12:27 — forked from iMilnb/gist:ba7b46dfc854544bf3c8
Dynamic ipsec and racoon configuration generation for AWS EC2 VPN using boto3 and Jinja2
#!/usr/bin/env python
# $ cat ipsec_conf.tmpl
# {#
#
# cgw_in_addr: customer_gateway tunnel_inside_address ip_address
# cgw_in_cidr: customer_gateway tunnel_inside_address network_cidr
# vgw_in_addr: vpn_gateway tunnel_inside_address ip_address
# vgw_in_cidr: vpn_gateway tunnel_inside_address network_cidr
# cgw_out_addr: customer_gateway tunnel_outside_address
@shantanuo
shantanuo / s3etag.sh
Created November 22, 2015 14:26 — forked from emersonf/s3etag.sh
A Bash script to compute ETag values for S3 multipart uploads on OS X.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then
@shantanuo
shantanuo / gist:44836d5b9a476ef3608a
Created November 30, 2015 11:34 — forked from markbirbeck/gist:1684494
[ElasticSearch] Insert 5 records and query for a single record, with facets: Successfully returns a count of 1 in the facets
# Create an index:
#
curl -XDELETE 'http://127.0.0.1:9200/articles'
curl -XPUT 'http://127.0.0.1:9200/articles'
# Insert the action mapping, as a child of articles:
#
curl -XPUT 'http://127.0.0.1:9200/articles/article/_mapping' -d '
{
"article": {