Skip to content

Instantly share code, notes, and snippets.

@thetongs
thetongs / segregator.py
Created June 20, 2020 13:10
Digital and Non-Digital PDF segregator using Python.
import PyPDF2
import os
def digital_nondigital_checker(files):
pdf_reader = PyPDF2.PdfFileReader(path + str(files), 'rb')
total_pages = pdf_reader.getNumPages()
print("Number of pages in pdf : {}".format(total_pages))
curr_page = 0
page_type_flag = False
while total_pages:
@thetongs
thetongs / language_identifier.py
Created June 21, 2020 11:40
Identify the language of documents.
# -----------------------------------------------------------------------------
# Import libraries
import nltk
from nltk.tokenize import wordpunct_tokenize
from nltk.corpus import stopwords
nltk.download('stopwords')
import PyPDF2
import os
path = "Input/"
import email
@thetongs
thetongs / wifi_password.py
Last active January 6, 2022 23:56
Simple program to show all WIFI connected and passwords of connected WIFI.
## Command
# use c to run process one by one
# use k to run one command only
import os
## Show all wifi connected before
#
os.system('cmd /c "netsh wlan show profile"')
@thetongs
thetongs / word_cloud.py
Created December 2, 2020 09:50
Visualize keywords in cool format.
'''
Word Cloud:
- It is data visualization technique used for representing text data in
which the size of each word indicates its frequency or importance.
- Significant textual data points can be highlighted using a Word Cloud.
Installation:
- pip install wordcloud
'''
@thetongs
thetongs / screenshot.py
Created December 2, 2020 09:52
Take full screen screenshot with timer and using command line argument save file.
## Take screenshot
# pip install PyAutoGUI
import pyautogui
import sys
import time
print("Minimize all other screen in 4 sec.")
n = len(sys.argv)
@thetongs
thetongs / text_to_speech.py
Created December 2, 2020 09:53
Simplest way to transform text into speech.
import pyttsx3
engine = pyttsx3.init()
engine.say("Chandu ki chachi ne chadu ke papako chatani chatayi.")
engine.runAndWait()
import socket
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
print("Hostname : {}".format(hostname))
print("IP Address : {}".format(ip))
## Balance parenthesis check
#
def checker(s):
# Check length
if(len(s) % 2 != 0):
return False
# set of opening brackets
opening = set('([{')
## JSON
#
import json
# Open json
with open("Service2.json", "r") as file:
data = json.load(file)
data1 = data
import turtle
turtle.bgcolor('black')
turtle.pensize(2)
def curve():
for i in range(200):
turtle.right(1)
turtle.forward(1)