Skip to content

Instantly share code, notes, and snippets.

const fs = require("fs");
const _ = require("lodash");
const names = fs.readFileSync("./names", "utf-8").split("\n");
let count = [];
function normalizeName(incoming) {
const incomingToNormalized = {
Sergey: "Сергей",
Dmitry: "Дмитрий",
@PavelPolyakov
PavelPolyakov / export-group-members.py
Created December 27, 2021 21:14
Telegram export group members + two factor auth
from telethon.sync import TelegramClient
from telethon.tl.functions.messages import GetDialogsRequest
from telethon.tl.types import InputPeerEmpty, InputPeerChannel, InputPeerUser
from telethon.errors.rpcerrorlist import PeerFloodError, UserPrivacyRestrictedError, SessionPasswordNeededError
from telethon.tl.functions.channels import InviteToChannelRequest
import sys
import csv
import traceback
import time
import random
@PavelPolyakov
PavelPolyakov / format-everything.py
Created February 16, 2020 14:37
format repo using git-filter-repo
#!/usr/bin/env python3
"""
This script is meant to format all java files in your repo using maven-formatter-plugin
"""
import argparse
import os
import sys
import subprocess
"err": {
"type": "Error",
"message": "Oh no, something bad happened, try to debug me",
"stack": "Error: Oh no, something bad happened, try to debug me\n at Object.<anonymous> (/app/src/modules/routes/error-thrower/index.ts:8:13)"
}
import * as sourceMapSupport from "source-map-support";
sourceMapSupport.install();
npm i source-map-support
"err": {
"type": "Error",
"message": "Oh no, something bad happened, try to debug me",
"stack": "Error: Oh no, something bad happened, try to debug me\n at Object.<anonymous> (/app/dist/modules/routes/error-thrower/index.js:17:19)"
}
docker-compose -f docker-compose.production.yaml build
docker-compose -f docker-compose.production.yaml up
// at the top
import errorThrowerRoutes from "./modules/routes/error-thrower";
// make server more verbose
const server: fastify.FastifyInstance<
Server,
IncomingMessage,
ServerResponse
> = fastify({logger:true});
import * as fp from "fastify-plugin";
export default fp(async (server, opts, next) => {
server.route({
url: "/error-thrower",
method: ["GET"],
handler: async (request, reply) => {
throw new Error("Oh no, something bad happened, try to debug me");
return reply.send({ date: new Date(), works: true });
}