Skip to content

Instantly share code, notes, and snippets.

🍊

cosven cosven

🍊
Block or report user

Report or block cosven

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bench_result_analysis.py
import os
import re
from collections import defaultdict
def get_query_per_sec(line):
"""
>>> s = 'queries: 17493427 (58309.95 per sec.)'
>>> get_query_per_sec(s)
@cosven
cosven / switch-omega
Last active Jun 26, 2019
switch omega bypass list
View switch-omega
127.0.0.1
172.*.*.*
::1
localhost
*.bilibili.com
*.baidu.com
*.weibo.com
*.zhihu.com
*.emacs-china.org
*.csdn.com
@cosven
cosven / gunicorn_demo.py
Last active May 15, 2019
reinvent the gunicorn
View gunicorn_demo.py
import os
import signal
import socket
import sys
import time
def be_a_worker(sock):
"""将当前进程变成一个 worker
@cosven
cosven / app.py
Created Mar 18, 2019
qt qtableview macOS mojave dark mode bug
View app.py
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class Model(QAbstractTableModel):
def __init__(self):
super().__init__()
self._data = ['miao', 'hello', 'world']
@cosven
cosven / mpv_qtwidget_opengl.py
Last active Apr 25, 2020
mpvwidget implemented with PyQt5 and QOpenGLWidget (currently used in http://github.com/cosven/feeluown)
View mpv_qtwidget_opengl.py
# BSD 3-Clause License
#
# Copyright (c) 2020, Cosven
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@cosven
cosven / .dir-locals.el
Last active Nov 21, 2018
Emasc Python 项目 .dir-locals.el 示例
View .dir-locals.el
((python-mode
;; 激活 pyvenv-mode,也可以自己在 init.el 中默认激活
(eval . (pyvenv-mode))
;; 这个要写绝对路径
(pyvenv-activate . "/Users/cosven/projectpath/.venv")
;; 默认 select python-pylint 这个 checker
;;
@cosven
cosven / nginx.conf
Last active Aug 22, 2018
Django 项目部署示例
View nginx.conf
server {
listen 80;
server_name cosven.me www.cosven.me;
# path for static files
location /static/ {
root /data/static;
}
@cosven
cosven / remote_control.py
Created Aug 3, 2018
从网页端控制 feeluown 示例
View remote_control.py
"""
使用方法
- pip3 install flask # 安装依赖
- python3 remote_control.py # 启动网页,在浏览器
"""
import socket
from flask import Flask, request
@cosven
cosven / feeluown_memory_usage.org
Last active Mar 2, 2019
FeelUOwn 内存使用分析
View feeluown_memory_usage.org

FeelUOwn 内存使用分析

2019-03-03 再次测试结论

NameUsage(MiB)Description
python37启动
mpv37import + init
requests10import
beautifulsoup6import
@cosven
cosven / gevent_demo.py
Last active Oct 2, 2018
how gevent works?
View gevent_demo.py
# gevent from the ground up - demo 1
import selectors
import socket
import time
from urllib.parse import urlparse
sel = selectors.DefaultSelector()
You can’t perform that action at this time.