Steps to reproduce:
Download azw3.txt, epub.txt, mobi.txt and pdf.txt at https://al.chirmyram.com/doc/平台/zlibrary-cn/.
Then run
python3 .\parse.py azw3
python3 .\parse.py epub
| #include <vector> | |
| #include <string> | |
| #include <numeric> | |
| auto prettify(std::vector<std::string> const& v) { | |
| return "[" | |
| + (v.empty() ? "" : ("'" + v.front() + "'" | |
| + std::accumulate( v.begin() + 1, v.end(), std::string(), | |
| [](std::string& s, auto const & t){ return std::move(s) + ", '" + t + "'";} ))) | |
| + "]"; |
| from urllib.parse import urlparse, urljoin, parse_qsl, urlencode | |
| class URLSearchParams: | |
| def __init__(self, options: str = '', hook = None) -> None: | |
| self.hook = hook | |
| if type(options) is str: | |
| if len(options) == 0: | |
| self.l = list() | |
| else: | |
| self.l = parse_qsl(options[1:] if options[0] == '?' else options) |
| #include <algorithm> | |
| #include <string> | |
| #include <iostream> | |
| template<typename IntType> | |
| class fraction { | |
| IntType A; | |
| IntType B; | |
| public: | |
| static IntType gcd(IntType x, IntType y) { |
Steps to reproduce:
Download azw3.txt, epub.txt, mobi.txt and pdf.txt at https://al.chirmyram.com/doc/平台/zlibrary-cn/.
Then run
python3 .\parse.py azw3
python3 .\parse.py epub
| import csv | |
| with open('items.csv') as f: | |
| items = [{ | |
| 'sales': int(i['sales']), | |
| 'cost': float(i['cost']), | |
| 'price': float(i['price']), | |
| } for i in csv.DictReader(f, skipinitialspace=True)] | |
| tot_sales = sum([i['sales'] for i in items]) |
Last modified: March 22, 2024
Looks like a undocumented API call mentioned here can do this.
For getting Universal SSL settings for a Zone (API documentation):
| import { formatBytes } from 'https://base64.muc.moe/assets/js/common/20240430/util.ts' | |
| const endpoint = 'http://127.0.0.1:9876' // || 'http://localhost:8080'; | |
| const username = 'admin'; | |
| const password = 'adminadmin'; | |
| const mainDataUrl = new URL('/api/v2/sync/maindata', endpoint); | |
| const torrentPeersUrl = new URL('/api/v2/sync/torrentPeers', endpoint); | |
| const banPeers = new URL('/api/v2/transfer/banPeers', endpoint); | |
| async function login(username: string, password: string) { |
| export default { | |
| /** | |
| * Default fetch event handler | |
| * @param request {Request} | |
| * @param env | |
| * @param ctx | |
| * @returns {Promise<Response>} | |
| */ | |
| async fetch(request, env, ctx) { | |
| const url = new URL(request.url); |