Skip to content

Instantly share code, notes, and snippets.

View ysc3839's full-sized avatar

Richard Yu ysc3839

View GitHub Profile
#pragma once
template <typename T, typename TExecutor>
[[nodiscard]] inline auto Promise(TExecutor&& executor) noexcept
using std::coroutine_handle;
struct _Promise
_Promise(TExecutor&& executor) : m_coroHandle(nullptr), m_result(std::nullopt), m_reason()
. /usr/share/libubox/
write_log() {
logger -st natmap-update -p "$1" "$2"
ysc3839 /
Last active May 26, 2024 01:05
Systemd timer for lego

Systemd timer for lego

Place lego.service and lego.service in /etc/systemd/system. Place config in /var/lib/lego and in /var/lib/lego/scripts. You should modify config and Finally execute sudo systemctl enable lego.timer.

Lego's files are stored in /var/lib/lego. You need to create this directory and use lego ... run to create acme account.

I'm using DNS challenge and didn't test HTTP challenge. Please tell me if it works.

# SPDX-License-Identifier: MIT
from ctypes import c_int, POINTER, c_void_p, byref, c_float
from ctypes.wintypes import DWORD
from comtypes import GUID, IUnknown, STDMETHOD, HRESULT, COMMETHOD, CoCreateInstance
EDataFlow_eRender = 0
ERole_eMultimedia = 1
CLSID_MMDeviceEnumerator = GUID('{BCDE0395-E52F-467C-8E3D-C4579291692E}')
local nx_redir = false
function http_date(time)
return'!%a, %d %b %Y %H:%M:%S GMT', time)
function handle_request(env)
local send = uhttpd.send
if env.REQUEST_URI == '/' then -- NintendoWiFi
const SHA1_BLOCK_SIZE = 20
class sha1_ctx
data = array(64, 0);
datalen = 0;
const SHA256_BLOCK_SIZE = 32
class sha256_ctx
data = array(64, 0);
datalen = 0;
#pragma once
// DLGTEMPLATEEX structure
const uint8_t* SkipIDorString(const uint8_t* p)
if (*reinterpret_cast<const uint16_t*>(p) == 0xFFFF)
return p + sizeof(uint16_t) * 2;
while (*reinterpret_cast<const uint16_t*>(p))
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import json, uuid, os, datetime
from datetime import time as tm
from functools import partial
open_utf8 = partial(open, encoding='utf-8')