Skip to content

Instantly share code, notes, and snippets.


cosven cosven

View GitHub Profile
View goroutine.txt
This file has been truncated, but you can view the full file.
goroutine 3620521 [running]:
runtime/pprof.writeGoroutineStacks(0x40a8ae0, 0xc00827fdc0, 0x0, 0x0)
/usr/local/go/src/runtime/pprof/pprof.go:679 +0x9d
runtime/pprof.writeGoroutine(0x40a8ae0, 0xc00827fdc0, 0x2, 0x13951e6, 0xc009e2b340)
/usr/local/go/src/runtime/pprof/pprof.go:668 +0x44
runtime/pprof.(*Profile).WriteTo(0x5a60da0, 0x40a8ae0, 0xc00827fdc0, 0x2, 0xc00827fdc0, 0xd)
/usr/local/go/src/runtime/pprof/pprof.go:329 +0x3da
net/http/pprof.handler.ServeHTTP(0xc011b55991, 0x9, 0x40fd480, 0xc00827fdc0, 0xc001003400)
/usr/local/go/src/net/http/pprof/pprof.go:245 +0x33a
cosven / i_generation.c
Created Oct 15, 2020
get file inode number and inode generation number
View i_generation.c
#include <stdint.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int main (int argc, char **argv) {
cosven /
Created May 15, 2020
def add_download_action(ctx):
from fuocore import aio
from fuocore.models import ModelType, SearchType
global app
def sample(models):
for model in models:
if model.meta.model_type ==
# -*- mode: Python; -*-
# vi: ft=python
import json
import os
import threading
from functools import partial
config.AUDIO_SELECT_POLICY = 'sq>>>'
cosven /
Last active Feb 25, 2020
一个方便测试 sql 的脚本,配合 ipython notebook 使用味道更佳...
这个脚本的好处:运行 sql 并能看到 sql 的输出,输出格式类似 mysql client
i j
1 3
(1062, "Duplicate entry '1' for key 'PRIMARY'")
i j
1 2
cosven / test.markdown
Created Feb 15, 2020
cmd 支持不同格式输出 - 方案性能对比
View test.markdown

简单的测试了下时间,目前 4k 首歌曲,大概是这么个情况。

In [16]: start = time.time()
    ...: get_dumper('json').dump(songs)
    ...: print(time.time() - start)

In [17]: start = time.time()
    ...: get_dumper('json').dump(songs)
cosven /
Last active Feb 10, 2020
profiling playlist_add fuocore.SongModel
import cProfile
from fuocore.models import SongModel
songs_10k = [SongModel(identifier=i) for i in range(0, 4000)]
songs = []
def playlist_add(song):
if song not in songs:
cosven /
Created Feb 6, 2020
FeelUOwn YouTube provider
import os
import time
import json
import subprocess
from fuocore.provider import AbstractProvider
from fuocore.models import SongModel
no_proxy_list = [
cosven /
Last active Oct 28, 2020
导出网易云音乐歌单到 fuo 文件
1. 在 FeelUOwn 中登录网易云
2. fuo exec <
from fuo_netease import provider
from fuocore.models.uri import reverse
from fuocore.cmds.helpers import show_song
cosven /
Created Nov 14, 2019
parse sql statements from general logs
#!/usr/bin/env python3
import re
def get_key_value(key, line):
"""get key's value in log line"""
p = re.compile(r'\[{}\='.format(key))
m =
if m is None:
You can’t perform that action at this time.