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 / mywc.py
Created September 10, 2017 06:23
Wordcloud of wikipedia articles
from os import path
import numpy as np
from PIL import Image
import wikipedia
from wordcloud import WordCloud, STOPWORDS
# get path to script's directory
currdir = path.dirname(__file__)
def get_wiki(query):
@nikhilkumarsingh
nikhilkumarsingh / android_cam.py
Created October 30, 2017 08:26
Processing a live video stream from android phone to PC using Python.
import requests
import cv2
import numpy as np
url = "http://192.168.43.1:8080/shot.jpg"
while True:
img_resp = requests.get(url)
import requests
url = input("Enter the URL: ")
r = requests.get(url)
print("{} redirections took place.".format(len(r.history)-1))
print("Following redirections took place:")
import requests
url = "http://suggestqueries.google.com/complete/search"
params = {
"client": "firefox",
"q": "ind",
"hl": "en"
}
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 / select_files.py
Created May 3, 2018 14:26
Example to select files using File Explorer Dialog Box in Python
from PyQt5.QtWidgets import QFileDialog, QApplication
from PyQt5 import QtWidgets
def select_files(directory_location=None):
qtapp = QApplication([directory_location])
qtwgt = QtWidgets.QWidget()
filenames, _ = QFileDialog.getOpenFileNames(qtwgt)
return filenames
@nikhilkumarsingh
nikhilkumarsingh / select_file_tk.py
Created May 3, 2018 15:43
select files using Tkinter
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
print(file_path)
@nikhilkumarsingh
nikhilkumarsingh / copy.ipynb
Last active May 13, 2018 06:21
copy in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.