Skip to content

Instantly share code, notes, and snippets.

@alighafoori
alighafoori / snappfood.js
Last active July 6, 2022 11:02 — forked from SamadiPour/snappfood.js
Snappfood extract statistics
cookies = Object.fromEntries(document.cookie.split('; ').map(c => c.split('=')));
let UDID = cookies.UDID;
let jwt = cookies[['jwt-access_token']];
// let jwt = JSON.parse(window.localStorage.JWT).access_token;
var myHeaders = new Headers();
myHeaders.append("authority", "snappfood.ir");
myHeaders.append("accept", "application/json, text/plain, */*");
myHeaders.append("accept-language", "en-US,en;q=0.9,fa;q=0.8");
myHeaders.append("authorization", "Bearer " + jwt);
@alighafoori
alighafoori / EMailerService.cs
Created September 11, 2022 06:08 — forked from Wanchai/EMailerService.cs
Sending emails with .Net Core using MailKit with DKIM signature
using System;
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MimeKit;
using MimeKit.Cryptography;
namespace MailerApi.Services
{
@alighafoori
alighafoori / Telegram-Notify-Actions.txt
Last active March 12, 2024 07:46
Telegram notification with workflow status
- name: send telegram message on push
if: success() || failure()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
status:${{ job.status }}
${{ github.actor }} created commit:
#!/bin/bash
MONGO_CONTAINER_NAME="mongo" # Or use the actual container name
# Variables
BOT_TOKEN="<your bot token>"
CHAT_ID="<chatId>"
FILE_PATH="/mongodb_backups/waitlist_backup.archive" # Path where the archive will be stored on the host machine
FILE_PREFIX="part_" # Prefix for the split parts
PART_SIZE="49M" # Size of each part (49 MB to stay within Telegram bot limit)
# Dynamically get the container ID
@alighafoori
alighafoori / youtube-downloader.ps1
Created November 9, 2024 06:46
check yt-dlp for new version and then download video from youtube
# Define the GitHub API URL for yt-dlp releases
$repoUrl = "https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest"
# Enter your GitHub token here (to avoid rate limits)
$githubToken = "your_personal_access_token_here"
# Function to check and update yt-dlp
function Update-ytDlp {
# Send a web request to get the latest release data from GitHub
$response = Invoke-RestMethod -Uri $repoUrl -Headers @{
@alighafoori
alighafoori / mp3converter.ps1
Last active January 4, 2025 15:57
PowerShell Script to Convert Video Files to MP3 Using FFmpeg
# Path to FFmpeg executable
$FFmpegPath = "Path\To\ffmpeg.exe"
# Path to the folder containing video files
$InputFolder = "Path\To\InputFolder"
# Path to the output folder for MP3 files
$OutputFolder = "Path\To\OutputFolder"
# Ensure the output folder exists
if (-not (Test-Path -Path $OutputFolder)) {
@alighafoori
alighafoori / run-with-bun.ps1
Created March 31, 2025 08:56
Add 'Run with Bun' to Windows Right-Click Menu for .ts Files (PowerShell Script)
# Ensure the script runs as administrator
$CurrentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object Security.Principal.WindowsPrincipal($CurrentUser)
$IsAdmin = $Principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $IsAdmin) {
Write-Host "Restarting with administrator privileges..."
Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
}