占用CPU很高的进程是:
kworker/0:2+kacpid
查找不正常的中断:
grep . -r /sys/firmware/acpi/interrupts/
gpe09非正常中断,禁用暂时解决:
echo "disable" > /sys/firmware/acpi/interrupts/gpe09
恢复到之前备份的bios不再出现此问题。
发布时间:November 6, 2021 // 分类: // No Comments
占用CPU很高的进程是:
kworker/0:2+kacpid
查找不正常的中断:
grep . -r /sys/firmware/acpi/interrupts/
gpe09非正常中断,禁用暂时解决:
echo "disable" > /sys/firmware/acpi/interrupts/gpe09
恢复到之前备份的bios不再出现此问题。
发布时间:March 5, 2021 // 分类:PT // No Comments
torrent解析类使用https://github.com/Rhilip/Bencode,打补丁支持获取种子hash信息。
--- Bencode.php.1 2021-02-24 07:30:41.677067125 +0800
+++ Bencode.php 2021-03-05 17:52:23.803081067 +0800
@@ -26,6 +26,9 @@
*/
class Bencode
{
+ public function info_hash($data, $info_hash) {
+ return sha1(substr($data, $info_hash['pos'], $info_hash['length']));
+ }
/**
* Decode bencoded data from string
*
@@ -46,7 +49,15 @@
$return = [];
while ($data[$pos] !== 'e') {
$key = self::decode($data, $pos);
+ if (!strcmp($key, "info")) {
+ //if ($key === "info") {
+ $return['info_hash']['pos'] = $pos;
+ }
$value = self::decode($data, $pos);
+ if (!strcmp($key, "info")) {
+ //if ($key === "info") {
+ $return['info_hash']['length'] = ($pos - $return['info_hash']['pos']);
+ }
if ($key === null || $value === null) {
break;
}
@@ -125,6 +136,9 @@
$return = '';
$check = -1;
$list = true;
+ if (isset($data['info_hash'])) {
+ unset($data['info_hash']);
+ }
foreach ($data as $key => $value) {
if ($key !== ++$check) {
$list = false;
解析种子torrent所包含的文件名称信息,将名称和文件大小组合排序并计算sha,sha相同则2个种子内容一样可自动辅种。
<?php
require_once './Bencode.php';
require_once './ParseErrorException.php';
$bencode = new Bencode();
$str = file_get_contents($filename);
$s = $bencode->decode($str);
if (isset($s['info']["files"])) {
foreach ($s['info']["files"] as $v) {
$length = $v["length"];
$file = end($v["path"]);
$save[] = $length.$file;
}
} else {
$length = $s['info']["length"];
$file = $s['info']["name"];
$save[] = $length.$file;
}
if (isset($s["encoding"])) {
$coding = $s["encoding"];
} else {
$coding = mb_detect_encoding(implode('', $save), ['UTF-8', 'GB18030', 'GBK', 'GB2312', 'ISO-8859-1']);
echo 'detect encoding: '.$coding.PHP_EOL;
}
if (!$coding) {
$coding = 'UTF-8';
}
if ($coding != "UTF-8") {
foreach ($save as $k => $v) {
$save[$k] = mb_convert_encoding($v, "UTF-8", $coding);
}
}
sort($save);
$sha1 = sha1(implode('', $save));
发布时间:March 1, 2021 // 分类: // 3 Comments
最近斯巴达vps比较火,一机难求,写了个js脚本用于抢购,效果还不错,推荐使用chrome浏览器,安装Tampermonkey扩展使用。
// ==UserScript==
// @name 自动抢购买vps
// @namespace https://www.haiyun.me
// @version 0.1
// @description buy spartanhost vps
// @author www.haiyun.me
// @match https://billing.spartanhost.net/cart.php?a=*
// @grant none
// ==/UserScript==
(function() {
var forcedReload = false;
var time = 500;
var url = document.URL;
var hostname = "www.haiyun.me";
var customfield = "website";
if (document.title == '502 Bad Gateway') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.title == '504 Gateway Time-out') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.title == '503 Service Temporarily Unavailable') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.title == '500 Internal Server Error') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.getElementsByTagName('h1')[0].innerHTML == '无法访问此网站') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
}
if (url.indexOf("https://billing.spartanhost.net/cart.php?a=add") != -1) {
var str = document.getElementById("order-boxes").innerHTML;
if (str.indexOf("Out of Stock") != -1) {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
}
} else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=confproduct") != -1) {
document.getElementById("inputHostname").value = hostname;
var element = document.querySelector('input[name^="customfield"]');
element.value = customfield;
document.getElementById("btnCompleteProductConfig").click();
} else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=view") != -1) {
document.getElementById("checkout").click();
} else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=checkout") != -1) {
document.getElementById("iCheck-accepttos").click();
document.getElementById("btnCompleteOrder").click();
}
})();
发布时间:February 24, 2021 // 分类: // No Comments
查看网卡名称及编号:
netsh int ipv4 show int
查看当前ip地址:
netsh int ipv4 show ipadd level=verbose
开启dhcp和静态ip共存:
netsh int ipv4 set int "Ethernet0" dhcpstaticipcoexistence=enabled
添加ip地址,skipassource设置是否使用此ip为出口源ip,默认新添加的ip为出口ip:
netsh int ipv4 add add "Ethernet0" 192.168.1.22/24 skipassource=true
已添加的ip修改skipassource参数:
Get-NetIPAddress 192.168.1.22 | Set-NetIPAddress -SkipAsSource $True
Set-NetIPAddress -IPAddress "192.168.1.22" -InterfaceAlias "Ethernet0" -SkipAsSource $false
多网卡可修改路由及网卡metric跃点数指定优先网络出口:
netsh int ipv4 show rou
netsh int ipv4 set int "Ethernet0" metric=2
netsh int ipv4 set rou 0.0.0.0/0 "Ethernet0" 192.168.1.1 metric=100
route change 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 100 if 4