Voorbeelden

Speech to text

import speech_recognition as sr

r = sr.Recognizer()
with sr.Microphone() as source:
    print("Speak Anything :")
    audio = r.listen(source)
    try:
        text = r.recognize_google(audio,language="nl-NL")
        print("You said : {}".format(text))
    except:
        print("Sorry could not recognize what you said")
from tkinter import *
import webbrowser

root=Tk()
root.title("Search bar")

def search():

    url=entry.get()
    webbrowser.register('chrome', None, webbrowser.BackgroundBrowser("C://Program Files//Google//Chrome//Application//chrome.exe"))
    webbrowser.get('chrome').open(url)

label1=Label(root, text="Enter URL here: ", font=("arial",10,"bold"))
label1.grid(row=0,column=0,pady=15)
entry=Entry(root,width=35)
entry.grid(row=0,column=1,padx=15)
btn=Button(root, text="Search", command=search, bg="green",fg="white")
btn.grid(row=1,column=0,columnspan=2,pady=5)
root.mainloop()

Get any website IP address

import socket as s

host = 'google.com'
print(f'IP of {host} is {s.gethostbyname(host)}')

Battery Percentage Notification

from pynotifier import Notification
import psutil

battery = psutil.sensors_battery()
percent = battery.percent
Notification("Battery Percentage", str(percent) + "% Percent remaining", duration=15).send()

Get stored passwords

import subprocess

data  = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
for i in profiles:
    results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8').split('\n')
    results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
    try:
        print("{:<30}: {:<}".format(i, results[0])) # is space ertussen, tussen network, name en password
    except IndexError:
        print("{:<30}: {:<}".format(i, "none"))
input("")