Skip to content

Instantly share code, notes, and snippets.

Shantanu Oak shantanuo

Block or report user

Report or block shantanuo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
clf = Pipeline([("dct", DictVectorizer()), ("svc", LinearSVC())])
params = {
"svc__C": [1e15, 1e13, 1e11, 1e9, 1e7, 1e5, 1e3, 1e1, 1e-1, 1e-3, 1e-5]
gs = GridSearchCV(clf, params, cv=10, verbose=2, n_jobs=-1), y)
model = gs.best_estimator_
shantanuo /
Created Sep 6, 2019
link extractor project script
# downlaod links from dynamoDB
!aws dynamodb scan --table-name Movies --query "Items[*].[id.S,title.S]" --output json | sort -u > /tmp/download.txt
# copy github links and extract repo URLs
import pandas as pd
mylist = """
shantanuo /
Created Sep 2, 2019
file to download 2 files at the same time
import multiprocessing
import os
import requests
class MultiProcDownloader(object):
def __init__(self, urls):
self.urls = urls
def run(self):
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import label_ranking_average_precision_score
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from keras.utils import to_categorical
df = pd.read_json("../data/news_category_dataset.json", lines=True)
shantanuo / post_response
Created Jul 30, 2019
api gateway test response
View post_response
Response Headers
Execution log for request afd9f3f2-b28d-11e9-bb2a-4bb7e1da2e13
Tue Jul 30 05:48:42 UTC 2019 : Starting execution for request: afd9f3f2-b28d-11e9-bb2a-4bb7e1da2e13
Tue Jul 30 05:48:42 UTC 2019 : HTTP Method: POST, Resource Path: /
shantanuo / mongo-ls.js
Created Apr 24, 2019 — forked from matteofigus/mongo-ls.js
A script to list all the collections and document count for a specific mongodb db
View mongo-ls.js
// Usage: mongo {Server without mongodb:// example}/{DbName} [-u {Username}] [-p {Password}] < ./mongo-ls.js
var collections = db.getCollectionNames();
print('Collections inside the db:');
for(var i = 0; i < collections.length; i++){
var name = collections[i];
if(name.substr(0, 6) != 'system')
print(name + ' - ' + db[name].count() + ' records');
shantanuo /
Created Apr 1, 2019
tensorflow toxic comment kaggle competition python code
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image:
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import tensorflow as tf
from tensorflow.contrib.keras.api.keras.losses import binary_crossentropy
from collections import Counter
shantanuo / npm.log
Created Mar 14, 2019
npm start output
View npm.log
# output of npm start command...
# npm start
> amplify-js-app@1.0.0 start /amplify-js-app
> webpack && webpack-dev-server --mode development
Hash: 7ae7e983cf728aac0aca
Version: webpack 4.29.6
Time: 107ms
Built at: 03/14/2019 7:52:13 AM
shantanuo /
Last active Feb 18, 2019
Get billing details of last 40 days using boto
import boto3
import datetime
import pandas as pd
import numpy as np
now = datetime.datetime.utcnow()
start = (now - datetime.timedelta(days=40)).strftime("%Y-%m-%d")
end = now.strftime("%Y-%m-%d")
cd = boto3.client("ce",
import pandas as pd
import numpy as np
import re
import tensorflow_hub as hub
import tensorflow as tf
import keras
from tensorflow.python.keras.layers import Input, Dense, Lambda
You can’t perform that action at this time.