Compare commits
2 Commits
4c569e6be3
...
cf38ec1759
| Author | SHA1 | Date | |
|---|---|---|---|
| cf38ec1759 | |||
| 02a47be16a |
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}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
alias x=pnpx
|
||||
export CLOUDFLARE_API_TOKEN=Pah8Q6hBUsQsKnKhaMJB2QvL-LHAWCcU8xti66Q3
|
||||
dive(){ docker exec -it "$@" bash }
|
||||
dive(){ docker exec -it "$@" sh; }
|
||||
alias reboot='sudo reboot'
|
||||
alias restart='docker restart'
|
||||
export HOMEBREW_NO_ENV_HINTS=true
|
||||
@@ -223,4 +224,3 @@ ign() {
|
||||
|
||||
alias r="redis-cli"
|
||||
q() { "$@" > /dev/null 2>&1 & }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user