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 / 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()
@cosven
cosven / fonts.conf
Created Jul 17, 2018
KDE 下 fonts.conf 配置示例,有两个效果:让 chromium 正确的显示中文字体;konsole 正确的显示中文字体,并且支持显示 Emoji
View fonts.conf
<?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 / table_context_menu.py
Created Jun 30, 2018
feeluown 项目一些废弃代码
View table_context_menu.py
def contextMenuEvent(self, event):
menu = QMenu()
index = self.indexAt(event.pos())
song = self.model().data(index, Qt.UserRole)
if song.album:
show_album_action = QAction('专辑:{}'.format(song.album.name), menu)
show_album_action.triggered.connect(
partial(self.show_album_needed.emit, song.
@cosven
cosven / subtree.py
Created Apr 27, 2018
leetcode subtree visualization
View subtree.py
import random
from graphviz import Digraph
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
@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 / asyncio_douban_zufang.py
Last active Dec 17, 2018
北京豆瓣租房小脚本...
View asyncio_douban_zufang.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
豆瓣租房爬虫
Install:
pip install beautifulsoup4
Usage:
@cosven
cosven / asyncio_socket_server.py
Last active Nov 2, 2017
learning asyncio in practice
View asyncio_socket_server.py
# server made with asyncio
# flake8: noqa
import asyncio
from socket import (socket, AF_INET, SOCK_STREAM, SO_REUSEADDR, SOL_SOCKET)
async def start_server(sock):
server = await loop.create_server(asyncio.Protocol, sock=sock)
@cosven
cosven / models.py
Created Aug 16, 2017
tranditional model definition ways in python
View models.py
"""
there are three typical ways to define a model in python.
"""
# ---------------------------------------------------
# use namedtuple: simple but not flexible or powerful
# ---------------------------------------------------
from collections import namedtuple
View feeluown-slack-status-sync-plugin.py
import asyncio
from functools import partial
from slacker import Slacker
__alias__ = 'Slack 状态同步'
__version__ = '0.1'
__desc__ = 'Slack 状态同步'
You can’t perform that action at this time.