Skip to content

Instantly share code, notes, and snippets.

@KaushikShresth07
Created June 17, 2021 11:44
Show Gist options
  • Select an option

  • Save KaushikShresth07/fea7e36f06fcaa94c3da4e834437ae97 to your computer and use it in GitHub Desktop.

Select an option

Save KaushikShresth07/fea7e36f06fcaa94c3da4e834437ae97 to your computer and use it in GitHub Desktop.
def Alarm(time,Sound):
from playsound import playsound
import datetime
from time import sleep
Alarm_Time = str(time).replace(":","")
Alarm_Tim = str(time)
while True:
current_time = datetime.datetime.now().strftime("%H:%M").replace(":","")
current_tim = datetime.datetime.now().strftime("%H:%M")
if current_time == Alarm_Time:
print("Wake Up Sir , It's Time To Work .")
playsound(sound=str(Sound))
break
elif current_time>Alarm_Time:
print(f"Time Now : {current_tim}.")
print(f"Time For Alarm : {Alarm_Tim}.")
sleep(5)
def Calculator(Problem,Api_Key):
import wolframalpha
app_id = set(Api_Key)
client = wolframalpha.Client(app_id)
res = client.query(Problem)
answer = next(res.results).text
return answer
from PyDictionary import PyDictionary
def SynonymGet(Word):
from PyDictionary import PyDictionary
diction = PyDictionary()
synon = diction.synonym(Word)
return synon
def AntonymGet(Word):
from PyDictionary import PyDictionary
diction = PyDictionary()
anton = diction.antonym(Word)
return anton
def MeanGet(Word):
from PyDictionary import PyDictionary
diction = PyDictionary()
mean = diction.meaning(Word)
return mean
def GoogleSearch(term):
import pywhatkit
import wikipedia
from pywikihow import search_wikihow
Query = str(term)
pywhatkit.search(Query)
if 'how to' in Query:
max_result = 1
how_to_func = search_wikihow(query=Query,max_results=max_result)
assert len(how_to_func) == 1
how_to_func[0].print()
return how_to_func[0].summary
else:
search = wikipedia.summary(Query,2)
return f": According To Your Search : {search}"
def SimpleGoogleSearch(Title):
import pywhatkit
pywhatkit.search(Title)
def Jokes():
import pyjokes
joke = pyjokes.get_joke()
return joke
def Music(Name,Path):
import os
import pywhatkit
if 'file' in Name:
os.startfile(str(Path))
else:
pywhatkit.playonyt(Name)
def Notepad(Content,PathNow,PathToSave):
import os
from datetime import datetime
time = datetime.now().strftime("%H:%M")
filename = str(time).replace(":","-") + "-note.txt"
with open(filename,"w") as file:
file.write(Content)
path_1 = str(PathNow) + str(filename)
path_2 = str(PathToSave) + str(filename)
os.rename(path_1,path_2)
os.startfile(path_2)
def RemindMe(Title,Message,time,PathNow,PathToSave):
from time import sleep
from notifypy import Notify
import datetime
import os
time = str(time).replace(":","")
timekikli = str(time)
filename = str(time) + "-note.txt"
with open(filename,"w") as file:
file.write(Message)
path_21 = str(PathNow) + str(filename)
path33 = str(PathToSave) + str(filename)
os.rename(path_21,path33)
os.startfile(path33)
noti = Notify()
noti.title = str(Title)
noti.message = str(Message)
while True:
time_now = datetime.datetime.now().strftime("%H:%M").replace(":","")
time_n = datetime.datetime.now().strftime("%H:%M")
if str(time)==str(time_now):
noti.send()
break
else:
print(f"Time Is Now : {time_n} ")
print(f"Time To Remind You : {timekikli}")
sleep(5)
print("Waiting To Remind You .")
def screenshot(FileName,PathToSave):
import pyautogui
import os
path1name = FileName + ".png"
path1 = str(PathToSave) + path1name
kk = pyautogui.screenshot()
kk.save(path1)
os.startfile(path1)
def SpeedTest():
import speedtest
speed = speedtest.Speedtest()
upload = speed.upload()
correct_Up = int(int(upload)/800000)
download = speed.download()
correct_down = int(int(download)/800000)
return f'''
Uploading Speed : {correct_Up} .
Downloading Speed : {correct_down}.
'''
def TakeHindi():
import speech_recognition as sr
command = sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
command.pause_threshold = 1
audio = command.listen(source)
try:
print("Recognizing.....")
query = command.recognize_google(audio,language='hi')
print(f"You Said : {query}")
except:
return "none"
return query.lower()
def Tran():
from googletrans import Translator # pip install googletrans==3.1.0a0
line = TakeHindi()
traslate = Translator()
result = traslate.translate(line)
Text = result.text
return Text
def AskAnything(Problem,Api_Key):
import wolframalpha
app_id = set(Api_Key)
client = wolframalpha.Client(app_id)
res = client.query(Problem)
answer = next(res.results).text
return answer
def YouTubeDirectSearch(Title):
import pywhatkit
pywhatkit.playonyt(Title)
def YouTubeSearch(Title):
import webbrowser
hhtp = "https://www.youtube.com/results?search_query=" + str(Title)
webbrowser.open(hhtp)
def DownloadYouTube(PathToSave):
from pytube import YouTube
from pyautogui import click
from pyautogui import hotkey
import pyperclip
from time import sleep
sleep(2)
click(x=942,y=59)
hotkey('ctrl','c')
value = pyperclip.paste()
Link = str(value)
def Download(link):
url = YouTube(link)
video = url.streams.first()
video.download(PathToSave)
Download(Link)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment