Skip to content

Instantly share code, notes, and snippets.

View cosven's full-sized avatar
🍊

Shaowen Yin cosven

🍊
View GitHub Profile
@cosven
cosven / fonts.conf
Created July 17, 2018 17:04
KDE 下 fonts.conf 配置示例,有两个效果:让 chromium 正确的显示中文字体;konsole 正确的显示中文字体,并且支持显示 Emoji
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- <dir>~/.fonts</dir> -->
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif CJK SC</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
@cosven
cosven / gevent_demo.py
Last active October 2, 2018 07:53
how gevent works?
# gevent from the ground up - demo 1
import selectors
import socket
import time
from urllib.parse import urlparse
sel = selectors.DefaultSelector()
@cosven
cosven / feeluown_memory_usage.org
Last active March 2, 2019 18:33
FeelUOwn 内存使用分析

FeelUOwn 内存使用分析

2019-03-03 再次测试结论

NameUsage(MiB)Description
python37启动
mpv37import + init
requests10import
beautifulsoup6import
@cosven
cosven / remote_control.py
Created August 3, 2018 06:51
从网页端控制 feeluown 示例
"""
使用方法
- pip3 install flask # 安装依赖
- python3 remote_control.py # 启动网页,在浏览器
"""
import socket
from flask import Flask, request
@cosven
cosven / nginx.conf
Last active August 22, 2018 13:56
Django 项目部署示例
server {
listen 80;
server_name cosven.me www.cosven.me;
# path for static files
location /static/ {
root /data/static;
}
@cosven
cosven / .dir-locals.el
Last active November 21, 2018 07:57
Emasc Python 项目 .dir-locals.el 示例
((python-mode
;; 激活 pyvenv-mode,也可以自己在 init.el 中默认激活
(eval . (pyvenv-mode))
;; 这个要写绝对路径
(pyvenv-activate . "/Users/cosven/projectpath/.venv")
;; 默认 select python-pylint 这个 checker
;;
@cosven
cosven / mpv_qtwidget_opengl.py
Last active December 15, 2021 23:16
mpvwidget implemented with PyQt5 and QOpenGLWidget (currently used in http://github.com/cosven/feeluown)
# 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 / app.py
Created March 18, 2019 11:49
qt qtableview macOS mojave dark mode bug
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 / gunicorn_demo.py
Last active May 15, 2019 09:53
reinvent the gunicorn
import os
import signal
import socket
import sys
import time
def be_a_worker(sock):
"""将当前进程变成一个 worker
@cosven
cosven / switch-omega
Last active September 18, 2023 02:20
switch omega bypass list
127.0.0.1
172.*.*.*
192.*.*.*
10.*.*.*
82.157.25.86
39.106.86.136
152.136.199.195
::1
localhost
arch