merge
This commit is contained in:
45
README.md
45
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}
|
||||
|
||||
Reference in New Issue
Block a user