Skip to content

Instantly share code, notes, and snippets.

View Abhayparashar31's full-sized avatar
:octocat:
Learning New Things

Abhay Parashar Abhayparashar31

:octocat:
Learning New Things
View GitHub Profile
from textblob import TextBlob
testimonial = TextBlob("Textblob is amazingly simple to use. What great fun!")
testimonial.sentiment
from win10toast import ToastNotifier
toaster = ToastNotifier()
header = 'Medium Article'
text = 'Its the correct time to start writing your article'
toaster.show_toast(f"{header}",f"{text}",duration=10,threaded=True)
while toaster.notification_active(): time.sleep(0.005)
from playsound import playsound
playsound('PATH_TO_AUDIO_FILE')
import webbrowser
webbrowser.open("https://stackoverflow.com")
from dateutil.relativedelta import *
from dateutil.easter import *
from dateutil.rrule import *
from dateutil.parser import *
from datetime import *
now = parse("Tue 11 17:13:46 Dec UTC 2020")
today = now.date()
year = rrule(YEARLY,dtstart=now,bymonth=8,bymonthday=13,byweekday=FR)[0].year
rdelta = relativedelta(easter(year), today)
print("Today is: %s" % today)
import requests
url = " http://newsapi.org/v2/top-headlines?country=us&apiKey=YOU_API_KEY"
page = requests.get(url).json()
article = page["articles"]
results = []
for ar in article:
results.append(ar["title"])
for i in range(10): ### Top 10 News ### Use len(results) to get all the top 20 news
print(i + 1, results[i])
import requests
import time
res = requests.get(''https://sv443.net/jokeapi/v2/joke/Any")
joke = res.json()
joke['setup']
time.sleep(3)
joke['delivery']
--------------------------------
What do you call a developer who doesn't comment code?
import requests
res = requests.get(''http://numbersapi.com/7/math")
print(res.text)
----------------------
7 is the lowest number that cannot be represented as the sum of the squares of three integers.
res = requests.get("http://numbersapi.com/3/31/date")
print(res.text)
--------------------------------
March 31st is the day in 1909 that Serbia accepts Austrian control over Bosnia and Herzegovina.
import requests
url = "link-to-webpage"
apiKey = "your-api-key"
linkRequests = f"https://api.html2pdf.app/v1/generate?url={url}&apiKey={apikey}"
result = requests.get(linkRequests).content
with open("document.pdf", "wb") as handler:
handler.write(result)
import requests
res = requests.get('https://api.quotable.io/random')
quote = res.json()
quote['content']
----------------------------------------
When I let go of what I am, I become what I might be.