Skip to content

Instantly share code, notes, and snippets.

View SanariSan's full-sized avatar
🙁
Why would you give up the joy of writing code to agents?

SanariSan

🙁
Why would you give up the joy of writing code to agents?
  • Jobity.io
  • Georgia, Tbilisi
View GitHub Profile
@SanariSan
SanariSan / telegramRestore.md
Created March 10, 2022 22:01 — 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
@SanariSan
SanariSan / readme.md
Last active October 3, 2025 18:23
Telegram HTTP bot API via CURL | Send text, photos, documents, etc.

Here are some examples on how to use Telegram bot api via CURL

Prerequisites

For getting messages in private chat with bot

  • Create a bot using @BotFather, get it's token
  • Start conversation with bot
  • Run following curl command
curl https://api.telegram.org/bot/getUpdates | grep -Po '"from":{"id":.+?,'
@SanariSan
SanariSan / Shadowsocks-client.sh
Last active June 24, 2025 19:31
Shadowsocks+V2Ray | client+server (autodeploy) setup (bash)
############
# HOW TO CONNECT FROM LINUX?
# HERE IS THE SCRIPT TO SETUP YOUR PC
############
#
sudo apt install -y shadowsocks-libev wget
sudo wget -O- "https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.3.1/v2ray-plugin-linux-amd64-v1.3.1.tar.gz" | tar -zxv
@SanariSan
SanariSan / cursor-position.js
Created April 12, 2022 11:15 — forked from lancejpollard/cursor-position.js
Get Cursor Position in Terminal with Node.js
module.exports = function(callback) {
require('child_process').exec('./cursor-position.sh', function(error, stdout, stderr) {
callback(error, JSON.parse(stdout));
});
}
@SanariSan
SanariSan / util.js
Created April 17, 2022 17:47
JS utils
import { appendFileSync } from 'fs';
const log = (str) => console.log(str);
const debugLog = (p) => (process.env.NODE_ENV === 'development' ? console.log(p) : false);
const strError = (e, hint) =>
`Error : ${hint} : ${e.message}\n${e.stack.split('\n').slice(1, 3).join('\n')}`;
const dir = (p) => console.dir(p, { depth: 10 });
const debugDir = (p) =>
process.env.NODE_ENV === 'development'
? console.dir(p, { depth: 2 })

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@SanariSan
SanariSan / Every possible TypeScript type.md
Created August 20, 2022 17:58 — forked from laughinghan/Every possible TypeScript type.md
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@SanariSan
SanariSan / ntp_hints_ru.txt
Last active February 9, 2024 05:01
ntp hints (ru)
Leap: normal - корректировка мирового времени между электромагнитыми атомическими часами и определяемыми по планетам, не важно
Version: 4 - версия ntp протокола, последняя 4, не важно
Stratum: 1 - номер сервера в иерархии серверов синхронизации, 0 = атомические часы, 1 = сервер подключенный к ним локально, 2 = сервер подключенный по сети (уже плохо), играет роль, 1 - хорошо
Reference: PPS - указывает ориджин времени, PPS = Generic pulse-per-second, атомические часы на пульсации электронов, не важно)
Precision: 4us (-18) - сколько требуется микросекунд для доступа к системному времени
@SanariSan
SanariSan / readme.md
Created September 29, 2022 20:40
Restart docker after Let's encrypt update

This is a collection of Ubuntu fixes for Lenovo Legion 5i

Tested on: Lenovo Legion 5i with below specs:
AMD® Ryzen 7 4800h with radeon graphics × 16
NVIDIA Corporation / NVIDIA GeForce RTX 2060/PCIe/SSE2

1. GPU ISSUES for RTX 2060:

nvidia-driver-470 - HDMI doesn't have to work from the beggining
nvidia-driver-495 - HDMI works from the beginning, unstable (random reboots)\