View class_decorator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Refer to https://kaitohh.com/building-a-class-decorator/ for a complete tutorial | |
from functools import wraps, partial | |
def NamedLogger(cls=None, name='default Logger'): | |
if cls is None: | |
return partial(NamedLogger, name=name) | |
@wraps(cls, updated=()) # see https://stackoverflow.com/a/65470430/7620214 | |
class ClassWrapper: |
View qr_generator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qrcode | |
import sys | |
import json | |
import base64 | |
print(sys.argv[1]) | |
with open(sys.argv[1]) as fp: | |
document = json.load(fp) | |
method = document['method'] | |
hostname = document['server'] |
View douyu_gift_stat.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste these code snippets into browser console of anyone of anchor and you will get live statistic of received gift | |
// some function can be used to adjust behaviour, see the code below | |
var giftCnt = {}; | |
var msgMonitor; | |
var showTableFlag = true; | |
var req = require("shark/lang/observer").on("mod.chat.msg.msg", function(e) { | |
if (!e) return; | |
var msg = jQuery(e).find(".chat-msg-item").text(); | |
var gift = jQuery(e).find(".gift-name").text(); | |
var combo = jQuery(e).find(".hy-org").text(); |
View color.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub color() | |
Application.ScreenUpdating = False | |
Dim i As Long | |
Dim color | |
'rainbow color | |
color = Array(8388736, 255, 33023, 65535, 65280, 16776960, 16711680) | |
With ActiveDocument | |
For i = 1 To .Characters.Count | |
.Characters(i).Font.color = color(i Mod 7) | |
Next |