首页
关于
Search
1
git lg彩色显示日志
28 阅读
2
在 Ubuntu 22.04 LTS 中安装 Docker
19 阅读
3
CentOs/Ubuntu搭建上网x-ui
18 阅读
4
git使用多个源和多个分支
15 阅读
5
清理Windows臃肿程序
15 阅读
默认分类
网站搭建
Windows
Linux
Docker
OpenWrt
Hackintosh
Git
Python
Web开发
JavaScript
FFmpeg
Demo
工具
刷机
油猴脚本
Excel
Chrome Extension
登录
Search
标签搜索
Pandas
读取
时区
Chrome
centos8
求和
Nginx
Typecho
404
csv
国际站
询盘导出
油猴脚本
bbr
Ubuntu
远程桌面
日志
log
数据清洗
打印机
野生程序猿
累计撰写
153
篇文章
累计收到
0
条评论
首页
栏目
默认分类
网站搭建
Windows
Linux
Docker
OpenWrt
Hackintosh
Git
Python
Web开发
JavaScript
FFmpeg
Demo
工具
刷机
油猴脚本
Excel
Chrome Extension
页面
关于
搜索到
153
篇与
的结果
2023-02-02
Windows上搭建Rsync服务
一、Windows搭建Rsync服务1.Windows上安装cwRsyncServer_4.1.0_Installer(最后一个免费版本)目录下修改C:\Program Files (x86)\ICW\rsyncd.confuse chroot = false strict modes = false hosts allow = * log file = rsyncd.log uid = 0 gid = 0 # Module definitions # Remember cygwin naming conventions : c:\work becomes /cygwin/c/work # [config] path = /cygdrive/d/huixin/DataBaseBak read only = true transfer logging = yes auth users = rsyncuser secrets file = /cygdrive/c/rsync.password2.新建密码文件,内容如下:rsyncuser:1234563.打开 CMD ,进入目录 C:\Program Files (x86)\ICW\bin 查询当前用户,然后输入如下信息,修改权限为仅当前用户C:\Program Files (x86)\ICW\bin>whoami dt4d\marx C:\Program Files (x86)\ICW\bin>chmod.exe -c 600 /cygdrive/i/rsyncd1.password mode of `/cygdrive/i/rsyncd1.password' changed to 0600 (rw-------) C:\Program Files (x86)\ICW\bin>chown.exe marx /cygdrive/i/rsyncd1.password4.重新启动Rsync服务5.防火墙添加入站规则,默认端口为873二、客户端同步文件Linux直接使用rsync命令rsync -av --password-file=/path/to/rsync.password rsync://
[email protected]
:873/config ./bak #增加--delete参数可保证目录完全一致,否则只增加不删除Windows安装客户端cwRsync Client下载链接 类似操作新建密码文件,并修改权限密码文件例如(注意:与服务端不同格式):123456CMD 进入 C:\Program Files (x86)\cwRsync\bin,参考命令#远程同步到本地 ./rsync.exe --port=873 -vzrtopg --progress --password-file=/cygdrive/i/rsyncd.password
[email protected]
::config /cygdrive/i/Temp #本地同步到远程 ./rsync.exe --port=873 -vzrtopg --progress --password-file=/cygdrive/i/rsyncd.password /cygdrive/i/Temp
[email protected]
::config上面/cygdrive/i/Temp 为同步到客户端的目录使用参数 -azh 可仅查看错误:./rsync.exe --port=873 -azh --password-file=/cygdrive/i/rsyncd.password /cygdrive/i/Temp
[email protected]
::config
2023年02月02日
4 阅读
0 评论
0 点赞
2023-01-27
使用qemu镜像格式转换vmdk,img
1.macos下使用brew安装qemubrew install qemu2.转换格式#vmdk转为img qemu-img convert -f vmdk /path/to/src_vmdk.vmdk -O raw /path/to/dest_img.img #img转为vmdk qemu-img convert -f raw /path/to/dest_img.img -O vmdk /path/to/src_vmdk.vmdk
2023年01月27日
3 阅读
0 评论
0 点赞
2023-01-27
解决opkg update失败Signature check failed.
解决办法:删除配置选项option check_signature
2023年01月27日
2 阅读
0 评论
0 点赞
2023-01-26
OpenWrt扩容Overlay,为你的固件增加可用空间
1.cfdisk命令新建分区sda32.格式化sda3分区为ext4,建议新建1G的分区mkfs.ext4 /dev/sda33.挂载分区到/mnt/sda3mount /dev/sda3 /mnt/sda34.复制原有配置到新的分区cp -r /overlay/* /mnt/sda35.进入网页后台,系统->挂载点->挂载刚才分区到overlay6.保存应用,重启
2023年01月26日
2 阅读
0 评论
0 点赞
2022-12-20
Python操作sqlite3数据库
一、概述(1)导入相关库或模块(SQLite3)。(2)使用connect()连接数据库并获取数据库连接对象。它提供了以下方法:.cursor() 方法来创建一个游标对象 .commit() 方法来处理事务提交 .rollback() 方法来处理事务回滚 .close() 方法来关闭一个数据库连接(3)使用con.cursor()获取游标对象。(4)使用游标对象的方法(execute()、executemany()、fetchall()等)来操作数据库,实现插入、修改和删除操作,并查询获取显示相关的记录。在Python程序中,连接函数sqlite3.connect()有如下两个常用参数。database:表示要访问的数据库名。timeout:表示访问数据的超时设定。(5)使用close()关闭游标对象和数据库连接。数据库操作完成之后,必须及时调用其close()方法关闭数据库连接,这样做的目的是减轻数据库服务器的压力。二、使用SQLite3创建表#导入sqllite3模块 import sqlite3 # 1.硬盘上创建连接 con = sqlite3.connect('./first.db') # 获取cursor对象 cur = con.cursor() # 执行sql创建表 sql = 'create table t_person(pno INTEGER PRIMARY KEY AUTOINCREMENT ,pname varchar(30) NOT NULL ,age INTEGER)' try: cur.execute(sql) except Exception as e: print(e) print('创建表失败') finally: # 关闭游标 cur.close() # 关闭连接 con.close() 三、使用SQLite3插入数据调用游标对象的execute执行插入的sql,使用executemany()执行多条sql语句,使用executmany()比循环使用excute()执行多条sql语句效率高。【示例】使用SQLite3插入一条数据#导入sqllite3模块 import sqlite3 # 1.硬盘上创建连接 con = sqlite3.connect('./first.db') # 获取cursor对象 cur = con.cursor() # 执行sql创建表 sql = 'insert into t_person(pname,age) values(?,?)' try: cur.execute(sql,('张三',23)) #提交事务 con.commit() print('插入成功') except Exception as e: print(e) print('插入失败') con.rollback() finally: # 关闭游标 cur.close() # 关闭连接 con.close() 【示例】使用SQLite3插入多条数据#导入sqllite3模块 import sqlite3 # 1.硬盘上创建连接 con = sqlite3.connect('./first.db') # 获取cursor对象 cur = con.cursor() try: #执行sql创建表 sql = 'insert into t_person(pname,age) values(?,?)' cur.executemany(sql, [('张三', 23), ('李四', 25), ('小红', 24), ('小李', 12)]) #提交事务 con.commit() print('插入成功') except Exception as e: print('插入失败') con.rollback() finally: # 关闭游标 cur.close() # 关闭连接 con.close() 四、使用SQLite3查询数据【示例】fetchall()查询所有数据#导入sqllite3模块 import sqlite3 # 1.硬盘上创建连接 con = sqlite3.connect('./first.db') # 获取cursor对象 cur = con.cursor() # 执行sql创建表 sql = 'select * from t_person' try: cur.execute(sql) # 获取所有数据 person_all = cur.fetchall() # print(person_all) # 遍历 for p in person_all: print(p) except Exception as e: print(e) print('查询失败') finally: # 关闭游标 cur.close() # 关闭连接 con.close() 【示例】fetchone()查询一条数据#导入sqllite3模块 import sqlite3 # 1.硬盘上创建连接 con = sqlite3.connect('./first.db') # 获取cursor对象 cur = con.cursor() # 执行sql创建表 sql = 'select * from t_person' try: cur.execute(sql) # 获取一条数据 person = cur.fetchone() print(person) except Exception as e: print(e) print('查询失败') finally: # 关闭游标 cur.close() # 关闭连接 con.close()【示例】修改数据#导入sqllite3模块 import sqlite3 #1.硬盘上创建连接 con=sqlite3.connect('./first.db') #获取cursor对象 cur=con.cursor() try: #执行sql创建表 update_sql = 'update t_person set pname=? where pno=?' cur.execute(update_sql, ('小明', 1)) #提交事务 con.commit() print('修改成功') except Exception as e: print(e) print('修改失败') con.rollback() finally: # 关闭游标 cur.close() # 关闭连接 con.close()五【示例】删除数据#导入sqllite3模块 import sqlite3 #1.硬盘上创建连接 con=sqlite3.connect('./first.db') #获取cursor对象 cur=con.cursor() #执行sql创建表 delete_sql = 'delete from t_person where pno=?' try: cur.execute(delete_sql, (2,)) #提交事务 con.commit() print('删除成功') except Exception as e: print(e) print('删除失败') con.rollback() finally: # 关闭游标 cur.close() # 关闭连接 con.close()
2022年12月20日
1 阅读
0 评论
0 点赞
1
...
21
22
23
...
31