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 scrapy | |
from scrapy.http import TextResponse | |
import json | |
class BiliSpider(scrapy.Spider): | |
name = 'bili' | |
allowed_domains = ['www.bilibili.com', "api.bilibili.com"] | |
start_urls = [ |
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
#define PY_SSIZE_T_CLEAN | |
#include <Python.h> | |
static binaryfunc origin = NULL; | |
static PyObject * | |
new_func(PyObject *self, PyObject *other) | |
{ | |
return PyLong_FromLong(1); |
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
""" | |
Copyright (c) 2008-2021 synodriver <[email protected]> | |
""" | |
import numpy as np | |
YIELD_STRESS = 400 # 屈服强度400Mpa | |
def main(): | |
data = np.loadtxt("data.csv", delimiter=",") # 读取应力应变曲线 第一列应力 第二列应变 |
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
function main(splash, args) | |
assert(splash:go(args.url, nil, { | |
["Cookie"] = args.cookie | |
})) | |
assert(splash:wait(1)) | |
local element = splash:select("#accessCode") | |
local ok, reason = element:send_text("glib") -- 输入提取码 | |
if not ok then | |
return reason |
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
""" | |
Copyright (c) 2008-2022 synodriver <[email protected]> | |
""" | |
import asyncio | |
from pathlib import Path | |
from watchfiles import Change, awatch | |
async def main(): |
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
#ifndef _UNISTD_H | |
#define _UNISTD_H | |
#include <io.h> | |
#include <process.h> | |
#endif |
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 sys | |
import hashlib | |
md = hashlib.md5() | |
with open(sys.argv[1], "rb") as f: | |
while chunk := f.read(60 * 1024): | |
md.update(chunk) | |
print(md.hexdigest()) |
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
def safe_eval(c): | |
allow_func = {"print": print, "input": input} | |
bytecode = compile(c, "", "eval") | |
for name in bytecode.co_names: | |
if name not in allow_func: | |
raise Exception(f"not allowed function: {name}") | |
return eval(bytecode, {"__builtins__": {}}, allow_func) |
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
async def app2(scope, receive, send): | |
if scope["type"] == "http": | |
# request = Request(scope, receive) | |
# body = await request.body() | |
# print(body) | |
await send( | |
{ | |
"type": "http.response.start", | |
"status": 200, | |
"headers": [ |
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
# -*- coding: utf-8 -*- | |
import ctypes | |
from collections import namedtuple | |
from ctypes import wintypes | |
# import win32process | |
class MODULEENTRY32W(ctypes.Structure): | |
_fields_ = [ | |
("dwSize", wintypes.DWORD), |
OlderNewer