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
@cosven
cosven / mac_global_hotkey.py
Last active Jul 25, 2019
OSX global hotkeys via python.
View mac_global_hotkey.py
# -*- coding: utf-8 -*-
"""
Dependency::
pip3 install pyobjc-framework-Cocoa
pip3 install pyobjc-framework-Quartz
Usage::
@cosven
cosven / iterm2-profile-fuo-lyrics-window.json
Created Jul 24, 2019
iTerm2 window as a FeelUOwn Client Window
View iterm2-profile-fuo-lyrics-window.json
{
"Working Directory" : "\/Users\/yinshaowen",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Green Component" : "0",
"Red Component" : "0",
"Blue Component" : "0"
},
"Rows" : 2,
"Ansi 11 Color" : {
@cosven
cosven / .fuorc
Last active Jul 2, 2019
简单的让 feeluown 支持下载 DEMO(请自行安装 feeluown-download)
View .fuorc
# -*- mode: Python; -*-
# vi: ft=python
import os
# 自定义配置
# config.THEME = 'dark'
config.COLLECTIONS_DIR = '~/Dropbox/public/music'
config.AUDIO_SELECT_POLICY = '>>>'
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
View feeluown-slack-status-sync-plugin.py
import asyncio
from functools import partial
from slacker import Slacker
__alias__ = 'Slack 状态同步'
__version__ = '0.1'
__desc__ = 'Slack 状态同步'
@cosven
cosven / mpv_qtwidget_opengl.py
Last active Mar 18, 2019
mpvwidget implemented with PyQt5 and QOpenGLWidget (currently used in http://github.com/cosven/feeluown)
View mpv_qtwidget_opengl.py
"""
Mainly learned from these two example.
- https://github.com/ozmartian/vidcutter/blob/793127c521b18f0bab19b67bc42e8da16a667afd/vidcutter/libs/mpvwidget.py
- https://github.com/mpv-player/mpv-examples/blob/master/libmpv/qt_opengl/mpvwidget.cpp
"""
from PyQt5.QtCore import Qt, QMetaObject, pyqtSlot
from PyQt5.QtWidgets import QOpenGLWidget, QApplication
from PyQt5.QtOpenGL import QGLContext
@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 / 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
You can’t perform that action at this time.