若依Django框架soft-delete导致的数据查询异常

 

在model中定义一个设备分组:

class DeviceGroup(CoreModel):
    name = models.CharField(blank=False, null=False, max_length=64, help_text='名称')
    dept = models.ForeignKey(Dept, blank=True, null=True, on_delete=models.CASCADE, help_text='部门')
    parent = models.ForeignKey('self', null=True, blank=True, related_name='children', verbose_name='上级分组',
                               on_delete=models.SET_NULL)
    is_root = models.BooleanField(default=False, help_text='是否根目录')
    index = models.IntegerField(default=0, help_text='排序索引')
    function_field = models.JSONField(blank=True, null=True, help_text='默认代码')
    function_text = models.TextField(blank=True, null=True, help_text='默认代码文本')
    is_show = models.BooleanField(default=True, help_text='是否显示')

Continue Reading

爱看美女网爬虫【群辉Docker】【23.03.02】

在群辉下通过pyinstaller编译py文件会出现各种问题。首先是没有binutils,如果要安装这个工具包,需要安装包管理器ipkg。在确定系统处理器架构之后即可安装对应的包管理下,命令如下:

wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/stable/syno-i686-bootstrap_1.2-7_i686.xsh
chmod +x syno-i686-bootstrap_1.2-7_i686.xsh
sh syno-i686-bootstrap_1.2-7_i686.xsh

安装完成之后即可通过ipkg进行包管理了,

ipkg install binutils

Continue Reading

Python生成Pdf报告

生成报告这个功能应该也有很多办法。因为我不会前端相关的开发,所以只能尝试用python来生成pdf报告。在实际使用的过程中发现现有的操作pdf的库体验都不是很好。所以改变策略尝试两步来实现pdf生成:

1.通过jinja2库操作doc文档根据模板生成相关的word文档

2.通过openoffice或者其他的命令行工具生成pdf,这是常规做法。还有另外一个办法就是通过oss的pdf转换功能生成pdf,这么做的好处是生成完了直接可以顺便生成一个下载链接,可以直接使用。

Continue Reading

美女图片整理【异常图片】

由于爬虫比较多,有的爬虫在下载的时候没有处理网络问题或者图片本山链接错误导致的图片异常。有的是处理了的,不要问为什么没加异常检测,问就是懒。

下载的图片会出现下面的问题,其实预览的时候就会发下问题了,另外打开这个图片其实会显示404或者502之类的错误页面。所以写了一段处理代码,主要两个功能:

1.删除小文件,至于多小自己去调整代码
2.如果目录下所有的文件都有问题,删除文件后同时删除目录

Continue Reading

ubuntu性能监视工具glances

Glances is a cross-platform monitoring tool which aims to present a maximum of information in a minimum of space through a curses or Web based interface. It can adapt dynamically the displayed information depending on the terminal size.

It can also work in client/server mode. Remote monitoring could be done via terminal, Web interface or API (XMLRPC and RESTful).

Glances is written in Python and uses the psutil library to get information from your system.

Stats can also be exported to external time/value databases.

Continue Reading

重新安装msi center

之前因为性能问题卸载了dragon center,这个是msi center的前身可以认为。官方是这么介绍的:

DragonCenter是微星的一款集系统监测,LED灯光调节,系统环境设置。Dragon Center可以看作是Dragon Gaming Center的升级版,除了在UI界面上 进行了修改之外,在功能上也由原来的系统监测功能基础上增加了超频,灯光控制

不过这个破软件,做的那是真烂。上次见到这么烂的软件还是三星的kies客户端,感兴趣的可以搜一下。作为一个软件能做到这么烂,我觉得没有几个人能做到了。今天看杜老师发了篇文章,说设置灯光,于是又想起来这个破软件了。不过这次没从官网下直接从微软商店下载的。

Continue Reading

m3u8 downloader [23.03.04][Windows]

更新记录:
1.修复txt文件url列表格式下载导致的windows下的文件名命名错误
m3u8_downloader.exe
****************************************************************************************************
Verson: 23.03.04
m3u8_downloader -i <input m3u8 link> -o <output file> -p <out put path> -f <input file> -m <ffmpeg path>
Need Arguments:
         -i <input m3u8 link>
Option Arguments:
         -o <output file> -p <out put path> -f <input file>
         -m <ffmpeg path>
ffmpeg:F:\Pycharm_Projects\m3u8_downloader\dist\m3u8_downloader\bin/ffmpeg.exe
Blog: http://www.h4ck.org.cn
Source Code: http://h4ck.org.cn/2020/01/基于ffmpeg的m3u8下载/
****************************************************************************************************

Continue Reading