Skip to content

Instantly share code, notes, and snippets.

View cosven's full-sized avatar
🍊

Shaowen Yin cosven

🍊
View GitHub Profile
@cosven
cosven / blur_widget.py
Created June 29, 2023 16:02
PyQt5 blur widget
class BlurWidget(QWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
effect = QGraphicsBlurEffect(self)
effect.setBlurRadius(120)
self.setGraphicsEffect(effect)
self.parent().installEventFilter(self)
@cosven
cosven / main.py
Last active May 12, 2022 02:20
macOS nowplaying implemented in pyobjc
from Foundation import NSRunLoop, NSMutableDictionary, NSObject
from MediaPlayer import MPRemoteCommandCenter, MPNowPlayingInfoCenter
from MediaPlayer import (
MPMediaItemPropertyTitle, MPMediaItemPropertyArtist,
MPMusicPlaybackState, MPMusicPlaybackStatePlaying, MPMusicPlaybackStatePaused
)
class No
@cosven
cosven / main.swift
Created May 11, 2022 08:01
macOS nowplaying for FeelUOwn
import Foundation
import MediaPlayer
import Network
let cmdCenter = MPRemoteCommandCenter.shared()
cmdCenter.togglePlayPauseCommand.addTarget{ (e) -> MPRemoteCommandHandlerStatus in
return .success
}
import Foundation
import MediaPlayer
import Network
let cmdCenter = MPRemoteCommandCenter.shared()
cmdCenter.togglePlayPauseCommand.addTarget{ (e) -> MPRemoteCommandHandlerStatus in
return .success
}
@cosven
cosven / xiami_to_fuo_collection.py
Last active January 5, 2021 05:38
导出虾米歌单到 ~/.FeelUOwn/collections 目录并自动刷新 UI,运行方式:fuo exec < xiami_to_fuo_collection.py
import os
from tomlkit import document, value, dumps
from fuocore.models.uri import reverse
from fuo_xiami import provider
user = provider._user
if user is None:
raise Exception('你可能没有登录')
@cosven
cosven / demo.py
Last active December 8, 2020 15:15
feeluown models v2 - demo
from typing import List
class SongDisplayModel:
pass
class SongModel:
pass
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
cosven / i_generation.c
Created October 15, 2020 02:48
get file inode number and inode generation number
#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
cosven / .fuorc.py
Created May 15, 2020 14:30
右键找相似
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 == ModelType.song:
print(str(model))
@cosven
cosven / .fuorc.py
Created May 13, 2020 16:41
example
# -*- mode: Python; -*-
# vi: ft=python
import json
import os
import threading
from functools import partial
config.AUDIO_SELECT_POLICY = 'sq>>>'