Skip to content

Instantly share code, notes, and snippets.

View ayoubzulfiqar's full-sized avatar
💫
Engineering

Sensei ayoubzulfiqar

💫
Engineering
  • Freelancer (Open to Collaborations!)
View GitHub Profile
@ayoubzulfiqar
ayoubzulfiqar / SoundEffect.ps1
Created July 11, 2025 07:21
Make Error When Script Run To Error
# Function to play a sound file
function Play-ErrorSound {
param (
[Parameter(Mandatory=$true)]
[string]$SoundFilePath
)
# Check if the sound file exists
if (-not (Test-Path $SoundFilePath -PathType Leaf)) {
Write-Warning "Sound file not found: $SoundFilePath. Cannot play alert."
@ayoubzulfiqar
ayoubzulfiqar / jsonevr.go
Created June 20, 2025 07:30
This is a simple script which host/serve the remote as well as LOCAL json file
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"net"
"net/http"
@ayoubzulfiqar
ayoubzulfiqar / lettercounter.md
Last active June 18, 2025 09:30
MCP Server with Gradio - Simple

MCP - LetterCounter

pip install "gradio[mcp]"
import gradio as gr
@ayoubzulfiqar
ayoubzulfiqar / env.md
Created June 12, 2025 17:56
READ ENV

Put this at the top of the file inside .env

# .env

Function to read the file

encoding = locale.getpreferredencoding()
@ayoubzulfiqar
ayoubzulfiqar / array.md
Last active June 11, 2025 11:21
Arrays

Array

An array is a data structure that stores a collection of elements of the same data type in contiguous (adjacent) memory locations. Each element in an array is identified by an index or a key, typically starting from 0.

Key Characteristics of Arrays:

  • Homogeneous: All elements in an array must be of the same data type (e.g., all integers, all strings, all floating-point numbers).
  • Contiguous Memory: Elements are stored sequentially in memory, which allows for efficient access based on their index.
  • Fixed or Dynamic Size: Arrays can be either fixed in size (static) or resizable (dynamic), depending on the programming language and implementation.
  • Direct Access (Random Access): Elements can be accessed directly using their index, meaning the time taken to access any element is constant, regardless of its position (O(1)).

Golang

package main

import (
	"fmt"
	"time"
)
@ayoubzulfiqar
ayoubzulfiqar / sec.py
Last active June 2, 2025 10:19
SEC:Extraction
import html
import json
import re
from bs4 import BeautifulSoup
path = "file.xml"
@ayoubzulfiqar
ayoubzulfiqar / company_tickers.json
Created May 26, 2025 13:29
Add Three Zeros befor the cik_str
This file has been truncated, but you can view the full file.
{
"0": {
"cik_str": 789019,
"ticker": "MSFT",
"title": "MICROSOFT CORP"
},
"1": {
"cik_str": 1045810,
"ticker": "NVDA",
@ayoubzulfiqar
ayoubzulfiqar / playwright.md
Created May 6, 2025 17:22
Video Detection & Download Strategies using Playwright (Python)

Video Detection & Download Strategies using Playwright (Python)

To detect and download videos from a webpage's network traffic, we can intercept network requests in Playwright, identify video streams/files, and handle them appropriately. Below are different strategies to achieve this.


1. Intercepting Network Requests (Recommended)

Monitor network activity for video-related MIME types or file extensions.

@ayoubzulfiqar
ayoubzulfiqar / ReadENV.md
Created March 22, 2025 05:07
READ ENV - without any package

Read ENV

Golang

func loadEnv() error {
	file, err := os.Open(".env")
	if err != nil {
		fmt.Println("FileError:", err)
 return err