Skip to content

Instantly share code, notes, and snippets.

Avatar

painor painor

View GitHub Profile
View script.py
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
driver = webdriver.Chrome()
driver.get("https://humanbenchmark.com/tests/reactiontime")
input("ready ?")
@painor
painor / contact.php
Created Jan 1, 2021
Small php contact to telegram script
View contact.php
<?php
function get_client_ip()
{
$ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if (isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if (isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED'];
else if (isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR'];
@painor
painor / TrashGuy_plotter.py
Created Dec 10, 2020
A small helper script to plot timeit results
View TrashGuy_plotter.py
import matplotlib.pyplot as plt
from timeit import timeit
time_taken = []
number_elements = [*range(15)]
for x in range(1, 16):
string = 'a' * x
best = timeit("for _ in TrashGuy(inp): pass", setup=f"from trashguy import TrashGuy;inp='{string}'", number=1000)
time_taken.append(best)
plt.plot(time_taken, number_elements, color='g', marker='o')
@painor
painor / README.md
Last active Oct 19, 2020
Trivia bot telethon
View README.md

Trivia bot

A small trivia bot made for my yotube tutorial

If anything wasn't clear you can PM me at @painor

بوت بسيط تم صنعه من اجل فيديو اليوتيب التعليمي

اذا كان شيء غير واضح يمكنك التواصل معي في التلغرام على المعرف التالي @painor

@painor
painor / RSA_keys.js
Last active Jan 10, 2020
public RSA keys
View RSA_keys.js
const PUBLIC_KEYS = [{
'fingerprint': [40, 85, 94, 156, 117, 240, 61, 22, 65, 244, 169, 2, 33, 107, 232, 108, 2, 43, 180, 195],
'n': BigInt('24403446649145068056824081744112065346446136066297307473868293895086332508101251964919587745984311372853053253457835208829824428441874946556659953519213382748319518214765985662663680818277989736779506318868003755216402538945900388706898101286548187286716959100102939636333452457308619454821845196109544157601096359148241435922125602449263164512290854366930013825808102403072317738266383237191313714482187326643144603633877219028262697593882410403273959074350849923041765639673335775605842311578109726403165298875058941765362622936097839775380070572921007586266115476975819175319995527916042178582540628652481530373407'),
'e': 65537
}, {
'fingerprint': [140, 171, 9, 34, 146, 246, 166, 50, 10, 170, 229, 247, 155, 114, 28, 177, 29, 106, 153, 154],
'n': BigInt('250814078104102250309317227348860592475985151575164703972425458675501165984369685535514655546537452016
@painor
painor / main.js
Created Jan 2, 2020
Small login + send message script with gramJS
View main.js
const readline = require("readline")
const { ResolveUsernameRequest } = require("telegram/gramjs/tl/functions/contacts")
const { SendMessageRequest } = require("telegram/gramjs/tl/functions/messages")
const { TelegramClient} = require('telegram/gramjs')
const apiId = 12345689
const apiHash = "123456789abcdfgh"
const { ConnectionTCPFull } = require('telegram/gramjs/network')
const rl = readline.createInterface({
@painor
painor / example.js
Created Nov 14, 2019
testing webpack
View example.js
function f() {
console.log('ok')
}
module.exports = {
f,
}
@painor
painor / unmarshal.py
Last active May 10, 2021
unmarshal python code object string. python2
View unmarshal.py
import marshal
a = marshal.loads("your marshal string data that is a code object here")
import py_compile
import time
import uncompyle6
@painor
painor / FastTelethon.py
Last active May 9, 2021
This will increase the download/upload speed when using telethon
View FastTelethon.py
# 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
@painor
painor / call.py
Created Feb 2, 2019
Make a call using pyrogram
View call.py
#This is taken from https://github.com/LonamiWebs/Telethon-calls/blob/master/calls.py and modified
import hashlib
import os
import random
from pyrogram import Client
from pyrogram.api.functions.messages import GetDhConfig
from pyrogram.api.functions.phone import RequestCall
from pyrogram.api.types import PhoneCallProtocol