Skip to content

Instantly share code, notes, and snippets.

View luliangce's full-sized avatar

50Percent luliangce

  • HangZhou,China
View GitHub Profile
@luliangce
luliangce / async in flask.py
Created March 3, 2021 10:37
在flask使用异步
import asyncio
import time
import httpx
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
@luliangce
luliangce / index.html
Last active December 24, 2023 12:42
Stream subprocess stdout to frontend
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.common.dev.js"></script>
</head>
class Point:
ref = None
operator = None
def __init__(self, x, y):
self._x = x
self._y = y
@property
@luliangce
luliangce / example.py
Created May 19, 2019 08:35
寻找自然分钟内访问量大于100的ip
# https://www.v2ex.com/t/565534#reply8
import random
import datetime
def genlog():
ips = []
for _ in range(100):
ips.append(".".join([
@luliangce
luliangce / chsi_crawler.py
Created May 9, 2019 13:51
一个学信网院校库采集脚本
from typing import Generator, List
import requests
import xlwt
from lxml import etree
base_url = "https://gaokao.chsi.com.cn/sch/search.do"
max_page = 137
session = requests.Session()
session.headers["User-Agent"] = ("Mozilla/5.0"
from functools import reduce
def rm(x, r):
_min = reduce(lambda x, y: x*y, x)
circulate, rest = divmod(r, _min)
r = common = 0
for i in range(1, _min):
for j in x:
if i % j == 0: