Skip to content

Instantly share code, notes, and snippets.

View ysc3839's full-sized avatar

Richard Yu ysc3839

View GitHub Profile
@ysc3839
ysc3839 / README.md
Last active May 10, 2026 21:29
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 nginx-example.com.sh in /var/lib/lego/scripts. You should modify config and nginx-example.com.sh. 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.

HMODULE hUser = GetModuleHandleA("user32.dll");
if (hUser)
{
pfnSetWindowCompositionAttribute setWindowCompositionAttribute = (pfnSetWindowCompositionAttribute)GetProcAddress(hUser, "SetWindowCompositionAttribute");
if (setWindowCompositionAttribute)
{
ACCENT_POLICY accent = { ACCENT_ENABLE_BLURBEHIND, 0, 0, 0 };
WINDOWCOMPOSITIONATTRIBDATA data;
data.Attrib = WCA_ACCENT_POLICY;
data.pvData = &accent;
@ysc3839
ysc3839 / ITrayNotify.cpp
Created October 12, 2017 14:26
Undocumented API ITrayNotify.
#include <tchar.h>
#include <windows.h>
// The known values for NOTIFYITEM's dwPreference member.
enum NOTIFYITEM_PREFERENCE
{
// In Windows UI: "Only show notifications."
PREFERENCE_SHOW_WHEN_ACTIVE = 0,
// In Windows UI: "Hide icon and notifications."
PREFERENCE_SHOW_NEVER = 1,
class ProcessNameSetter:
instance = None
@classmethod
def register(cls):
if cls.instance is not None:
return
try:
cls.instance = cls()
import multiprocessing.util
#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()
#!/bin/sh
. /usr/share/libubox/jshn.sh
write_log() {
logger -st natmap-update -p "$1" "$2"
}
RRTYPE=A
ZONE="example.com"
import zipfile
import os
import re
import sys
import cStringIO as StringIO
from Tkinter import *
from ttk import *
import thread
# Request https SSL error workaround
# 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}')
@ysc3839
ysc3839 / padavan_mod.py
Last active May 9, 2020 14:23
MiWiFi R3 Firmware Mod
import sys, os
from zlib import crc32
from shutil import copyfileobj
from struct import calcsize
from io import SEEK_END
### uImage Header
### 64-byte header structure:
### uint32 magic_number
### uint32 header_crc
from ctypes import windll, create_unicode_buffer, c_void_p, c_uint, c_wchar_p
kernel32 = windll.kernel32
GlobalLock = kernel32.GlobalLock
GlobalLock.argtypes = [c_void_p]
GlobalLock.restype = c_void_p
GlobalUnlock = kernel32.GlobalUnlock
GlobalUnlock.argtypes = [c_void_p]
user32 = windll.user32