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 / gcse.ipynb
Last active September 18, 2023 01:29
Working with Google Custom Search Engine using Python
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 / estimate_pi.ipynb
Created March 14, 2019 04:30
A Monte Carlo simulation to estimate the value of π using Python.
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 / gfg_online_compiler.py
Created March 3, 2019 16:31
GeeksforGeeks free, unrestricted online compiler api
import requests
gfg_compiler_api_endpoint = "https://ide.geeksforgeeks.org/main.php"
languages = ['C', 'Cpp', 'Cpp14', 'Java', 'Python', 'Python3', 'Scala', 'Php', 'Perl', 'Csharp']
def gfg_compile(lang, code, _input=None, save=False):
data = {
'lang': lang,
'code': code,
@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.
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 / 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)
@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)