From cf38ec1759c681dc95c57696ac09ca752c16a146 Mon Sep 17 00:00:00 2001 From: Jaewook Lee Date: Fri, 24 Jan 2025 21:01:40 +0900 Subject: [PATCH] merge --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index e49b9e5..5380b91 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,51 @@ def SQL(): sql = SQL() ``` +## tauri + svelte + shadcn +```sh +git clone https://github.com/alysonhower/tauri2-svelte5-shadcn.git +cd tauri2-svelte5-shadcn +bun i +bun run dev -- --host +``` + +## syncify +```py +def sync(coro): + import asyncio, functools, nest_asyncio; nest_asyncio.apply() + return functools.wraps(coro)(lambda *args, **kwargs: + asyncio.run(coro(*args, **kwargs))) + +@sync +async def main(): print('hello'); return 'world' + +main() +``` + +## playwright +```py +@(sync := lambda coro: __import__('nest_asyncio').apply() or + __import__('functools').wraps(coro)(lambda *args, **kwargs: + __import__('asyncio').run(coro(*args, **kwargs)))) +async def Page(): + from playwright.async_api import async_playwright + browser = await (await async_playwright().start()).chromium.launch() + (context := await browser.new_context()).set_default_timeout(0) + for attr in dir(page := await context.new_page()): + if attr[0] != '_' and callable(method := getattr(page, attr)): + setattr(page, attr, sync(method)) + page._repr_png_ = page.screenshot + page.goto = lambda url, goto=page.goto: goto(url) + page.soup = lambda: __import__('bs4').BeautifulSoup(page.content(), 'lxml') + return page +'' +page = Page() +page.goto('https://naver.com') +page +'' +page.soup() +``` + # wireguard ```powershell wg genkey|%{$_;$_|wg pubkey}