This file contains hidden or 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
class OuSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = m.Ou | |
fields = ['code', 'name', 'full_name', 'p_ou__code', 'memo'] | |
p_ou__code = serializers.SlugRelatedField('code', source='p_ou', read_only=True) |
This file contains hidden or 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
list_filter = [ | |
('id', RangeNumericFilter), | |
AutocompleteFilterFactory('摄像头', 'cam_algo__cam'), | |
AutocompleteFilterFactory('算法', 'cam_algo__algo'), | |
AutocompleteFilterFactory('通道加载算法', 'cam_algo'), | |
'source_type', | |
('created', DateRangeFilter), | |
] | |
This file contains hidden or 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
// 功能 | |
// 1. 自动点确定 | |
// 2. 自动点人脸验证的确定 | |
// 3. 播完一集自动播放下一集 | |
// 4. 如果视频中间有锁,会自动从最后一个不是100%的视频开始播放 | |
// 5. 可以重复执行。如果忘了自己执行过没有,就放心的多粘几次吧。 | |
var clickindex = null | |
if (typeof (run1) == 'undefined') { | |
var run1 = setInterval(() => { | |
// 自动确认播放弹窗 |
This file contains hidden or 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
# centos 修复脚本 | |
ps -elf|grep salt|awk '{print $4}' | xargs kill -9 | |
for i in /var/spool/cron/*;do sed -i "/wget/d" $i;sed -i "/salt/d" $i;done | |
systemctl stop salt-minion | |
systemctl disable salt-minion | |
systemctl stop salt-master | |
systemctl disable salt-master | |
This file contains hidden or 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 run {input, parameters} | |
tell application "Finder" | |
set screenResolution to bounds of window of desktop | |
end tell | |
set screenWidth to item 3 of screenResolution | |
set screenHeight to item 4 of screenResolution | |
set theApp to (path to frontmost application as Unicode text) |
This file contains hidden or 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 time | |
import watchdog.events | |
import watchdog.observers | |
class Handler(watchdog.events.PatternMatchingEventHandler): | |
def __init__(self): | |
# Set the patterns for PatternMatchingEventHandler | |
watchdog.events.PatternMatchingEventHandler.__init__(self, patterns=['*.rst'], |
This file contains hidden or 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
from IPython import embed;embed() |
This file contains hidden or 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
function findGetParameter(parameterName) { | |
var result = null, | |
tmp = []; | |
location.search | |
.substr(1) | |
.split("&") | |
.forEach(function (item) { | |
tmp = item.split("="); | |
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); | |
}); |
This file contains hidden or 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
def get_fields(self, request, obj=None): | |
if not obj: | |
# 新增页面的字段 | |
fields = ['name', 'company', 'project'] | |
else: | |
# 修改页面的字段 | |
fields = super().get_fields(request, obj) | |
return fields |
This file contains hidden or 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
def get_changeform_initial_data(self, request): | |
init = super().get_changeform_initial_data(request) | |
init['company'] = get_user_last_company(request.user) | |
return init |
NewerOlder