Skip to content

Instantly share code, notes, and snippets.

View prnake's full-sized avatar
发电

papersnake prnake

发电
View GitHub Profile
@prnake
prnake / union_find.rs
Created February 24, 2024 17:04
UnionFind
#![allow(unused)]
//! 并查集:解决节点连接/关联问题
use std::fs::File;
use std::io::{self, Read, Write};
use std::path::Path;
use std::slice;
fn load_vector<T>(path: &Path) -> io::Result<Vec<T>>
where
const Parser = require('rss-parser');
const translate = require('translation-google');
module.exports = async (ctx) => {
const parser = new Parser();
const baseUrl = 'https://export.arxiv.org/rss/cs';
const feed = await parser.parseURL(baseUrl);
const tempItem = [];
feed.items.length = 100;
@prnake
prnake / cuda_check.py
Created October 31, 2022 16:17 — forked from f0k/cuda_check.py
Simple python script to obtain CUDA device information
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Outputs some information on CUDA-enabled devices on your computer,
including current memory usage.
It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1
from C to Python with ctypes, so it can run without compiling anything. Note
that this is a direct translation with no attempt to make the code Pythonic.
from lxml import etree
import requests
import html2text
from bs4 import BeautifulSoup
import codecs
def request_get(url):
session = requests.Session()
headers = {
'User-Agent': 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36'}
#EXTINF:-1 tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/NHK_General_TV_logo.svg/1920px-NHK_General_TV_logo.svg.png" group-title="Japan",NHK G
http://203.162.235.41:16903
#EXTINF:-1 tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7a/NHK_Educational_TV_logo.svg/1200px-NHK_Educational_TV_logo.svg.png" group-title="Japan",NHK ETV
http://203.162.235.41:16901
#EXTINF:-1 tvg-logo="https://upload.wikimedia.org/wikipedia/commons/6/6d/NHKBS1%E3%83%AD%E3%82%B42020-.png" group-title="Japan", NHK BS 1
http://203.162.235.41:16909
#EXTINF:-1 tvg-logo="https://vignette.wikia.nocookie.net/logopedia/images/8/87/Q1_%281%29.jpg" group-title="Japan", NHK BS Premium
http://203.162.235.41:16910
#EXTINF:-1 tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Mainichi_Broadcasting_System_logo.svg/1200px-Mainichi_Broadcasting_System_logo.svg.png" group-title="Japan",MBS
http://203.162.235.41:16907
name: 重定向
desc: 常用HTTPS重定向
http:
mitm:
- g.cn
- "*.google.cn"
- "api.abema.io"
- "www.firefox.com.cn"
- "*.mox.moe"
@prnake
prnake / cf-ddns.sh
Created February 22, 2022 05:45
CloudFlare DDNS
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# curl https://raw.githubusercontent.com/yulewang/cloudflare-api-v4-ddns/master/cf-v4-ddns.sh > /usr/local/bin/cf-ddns.sh && chmod +x /usr/local/bin/cf-ddns.sh
@prnake
prnake / BilibiliMangaDownload.py
Last active November 16, 2021 10:54
Bilibili漫画下载
# Source: https://github.com/LaMP57/BilibiliMangaDownload
# 支持从连续使用多个账号的网页版 SESSDATA,或者使用单个手机抓包得到的 Token,自动购买/解锁章节,验证下载图片完整性连续下载一本漫画的所有章节的功能。
import json
import os
import re
import requests
import zipfile
from io import BytesIO
from PIL import Image
Python 2 hrs 17 mins ████████████▌░░░░░░░░ 59.5%
Other 1 hr █████▌░░░░░░░░░░░░░░░ 26.3%
Text 14 mins █▎░░░░░░░░░░░░░░░░░░░ 6.4%
SSH Config 11 mins █░░░░░░░░░░░░░░░░░░░░ 5.1%
YAML 3 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.5%