Skip to content

Instantly share code, notes, and snippets.

View mh-firouzjah's full-sized avatar
🐗
Valar Codilis: all men must code

Mahdi Firouzjah mh-firouzjah

🐗
Valar Codilis: all men must code
View GitHub Profile
@mh-firouzjah
mh-firouzjah / LinkedInConnectionBulkRemove.md
Last active April 9, 2024 13:04
a js code to bulk remove linkedin connections

LinkedIn Connections Bulk Remove

If you have problem with remove multiple LinekedIn connections at once, this code may help you.
In this code there is a filter that checks conection's occupation and based on that it will remove some connections.
Use some keyword to filter your connections and remove some.

Useage

In order to use this script open your connections page at linkedin.com quick open, then go to page inspect view and in the console paste the code below press Enter and wait till finishes it's job.

A Python Script To Fetch Data From RSS Feeds Asynchronously

async def task(work_queue: asyncio.Queue, client: httpx.AsyncClient, result: list[tuple[Post, Tag]]) -> None:
    while not work_queue.empty():
        source: Source = await work_queue.get()
        url = source.feed_url
        logger.info(f"Working on {url}")
        try:
            res = await client.get(url)
@mh-firouzjah
mh-firouzjah / Translator.md
Last active May 9, 2024 15:42
Translate selected text on Linux with ease! Assign a keyboard shortcut to instantly translate and pronounce selected texts. 🌐📝

Text Translator and Pronunciation Tool

This script provides a convenient way to check spelling, pronunciation, and translation of words or text using a dictionary (such as Google Translate) directly from your Linux desktop. It can be easily integrated with a keyboard shortcut, making it globally accessible for quick translation and pronunciation of selected text.

Background

As a non-native English speaker, I often find myself needing to verify the spelling, pronunciation, or translation of words, phrases, or paragraphs using an online dictionary like Google Translate. To streamline this process, I developed a script that allows me to quickly translate and hear the pronunciation of selected text with a simple keyboard shortcut.

How It Works

@mh-firouzjah
mh-firouzjah / zero-padding.md
Created May 31, 2023 15:14
Zero-Pad this is a zsh script in order to zero-pad mp4 & srt files so media players will always play them in natural integer format.

Zero-Pad

When I use linux OS, SMplayer is my favorite vidoe player but this media player has very anoying bug in it, beside all the havy customaization available via a very nice and simple GUI,it has.

The bug is this media player will sort any files that their names astriting with digits in alphabetical order regardless of natural integer numbers order, so for example after 1. file-name.mp4 it will jump to 11. file-name.mp4 instead of 2. file-name.mp4.

  • this bug is reporeted so many times but it's still there and no fix have been issued yet.
@mh-firouzjah
mh-firouzjah / box_drawing_chars.md
Last active August 2, 2021 09:48
box-drawing characters and their representations in Unicode Strings

Unicode characters

Braille

2880  0  1 2 3 4 5  6 7 8 9  a b c d e f

2880⠀⠀               

2810                
@mh-firouzjah
mh-firouzjah / better_powershell.md
Last active May 1, 2024 20:30
how to add zsh-like theme and feature to windows powershell

Better PowerShell

Theme | History | KeyBinding

MyPowershell

in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht zsh for example, we are going to make powershell like that as much as we can.

What we will achieve

@mh-firouzjah
mh-firouzjah / subtitle_encoder.md
Last active May 30, 2021 06:55
convert subtitle(.srt) files encoding form `windows 1256(arbic)` to `utf-8`.

Subtitle Decoder/Encoder

Subtitles are often not displayed properly on players due to incorrect encoding/decoding.

this python script is able to recive a path to subtitle/*.str files and change encoding form arabic/windows-1256 to utf-8.

'''
convert all subtile (*.srt) files inside given directory
from encoding `windows 1256` to `utf-8`
'''
@mh-firouzjah
mh-firouzjah / Django-login-required-middleware.md
Last active August 21, 2022 08:24
Django Login Required Middleware

Django Login Required Middleware

if you need users to be loged in first, before visiting your website, so it's easier to use a middleware to check if they're loged in or not. inorder to have such a middleware, use the following code:

# middleware.py
import re

from django.conf import settings
from django.contrib.auth.middleware import AuthenticationMiddleware
@mh-firouzjah
mh-firouzjah / merge-video-and-sound.py
Created February 16, 2021 10:12
python-ffmpeg merging video and sound files
# I had mistakenly downloaded some video fiels without sound so then after I had to download the sound files related but
# how could I merge them to finally have a single file? following code would this!
# !attention this file has to be inside the directory where the video and sound exists -
# and the result would be in a sub-directory named `output`
import os
from os import listdir
from os.path import isfile, join