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
on adding folder items to this_folder after receiving added_items | |
set SSCL to "~/Applications/sscl" | |
set theList to added_items as list | |
set theLog to "" | |
do shell script "rm -rf ~/Library/Application\\ Support/SPlayerX/SVPSub/" | |
repeat with theItem in theList | |
set theFile to theItem as alias | |
set thePath to POSIX path of theFile as string | |
tell application "Finder" | |
set theName to the name of theFile |
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
""" Flatten dict and vice versa | |
Authored by: Fang Jiaan ([email protected]) | |
Example: | |
>>> example = {'a': 1, 'b': {}, 'c': {'d': [], 'e': {'f': 0, 'h': u'xxx', 'i': {'j'}, 'k': object()}}} | |
>>> flatten_dict(example) # doctest: +ELLIPSIS | |
{'a': 1, 'b': {}, 'c.d': [], 'c.e.k': <object object at ...>, 'c.e.i': set(['j']), 'c.e.h': u'xxx', 'c.e.f': 0} | |
>>> assert nestify_dict(flatten_dict(example)) == example |
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
# coding: utf-8 | |
# Authorized by: Jiaan Fang <[email protected]> | |
# Blog: https://fangs.work | |
# 本gist为文章 https://fangs.work/sqlalchemy-mapper-inheritance/ 的示例代码 | |
# pip install Flask Flask-SQLAlchemy | |
from sqlalchemy.ext.declarative import ConcreteBase | |
from flask_sqlalchemy import SQLAlchemy |
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
# -*- coding: utf-8 -*- | |
""" | |
Fix the issue 'Error: No data found! Ensure your drives are connected or use "Move Data File To...". To re-download, remove the torrent and re-add it.' | |
caused by disk failure or mistakenly deletion By re-download all the torrents. | |
Make a copy of the "torrents" dir from transmission config dir, the original one will be modified when script is running. | |
Authored by: Fang Jiaan ([email protected]) | |
""" |