docker desktop starting… stuck windows 10 卡住了
win10 , cmd ,执行命令 netsh winsock reset ,然后重启电脑解决
https://forums.docker.com/t/docker-start-failed-on-windows-10-an-error-occured/108093
Later equals never , just do now !
win10 , cmd ,执行命令 netsh winsock reset ,然后重启电脑解决
https://forums.docker.com/t/docker-start-failed-on-windows-10-an-error-occured/108093
step 1. openwrt登录后台,然后系统-TTYD终端,通过 df -h 命令查询内存占用情况
1 2 3 4 5 6 7 8 9 10 11 12 |
df -h udev 512.0K 0 512.0K 0% /dev tmpfs 181.0M 120.0K 180.9M 0% /run /dev/mmcblk2p2 960.0M 872.7M 100.0K 100% / tmpfs 905.1M 20.7M 884.4M 2% /tmp tmpfs 512.0K 0 512.0K 0% /dev cgroup 905.1M 0 905.1M 0% /sys/fs/cgroup /dev/mmcblk2p4 4.5G 352.0K 4.2G 0% /mnt/mmcblk2p4 /dev/mmcblk2p1 511.0M 88.6M 422.4M 17% /boot /dev/mmcblk2p3 960.0M 3.4M 947.0M 0% /mnt/mmcblk2p3 /dev/mmcblk2p4 4.5G 352.0K 4.2G 0% /mnt/mmcblk2p4/docker |
step 2. 通过 cd / ,进入 /dev/mmcblk2p2 挂载的 / 根目录下,然后通过 du -sh [文件夹] 查询每个文件夹的占用情况
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
cd / ls -l root@OpenWrt:/mnt/sda1/pt# cd / root@OpenWrt:/# ls -l drwxr-xr-x 1 root root 668 Sep 17 2022 bin drwxrwxrwx 3 root root 4096 Jan 1 1970 boot drwxr-xr-x 10 root root 2900 May 9 01:54 dev drwxr-xr-x 1 root root 2798 May 8 23:23 etc drwxr-xr-x 1 root root 6 Sep 17 2022 home drwxr-xr-x 1 root root 746 Sep 17 2022 lib lrwxrwxrwx 1 root root 4 Sep 17 2022 lib64 -> lib/ drwxr-xr-x 1 root root 44 May 9 01:54 mnt drwxr-xr-x 1 root root 32 Sep 17 2022 opt drwxr-xr-x 1 root root 0 Sep 17 2022 overlay dr-xr-xr-x 264 root root 0 Jan 1 1970 proc drwxr-xr-x 1 root root 0 Sep 17 2022 rom drwxr-xr-x 1 root root 164 Jan 2 23:09 root drwxr-xr-x 7 root root 140 May 8 23:24 run drwxr-xr-x 1 root root 956 Sep 17 2022 sbin dr-xr-xr-x 14 root root 0 Jan 1 1970 sys drwxrwxrwt 29 root root 860 May 9 02:00 tmp drwxrwxr-x 1 root root 54 Sep 17 2022 usr lrwxrwxrwx 1 root root 4 Sep 17 2022 var -> tmp/ drwxr-xr-x 1 root root 176 Apr 13 08:52 www root@OpenWrt:/# du -sh mnt 405.2M mnt root@OpenWrt:/mnt/sda1/pt# cd /mnt/sda1/pt root@OpenWrt:/mnt/sda1/pt# du -sh Guardians.of.the.Galaxy.Vol.3.2023.1080p.V3.Clean,Cam.No.Ads.X264.Will1869/ 404.8M Guardians.of.the.Galaxy.Vol.3.2023.1080p.V3.Clean,Cam.No.Ads.X264.Will1869/ |
step 3. 最终定位到是由于 qbitorrent 重启后,自定义下载目录失效导致下载到 /mnt/sda1/pt 下,将里面qbitorrent下载的碎片删除后正常
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
root@OpenWrt:/mnt/sda1/pt# rm -rf Guardians.of.the.Galaxy.Vol.3.2023.1080p.V3.Clean,Cam.No.Ads.X264.Will1869 root@OpenWrt:/mnt/sda1/pt# df -h Filesystem Size Used Available Use% Mounted on udev 512.0K 0 512.0K 0% /dev tmpfs 181.0M 120.0K 180.9M 0% /run /dev/mmcblk2p2 960.0M 467.3M 405.0M 54% / tmpfs 905.1M 20.7M 884.4M 2% /tmp tmpfs 512.0K 0 512.0K 0% /dev cgroup 905.1M 0 905.1M 0% /sys/fs/cgroup /dev/mmcblk2p4 4.5G 352.0K 4.2G 0% /mnt/mmcblk2p4 /dev/mmcblk2p1 511.0M 88.6M 422.4M 17% /boot /dev/mmcblk2p3 960.0M 3.4M 947.0M 0% /mnt/mmcblk2p3 /dev/mmcblk2p4 4.5G 352.0K 4.2G 0% /mnt/mmcblk2p4/docker |
step 4. 奇怪的是 /mnt/sda1/pt 本来是移动硬盘的挂载点,但是这里却没看到硬盘挂载成功,重启 openwrt 后正常。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
root@OpenWrt:~# df -h Filesystem Size Used Available Use% Mounted on udev 512.0K 0 512.0K 0% /dev tmpfs 181.0M 120.0K 180.9M 0% /run /dev/mmcblk2p2 960.0M 467.4M 404.9M 54% / tmpfs 905.1M 20.6M 884.6M 2% /tmp tmpfs 512.0K 0 512.0K 0% /dev cgroup 905.1M 0 905.1M 0% /sys/fs/cgroup /dev/mmcblk2p4 4.5G 352.0K 4.2G 0% /mnt/mmcblk2p4 /dev/mmcblk2p1 511.0M 88.6M 422.4M 17% /boot /dev/mmcblk2p3 960.0M 3.4M 947.0M 0% /mnt/mmcblk2p3 /dev/sda1 3.6T 3.5T 117.2G 97% /mnt/sda1 /dev/mmcblk2p4 4.5G 352.0K 4.2G 0% /mnt/mmcblk2p4/docker |
step 5. 打开 qbitorrent WEB界面,确保 qbitorrent 中,设置-选项-下载
1. 默认 Torrent 管理模式 , 为 自动
2. 默认保存路径为 /mnt/sda1/pt
3. 勾选 保存未完成的 torrent 到 /mnt/sda1/pt
1. SwitchyOmega 中的auto switch模式中添加规则
域名通配符 *.google* 你的代理
保存后,重启浏览器
2. 打开谷歌浏览器,输入 chrome://sync-internals/
先点击 Stop Sync(Keep Data),然后再点击 Request Start
或者再点击一下 Trigger GetUpdates
数据量太大,使用TP6中chunk分块批量处理数据,而且需要使用多字段分组后批量处理。
使用 mysql 原生查询后,发现分组后的数据量有132298 rows。
1 |
select goods_id,goods_type,stu_id from kk_stu_node_progress where goods_type = 6 group by goods_id,goods_type,stu_id order by stu_id; |
使用chunk进行批量处理,发现一共处理了130398 rows。一共少处理了1900 行数据。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$total = Db::table('table_name')->field('concat_ws(",",goods_id,goods_type,stu_id) as kk') ->where('goods_type', 6) ->group('goods_id,goods_type,stu_id') ->select() ->toArray(); $total = array_column($total, 'kk'); Db::table('table_name')->field('goods_id,goods_type,stu_id')->where('goods_type', 6) ->group('goods_id,goods_type,stu_id')->chunk(100, function ($nodes) use (&$total) { foreach ($nodes as $node) { $value = $node['goods_id'] . ',' . $node['goods_type'] . ',' . $node['stu_id']; $total = array_diff($total, [$value]); file_put_contents(app_path('..') . 'data-1.txt', json_encode($node) . PHP_EOL, FILE_APPEND); } }, 'stu_id', 'asc'); file_put_contents(app_path('..') . 'data-1-diff.sql', json_encode($total) . PHP_EOL, FILE_APPEND); |
查看 chunk 源码,并打印关键逻辑
可以看出,chunk中的第二次开始查询下一批数据时,是根据 $lastId 来进行了排序后查找,chunk 这个方法,传入的分组条件,也就是 $column ,最好是一个确定唯一的条件。默认会使用主键。像这样如果多字段group by后,存在多个部分字段重复的情况,也就不建议使用 chunk 方法了。
1 2 3 4 5 6 7 8 9 10 11 12 |
$total = Db::table('table_name')->field('goods_id,goods_type,stu_id') ->where('goods_type', 6) ->group('goods_id,goods_type,stu_id') ->select() ->toArray(); while (!empty($total)) { //每次取出100个 $_sub = array_splice($total, 0, 100); foreach ($_sub as $node) { //处理数据 } } |
DNS污染
Step1. 查看 raw.githubusercontent.com ip地址,通过 https://www.ipaddress.com/ 来查看
Step2. 修改本地Hosts 文件,199.232.96.133 raw.githubusercontent.com
js中加密代码如下:
1 2 3 4 5 6 7 8 |
function encrypt(src, cryptoKey) { var key = window.CryptoJS.enc.Utf8.parse(cryptoKey); var encPassword = window.CryptoJS.AES.encrypt(src, key, { mode: window.CryptoJS.mode.ECB, padding: window.CryptoJS.pad.Pkcs7 }); return encPassword.ciphertext.toString().toUpperCase(); } |
php中相应代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/** * 加密字符串 */ function encrypt($data, $key) { $chiperRaw = openssl_encrypt($data, 'AES-128-ECB', $key, OPENSSL_RAW_DATA); return strtoupper(bin2hex($chiperRaw)); } /** * 解密字符串 */ public function decrypt($string, $key) { return openssl_decrypt(hex2bin($string), 'AES-128-ECB', $key, OPENSSL_RAW_DATA); } |
特别注意 bin2hex 、hex2bin 这个函数,
hex2bin() 函数把十六进制值的字符串转换为 ASCII 字符。
bin2hex() 函数把 ASCII 字符的字符串转换为十六进制值。
Happy new year,2020!
错误:MY_SOME_SIMPLME
正确:MY-SOME-SIMPLME
Nginx会将带有下划线的header头给清除掉
1 2 3 4 5 6 7 8 9 |
// Provide the body as a string. $response = $http->request('POST', $api . '?' . $build_query_data, [ 'headers' => ['Content-Encoding' => 'gzip'], 'body' => gzencode(json_encode($query)) ]); $result = json_decode($response->getBody(), true); $statusCode = $response->getStatusCode(); |
近期评论