Skip to content

Instantly share code, notes, and snippets.

View SpEcHiDe's full-sized avatar

Shrimadhav U K SpEcHiDe

View GitHub Profile
@AnjanaMadu
AnjanaMadu / install-ffmpeg.ps1
Created April 10, 2023 15:08
A powershell script to install ffmpeg in windows easily
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (!$isAdmin) {
Write-Host "Please run this script as administrator."
exit
}
if (Get-Command ffmpeg -ErrorAction SilentlyContinue) {
Write-Host "ffmpeg is already installed."
exit
}
@Dan-Q
Dan-Q / _no_code_page_.php
Last active October 12, 2024 16:49
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@Lonami
Lonami / launchasync.py
Last active August 27, 2024 14:41
Wrapper to launch async tasks from threaded code
import threading
import asyncio
from queue import Queue as BlockingQueue
class TwoSidedQueue:
"""
Behaves like an `asyncio.Queue`, but `get` and `put` act on different ends.
"""
def __init__(self, queue_in, queue_out):
@FabianPastor
FabianPastor / TelegramWebValidator.php
Last active February 10, 2023 22:20
Just a small Telegram Auth Data validator class for PHP.
<?php
// TelegramWebValidator.php
namespace SFPL\Telegram;
class WebDataException extends \Exception{};
class WebValidator
{
private string $bottoken;
private int $time_to_expire = 86400;
@MohammadHosseinGhorbani
MohammadHosseinGhorbani / conversation.py
Last active May 8, 2024 09:10
Conversations in pyrogram (no extra package needed)
from pyrogram import Client, filters
app = Client('CONVERSATION_EXAMPLE')
conversations = {}
infos = {}
def conv_filter(conversation_level):
def func(_, __, message):
return conversations.get(message.from_user.id) == conversation_level
@MineRobber9000
MineRobber9000 / README.md
Created July 7, 2020 03:29
Import Python modules from GitHub

githubimport

Allows you to import Python modules from the top level of a GitHub repository. Basically, golang's import semantics but in Python fashion.

>>> import githubimport
>>> from MineRobber9000.test_modules import blah
>>> blah.foo()
"bar"
@painor
painor / FastTelethon.py
Last active October 14, 2024 08:25
This will increase the download/upload speed when using telethon
# copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py
# Copyright (C) 2021 Tulir Asokan
import asyncio
import hashlib
import inspect
import logging
import math
import os
from collections import defaultdict
from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO
@delivrance
delivrance / welcome_bot.hy
Last active April 23, 2019 17:13
This is the Welcome Bot in @PyrogramChat (Telegram) written in Hy
;; This is the Welcome Bot in @PyrogramChat (Telegram) written in Hy
;;
;; Example ported from
;; https://github.com/pyrogram/pyrogram/blob/c2da2a61ece6711bd7ed51d68249995843ff5dec/examples/welcome_bot.py
;;
(import [pyrogram [Client Emoji Filters]])
(setv MENTION "[{}](tg://user?id={})")
(setv MESSAGE "{} Welcome to [Pyrogram](https://docs.pyrogram.ml/)'s group chat {}!")
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@AgentOak
AgentOak / youtube_formats.md
Last active November 15, 2024 12:26
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4