Skip to content

Instantly share code, notes, and snippets.

View nikhilkumarsingh's full-sized avatar
🎯
Focusing

Nikhil Kumar Singh nikhilkumarsingh

🎯
Focusing
View GitHub Profile
@nikhilkumarsingh
nikhilkumarsingh / call_by_object.ipynb
Created May 14, 2018 17:43
Parameter passing in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nikhilkumarsingh
nikhilkumarsingh / google_tts.py
Created April 30, 2017 12:56
Googl text to speech API demo
import requests
API_ENDPOINT = "https://translate.google.com/translate_tts"
headers = {'User-Agent': "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0"}
text = "good morning"
params = {
@nikhilkumarsingh
nikhilkumarsingh / pandas_lazy_io.md
Created September 21, 2018 13:03
Read CSV files in pandas in lazy manner
reader = pd.read_csv(filename, iterator=True)

## to get first n lines
reader.get_chunk(n)

## to get next n lines and so on
reader.get_chunk(n)
@nikhilkumarsingh
nikhilkumarsingh / randomize_dict.py
Created September 22, 2018 11:13
Randomize dictionary in Python
import random
d = {'a':1, 'b':2, 'c':3, 'd':4}
for key,val in zip(d.keys(), random.sample(list(d.values()), k=len(d.values()))):
d[key] = val
print(d)
import time
import psutil
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
fig.show()
i = 0
x, y = [], []
@nikhilkumarsingh
nikhilkumarsingh / Tutorial.ipynb
Last active February 1, 2019 13:54
Nested Loops in List Comprehension
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nikhilkumarsingh
nikhilkumarsingh / pprint.ipynb
Created July 3, 2019 19:27
pprint Tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nikhilkumarsingh
nikhilkumarsingh / app.py
Created March 16, 2017 11:24
Facebook Messenger Bot tutorial series | A basic echo bot | app.py
import os, sys
from flask import Flask, request
from pymessenger import Bot
app = Flask(__name__)
PAGE_ACCESS_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
bot = Bot(PAGE_ACCESS_TOKEN)