Skip to content

Instantly share code, notes, and snippets.

View nikhilkumarsingh's full-sized avatar
🎯
Focusing

Nikhil Kumar Singh nikhilkumarsingh

🎯
Focusing
View GitHub Profile
import requests
from bs4 import BeautifulSoup
from random import choice
def get_proxy():
url = "https://www.sslproxies.org/"
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html5lib')
return {'https': choice(list(map(lambda x:x[0]+':'+x[1], list(zip(map(lambda x:x.text, soup.findAll('td')[::8]),
@nikhilkumarsingh
nikhilkumarsingh / real_time.ipynb
Created August 19, 2018 20:04
Plotting real time data using Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import requests
from bs4 import BeautifulSoup
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
}
login_data = {
'name': '<username>',
'pass': '<password>',
@nikhilkumarsingh
nikhilkumarsingh / myshell.py
Created May 14, 2018 19:31
A simple Python Interactive Shell
while 1:
x = input(">>> ")
if x == 'exit':
break
try:
y = eval(x)
if y: print(y)
except:
try:
@nikhilkumarsingh
nikhilkumarsingh / call_by_object.ipynb
Created May 14, 2018 17:43
Parameter passing in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nikhilkumarsingh
nikhilkumarsingh / copy.ipynb
Last active May 13, 2018 06:21
copy in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.