This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{collections::HashMap, env, net::SocketAddr, sync::Arc}; | |
use async_broadcast::Receiver; | |
use volo::{ | |
context::Endpoint, | |
discovery::{diff_address, Change, Discover, Instance}, | |
loadbalance::error::LoadBalanceError, | |
net::Address, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface RetryFn { | |
<R, F extends () => Promise<R>>(fn: F, limit: number, delay: number, errorHandler?: (error: any, attemptNumber: number) => void): Promise<R>; | |
} | |
const retry: RetryFn = async <R, F extends () => Promise<R>>(fn: F, limit: number, delay: number, errorHandler?: (error: any, attemptNumber: number) => void): Promise<R> => { | |
let count = 0; | |
while (count < limit) { | |
try { | |
return await fn(); | |
} catch (error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:bookworm AS builder | |
WORKDIR /build | |
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ | |
make \ | |
git \ | |
zlib1g-dev \ | |
libssl-dev \ | |
gperf \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import ( | |
"github.com/stretchr/testify/assert" | |
"testing" | |
) | |
var algos = []SignatureAlgorithm{ | |
SignatureAlgorithmRSA2048, | |
SignatureAlgorithmRSA4096, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <ctime> | |
// Function to compute (a * b) % mod for large numbers (to prevent overflow) | |
long long fastMultiply(long long a, long long b, long long mod) { | |
long long res = 0; | |
while (b > 0) { | |
if (b & 1) { | |
res = (res + a) % mod; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package telebot; | |
option go_package = "telebot"; | |
message user { | |
sint64 id = 1; | |
optional bool is_bot = 2; | |
optional bool is_premium = 3; | |
optional string first_name = 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gzip | |
import os | |
import subprocess | |
import time | |
db_name: str = "" | |
db_user: str = "" | |
db_pass: str = "" | |
db_host: str = "" | |
db_port: int = 5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var allowDomains = [ | |
"*.zhksb.net", | |
"zhksb.net", | |
"*.ahdark.com", | |
"ahdark.com" | |
] | |
function validate(input) { | |
if (!input) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author AH-dark | |
* @describe 使用 puppeteer + 腾讯云云函数 实现网页截图API服务 | |
* @version 1.0.1 | |
* @url https://gist.github.com/AH-dark/8a074b2f83b1466810bb1c833ce1bdad | |
* | |
* 部署说明: | |
* 1. 需要腾讯云云函数服务、API网关服务 | |
* 2. 云函数语言强制为 Nodejs 12 ,否则需要自己安装 puppeteer 依赖 | |
* 3. 函数类型为 Event 函数,内容复制粘贴即可,执行方法为 index.main_handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const UAList = [ | |
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36", | |
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1", | |
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0", | |
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)", | |
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36Edge/13.10586", | |
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36", | |
"Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19", |
NewerOlder