This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", (event) => { | |
event.respondWith( | |
handleRequest(event.request).catch( | |
(err) => new Response(err.stack, { status: 500 }) | |
) | |
); | |
}); | |
async function handleRequest(request) { | |
const { host, pathname } = new URL(request.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", (event) => { | |
event.respondWith( | |
handleRequest(event.request).catch( | |
(err) => new Response(err.stack, { status: 500 }) | |
) | |
); | |
}); | |
async function handleRequest(request) { | |
const url = getUrl(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.10 | |
# -*- coding: utf-8 -*- | |
import asyncio | |
import sys | |
import importlib | |
from functools import reduce | |
from typing import Any | |
def import_from_string(import_str: str) -> Any: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
is_windows_path = lambda path: bool(re.compile(r"^[a-zA-Z]:").match(path)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Visual Studio Code Server | |
After=network.target | |
[Service] | |
Type=exec | |
Restart=always | |
User=%i | |
ExecStart=dbus-run-session -- sh -c "(echo 'somecredstorepass' | gnome-keyring-daemon --unlock) && /usr/local/bin/code-server serve-local --accept-server-license-terms --connection-token=somecredstorepass" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload: | |
- '+.youtube.be' | |
- '+.youtube.ch' | |
- '+.youtube.co' | |
- '+.youtube.co.id' | |
- '+.youtube.com' | |
- '+.youtube.com.bd' | |
- '+.youtube.com.co' | |
- '+.youtube.com.do' | |
- '+.youtube.com.ee' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import html | |
import inspect | |
import os | |
import traceback | |
from baize.typing import ASGIApp, Message, Receive, Scope, Send | |
from baize.asgi import Request, Response, HTMLResponse, PlainTextResponse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Ai } from './vendor/@cloudflare/ai.js'; | |
export default { | |
async fetch(request, env) { | |
const ai = new Ai(env.AI); | |
// prompt - simple completion style input | |
// let simple = { | |
// prompt: 'Tell me a joke about Cloudflare' | |
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ThreadPoolExecutor | |
import gc | |
import multiprocessing | |
import queue | |
import signal | |
import threading | |
import time | |
from typing import Callable, ParamSpec | |
from loguru import logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
import threading | |
from typing import Any | |
class WriteCache(metaclass=abc.ABCMeta): | |
def __init__(self, max_size: int = 100, min_time: float = 1) -> None: | |
self.max_size = max_size | |
self.min_time = min_time |