Skip to content

Instantly share code, notes, and snippets.

View Itz-fork's full-sized avatar
🖤
Exploring :octocat:

Hirusha Himath Itz-fork

🖤
Exploring :octocat:
View GitHub Profile
@Itz-fork
Itz-fork / async_multiprocessing.py
Created August 7, 2022 08:16
Run async function in the background using asyncio and multiprocessing
from asyncio import sleep, get_event_loop, get_running_loop
from multiprocessing import Process
# Simple callback function
async def my_callback_func():
print(f"Doing something in the background!")
await sleep(1)
# Run the callback function in a loop as you need to use async / await
@Itz-fork
Itz-fork / unicode_count_example.py
Created January 5, 2022 05:32
Spam unicode characters count Example
import requests
def get_spam_unicode_char_count(text):
req = requests.get(f"https://nexa-apis.herokuapp.com/unicode?text={text}").json()
if req["status"] == "Ok":
return req["data"]
else:
return None
uc = get_spam_unicode_char_count("Is this even a spam?")["count"]
@Itz-fork
Itz-fork / seearch_ud.py
Last active December 31, 2021 16:59
Urban Dictionary API example
import requests
def search_ud(q):
req = requests.get(f"https://nexa-apis.herokuapp.com/ud?query={q}").json()
if req["status"] == "Ok":
return req["data"]
else:
return None
def_txt = """
@Itz-fork
Itz-fork / get_wallpapers.py
Created December 30, 2021 13:46
Wallpaper API Example
import requests
def search_and_get_wallpapers(q="aesthetic"):
"""
q - The name (query) you want to search about
"""
if q:
req = requests.get(f"https://nexa-apis.herokuapp.com/wallpaper?query={q}").json()
else:
req = requests.get("https://nexa-apis.herokuapp.com/wallpaper").json()
@Itz-fork
Itz-fork / reddit_search_example.py
Last active December 6, 2023 09:13
Reddit Post Search API Example
import requests
def search_reddit_posts(q, sub_reddit=None):
if sub_reddit:
req = requests.get(f"https://nexa-apis.herokuapp.com/reddit?query={q}&subreddit={sub_reddit}").json()
else:
req = requests.get(f"https://nexa-apis.herokuapp.com/reddit?query={q}").json()
if req["status"] == "Ok":
return req["data"]
else:
@Itz-fork
Itz-fork / random_anime_wallpapers.py
Last active December 15, 2021 19:05
Random Anime Wallpaper API example
import requests
def get_random_anime_wallpaper(q=None):
"""
q - The name (query) you want to search about
"""
if q:
req = requests.get(f"https://nexa-apis.herokuapp.com/anime_wall?query={q}").json()
else:
req = requests.get("https://nexa-apis.herokuapp.com/anime_wall").json()
@Itz-fork
Itz-fork / translate_api_example.py
Created December 15, 2021 05:14
Google Translate API example
import requests
def translate_text(text, dest):
req = requests.get(f"https://nexa-apis.herokuapp.com/tr?text={text}&dest_lang={dest}").json()
if req["status"] == "Ok":
return req["data"]
else:
return None
trans = translate_text("Hi!", "es")
@Itz-fork
Itz-fork / how_to_install_ffmpeg.txt
Created August 17, 2021 13:41
How to install ffmpeg in Windows and Linux
======= In Ubuntu =======
apt install ffmpeg
@Itz-fork
Itz-fork / nano_install.md
Last active April 8, 2022 05:19
How to install nano in vps/computer

Debian, Ubuntu based

sudo apt install nano

Arch Based Distros

sudo pacman -S nano
@Itz-fork
Itz-fork / no_tag.py
Created July 29, 2021 04:45
Simple Plugin to Remove Forward tag From a Message. Powered by Pyrogram
# Simple Plugin to Remove Forward tag From a Message. Powered by Pyrogram
# Idea by - https://github.com/lntechnical2
from pyrogram import Client, filters
from pyrogram.types import Message
@Client.on_message(filters.command("rm_tag") & ~filters.edited & filters.private)
async def rmforwdtag(client: Client, message: Message):
replied_msg = message.reply_to_message
rmtag_chat = message.chat.id