Skip to content

Instantly share code, notes, and snippets.

View hosni's full-sized avatar

Hossein Hosni hosni

View GitHub Profile
@hosni
hosni / telegramRestore.md
Created September 22, 2020 10:07 — forked from avivace/telegramRestore.md
Restore deleted Telegram messages from groups

Restore deleted Telegram messages, medias and files from groups

There's not telegram API method for this, we need to call MTProto methods to retrieve messages from the "Recent Actions" (Admin Log) since deleted messages (and medias) gets moved there for 48 hours before the permanent deletion.

from telethon import TelegramClient, events, sync
from telethon.tl.types import InputChannel, PeerChannel
from telethon.tl.types import Channel
import time
@hosni
hosni / CIDR.php
Created November 18, 2020 19:21 — forked from stibiumz/CIDR.php
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <[email protected]>
* @revision Carlos Guimarães <[email protected]>
* @version Wed Mar 12 13:00:00 EDT 2014
*/
@hosni
hosni / linux-usb-file-copy-fix.md
Created November 23, 2020 13:08 — forked from 2E0PGS/linux-usb-file-copy-fix.md
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

about::config
browser.fixup.domainwhitelist.*.jey
cat <<EOF > /etc/vmware/firewall/vncServer.xml
<ConfigRoot>
<service>
<id>vncServer</id>
<rule id='0000'>
<direction>inbound</direction>
<protocol>tcp</protocol>
<porttype>dst</porttype>
<port>
<begin>5900</begin>
@hosni
hosni / amoozeshyar_bypass
Created February 21, 2021 22:02
bypass amoozeshyar's bullshit 2FA
(function(d){const r=d.getElementById("loginform");r.operation.value = "showCaptcha";r.submit();})(document)
@hosni
hosni / arvan-ips.sh
Last active July 12, 2021 08:26
Sadly, some of services is behind on Arvan Cloud and is Iran Access! this script fetch all AC IPs and add a route for them for you.
#!/usr/bin/sh
H_ECHO_BIN=/bin/echo
helpMe()
{
$H_ECHO_BIN "";
$H_ECHO_BIN "Add or Delete Arvan Cloud's IPs to your ip routing table.";
$H_ECHO_BIN -e "(in case you don't want to turn of your VPN, and DAMN FilterNet)\n";
$H_ECHO_BIN "Usage: $0 -a action -g gateway";
@hosni
hosni / set-apt-proxy.md
Created August 6, 2021 05:47 — forked from wonderbeyond/set-apt-proxy.md
[ubuntu][socks5][proxy] Set proxy for apt

Writing an apt proxy conf file /etc/apt/apt.conf.d/proxy.conf as below.

Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
Acquire::socks::Proxy "socks5h://127.0.0.1:1080";

And the proxy settings will be applied the next time we run apt.

@hosni
hosni / dlink-2730u-ssh-connection
Created August 19, 2021 06:53
Connect to dlink-2730u using ssh
@hosni
hosni / KeyGenerateCommand.php
Last active September 13, 2021 07:40
key:generate command for lumen application
<?php
namespace App\Console\Commands;
use RuntimeException;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
class KeyGenerateCommand extends Command
{