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 mp3_demo.py
#!/usr/bin/python
# -*- coding:utf8 -*-
import chardet
import sys, os
import shutil
from mutagen.mp3 import MP3
import mutagen.id3
from mutagen.id3 import ID3
from mutagen.easyid3 import EasyID3
@cosven
cosven / string_cmp.py
Last active Jul 10, 2016
Python3 字符串比较,很奇怪。
View string_cmp.py
In [33]: os.listdir('.')
Out[33]:
['.DS_Store',
'Closer - Travis.mp3',
'I Really Like You - Carly Rae Jepsen.mp3',
'Love Story - Taylor Swift.mp3',
'Per dimenticare - Zero Assoluto.mp3',
"Sono Bugiarda (I'm A Believer) - Caterina Caselli.mp3",
'The Phoenix - Fall Out Boy.mp3',
'We Are Never Ever Getting Back Together - Taylor Swift.mp3',
View jenkin_slave_connection.log
Feb 21, 2017 11:50:34 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: ci1-mirror
Feb 21, 2017 11:50:34 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Feb 21, 2017 11:50:34 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://ci0.aws.dev:8080/]
Feb 21, 2017 11:50:34 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Feb 21, 2017 11:50:34 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to ci0.aws.dev:36840
@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
@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 / 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 / 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 / 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 / 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 / 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;
}
You can’t perform that action at this time.