Skip to content

Instantly share code, notes, and snippets.

View donma's full-sized avatar
:octocat:
I wanna play a game.

Donma Hsu donma

:octocat:
I wanna play a game.
View GitHub Profile
public static void CheckSslCertificate(string url)
{
try
{
// 建立 HttpClientHandler 並攔截憑證驗證
using var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) =>
{
var x509 = new X509Certificate2(cert);
/* github 行號框限拿掉 */
.article__content pre, .article__content table, .article__content td, .article__content th {
border: transparent 1px solid;
}
.gist .gist-file {
.gist-data {
background-color: #f7f7f7;
@donma
donma / maskname.cs
Last active September 4, 2025 03:32
/// <summary>
/// 遮罩名字
/// </summary>
/// <param name="name">原始姓名</param>
/// <param name="keepStart">保留開頭幾個字</param>
/// <param name="keepEnd">保留結尾幾個字</param>
/// <returns>遮罩後的姓名</returns>
public static string MaskName(string name, int keepStart = 1, int keepEnd = 1)
{
/**
* 取得目前作用中的工作表名稱
*
* 使用方式:
* 在 Google Sheets 的儲存格中輸入公式 =GetCurrentSheetName()
* 就會顯示當前工作表的名稱。
* 此為 Chatgpt輔助生成的註解
*/
window.addEventListener('pageshow', function (event) {
HoldOn.close();
});
private static Task _TelegramBotClient_OnMessage(Telegram.Bot.Types.Message message, Telegram.Bot.Types.Enums.UpdateType type)
{
if (message.Text==null)
{
return Task.FromResult<object>(null);
}
if (message.Text.ToLower().StartsWith("/"))
{
private static Task _TelegramBotClient_OnUpdate(Telegram.Bot.Types.Update update)
{
if (update.CallbackQuery != null)
{
Console.WriteLine(update.CallbackQuery.From.Id + ":" + update.CallbackQuery.Data);
var sentMessage = _TelegramBotClient.SendMessage(
static TelegramBotClient _TelegramBotClient;
static CancellationTokenSource cts = new CancellationTokenSource();
public static void InitTelegramBotClient()
{
_TelegramBotClient = new TelegramBotClient("1234567890:AAD98dMandhVhEW4jDEu-LTm6fX9MYL9PKU4",httpClient:default,cts.Token);
_TelegramBotClient.OnMessage += _TelegramBotClient_OnMessage;
}
static TelegramBotClient _TelegramBotClient;
static CancellationTokenSource cts = new CancellationTokenSource();
public static void InitTelegramBotClient()
{
_TelegramBotClient = new TelegramBotClient("1234567890:AAD98dMandhVhEW4jDEu-LTm6fX9MYL9PKU4",httpClient:default,cts.Token);
_TelegramBotClient.OnMessage += _TelegramBotClient_OnMessage;
var filePath = AppDomain.CurrentDomain.BaseDirectory + "oooo.jpg";
UploadImageToIPFS(filePath);
static void UploadImageToIPFS(string filePath)
{
var client = new RestClient("https://app.img2ipfs.org/api/v0/add");