- 執行以下指令,這會自動尋找所有以
OneDrive開頭的排程工作(包含 Reporting 和 Update),並強制解除註冊(刪除),過程中不會跳出確認提示:
Get-ScheduledTask -TaskName "OneDrive*" | Unregister-ScheduledTask -Confirm:$false
- 查看相關名稱的排程
Get-ScheduledTask -TaskName "OneDrive*"
OneDrive 開頭的排程工作(包含 Reporting 和 Update),並強制解除註冊(刪除),過程中不會跳出確認提示:Get-ScheduledTask -TaskName "OneDrive*" | Unregister-ScheduledTask -Confirm:$false
Get-ScheduledTask -TaskName "OneDrive*"
透過本地群組原則徹底停用(最乾淨)
這個方法可以確保 Defender 在重啟電腦後也不會自動復活。
Win + R 鍵,輸入 gpedit.msc 並按確定,打開「本地群組原則編輯器」。電腦組態 → 系統管理範本 → Windows 元件 → Windows Defender 防毒軟體(或寫為 Endpoint Protection)。7z2601-x64.exe /S
npp.8.9.4.Installer.x64.exe /S
WinSCP-6.5.6-Setup.exe /VERYSILENT /ALLUSERS
# 環境
# 安裝 pkg
> pkg install php82-phar
> service restart php_fpm
# 更新指令
> cd /nextcloud
> sudo -u www php updater/updater.phar
> sudo -u www php occ upgrade
# 檢查系統狀態
> sudo -u www php occ status
ping -t 8.8.8.8 | ForEach-Object { "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $_" } | Tee-Object -FilePath "ping_log.txt"
> ss -nlt4
> ss -nlt6
> ss -nlt
https://docs.librenms.org/Installation/Install-LibreNMS/
sudo apt install acl curl fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php-cli php-curl php-fpm php-gd php-gmp php-json php-mbstring php-mysql php-snmp php-xml php-zip rrdtool snmp snmpd unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip whois traceroute
sudo useradd librenms -d /home/librenms -M -r -s “$(which bash)”
cd /home
sudo git clone https://github.com/librenms/librenms.git
sudo chown -R librenms:librenms /home/librenms
sudo chmod 771 /home/librenms
sudo setfacl -d -m g::rwx /home/librenms/rrd /home/librenms/logs /home/librenms/bootstrap/cache/ /home/librenms/storage/
sudo setfacl -R -m g::rwx /home/librenms/rrd /home/librenms/logs /home/librenms/bootstrap/cache/ /home/librenms/storage/
sudo su - librenms
./scripts/composer_wrapper.php install —no-dev
exit
sudo vi /etc/php/8.1/fpm/php.ini
sudo vi /etc/php/8.1/cli/php.inidate.timezone = Asia/Taipeisudo timedatectl set-timezone Asia/Taipei
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
在[mysqld]下一行加入以下兩行
innodb_file_per_table=1
lower_case_table_names=0
sudo systemctl enable mariadb
sudo systemctl restart mariadb
sudo mysql_secure_installation
sudo mysql -u root
輸入以下SQL Command
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY '[yourpassword]';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
exit
sudo cp /etc/php/8.1/fpm/pool.d/www.conf /etc/php/8.1/fpm/pool.d/librenms.conf
sudo vi /etc/php/8.1/fpm/pool.d/librenms.conf
[www]改成[librenms]
[librenms]
user = librenms
group = librenms
listen = /run/php-fpm-librenms.sock
sudo vi /etc/nginx/conf.d/librenms.conf
server {
listen 80;
server_name [yourdomain or ip];
root /home/librenms/html;
index index.php;
charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm-librenms.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
sudo rm /etc/nginx/sites-enabled/default
sudo systemctl restart nginx
sudo systemctl restart php8.1-fpm
sudo ln -s /home/librenms/lnms /usr/bin/lnms
sudo cp /home/librenms/misc/lnms-completion.bash /etc/bash_completion.d/
sudo cp /home/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
sudo vi /etc/snmp/snmpd.conf
找到 RANDOMSTRINGGOESHERE 改成 public(或自已想要的)sudo curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
sudo chmod +x /usr/bin/distro
sudo systemctl enable snmpd
sudo systemctl restart snmpd
sudo cp /home/librenms/dist/librenms.cron /etc/cron.d/librenms
sudo vi /etc/cron.d/librenms
將所有的路徑裡的資料夾opt改成home
sudo cp /home/librenms/dist/librenms-scheduler.service /home/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
sudo systemctl enable librenms-scheduler.timer
sudo systemctl start librenms-scheduler.timer
sudo vi /etc/systemd/system/librenms-scheduler.service
將所有的路徑裡的資料夾opt改成home
sudo cp /home/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
sudo vi /home/librenms/.env
DB_HOST= localhost
DB_DATABASE= librenms
DB_USERNAME= librenms
DB_PASSWORD= [yourpassword]
sudo su - librenms
lnms migrate
php artisan key:generate
php artisan config:clear
php artisan config:cache
exit
sudo chown librenms:librenms /home/librenms/config.php
sudo su - librenms
cd /home/librenms
./validate.php
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" -Name SpecialPollInterval -Value 3600
w32tm /unregister
w32tm /register
net start w32time
w32tm /config /manualpeerlist:"time.stdtime.gov.tw" /syncfromflags:manual /update
w32tm /resync
w32tm /query /status
輸出瀏覽器資訊
document.getElementById("showbrowser").innerHTML = navigator.userAgent;
<div id='showbrowser'></div>
確認各家瀏覽器
var isChrome = (navigator.userAgent.indexOf("Chrome") > -1) && (navigator.userAgent.indexOf("Safari") > -1);
var isIOSChrome = navigator.userAgent.indexOf("CriOS") > -1;
var isAndroidChrome = (navigator.userAgent.indexOf("Android") > -1) && (navigator.userAgent.indexOf("Chrome") > -1) && (navigator.userAgent.indexOf("Safari") > -1);
var isMacOSSafari = (navigator.userAgent.indexOf("Macintosh") > -1) && (navigator.userAgent.indexOf("Safari") > -1);
var isiPhoneSafari = (navigator.userAgent.indexOf("iPhone") > -1) && (navigator.userAgent.indexOf("Safari") > -1);
var isEdge = (navigator.userAgent.indexOf("Chrome") > -1) && (navigator.userAgent.indexOf("Safari") > -1) && (navigator.userAgent.indexOf("Edg") > -1);
var isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
安裝了windows 10 20H2,怎麼按windows update都不會出現21H2的更新,所以上網找了一下解法。
到以下微軟網站下載Windwos10更新小幫手,然後執行更新即可
之前在同步nextcloud時,發現有些檔案沒有修改日期
在command line下看時間都是1970/1/1,導致資料同步失敗
後來發現,只要檔案有更新,就會恢復同步的功能
所以研究了powershell,將所有檔案(包含子資料夾)的修改日期為1970/1/1的列出
然後將現在時間寫入lastwritetime欄位。
以下為powershell程式碼
# 取得檔案清單
$list = get-childitem -recurse -path "D:\NextCloud" | where-object {$_.LastWriteTime.Year -eq "1970"} | %{$_.FullName}
#變更修改日期
foreach($file in $list){(get-item $file).LastWriteTime =(get-date)}
# 更新系統
> sudo apt update
> sudo apt upgrade
> sudo apt dist-upgrade
# 抓取script
> wget https://raw.githubusercontent.com/yu210148/gvm_install/master/install_gvm.sh
> chmod +x install_gvm.sh
# 執行script
> sudo ./install_gvm.sh -v 21 -a -u
建立conda環境
> conda create --name chatterbot python=3.6
啟動環境
> conda activate chatterbot
安裝chatterbot及語料庫
> pip install chatterbot
> pip install chatterbot_corpus
安裝spacy
* 沒有安裝的話,執行範例的時候會出現錯誤
> pip install spacy==2.1.8
> python -m spacy download en
範例
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
# Create a new chat bot named Charlie
chatbot = ChatBot('Charlie')
trainer = ListTrainer(chatbot)
trainer.train([
"Hi, can I help you?",
"Sure, I'd like to book a flight to Iceland.",
"Your flight has been booked."
])
# Get a response to the input text 'I would like to book a flight.'
response = chatbot.get_response('I would like to book a flight.')
print(response)
參考網站:https://chatterbot.readthedocs.io/en/stable/examples.html
指令
switch#conf t
switch#crypto key zeroize
switch#crypto key generate rsa general-keys modulus 2048
switch#end
switch#wr
連線時出現的錯誤訊息
Unable to negotiate with 192.168.0.1 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
修改後的連線方式
ssh -o KexAlgorithms=+diffie-hellman-group1-sha1 -c aes256-cbc user@192.168.0.1
參考網站
https://www.libellux.com/openvas/#install-openvas-20-08-centos
== 更新 CentOS ==
server@centos:~$ sudo yum -y update
== 關閉root可以登入ssh ==
server@centos:~$ sudo nano /etc/ssh/sshd_config
PermitRootLogin no
server@centos:~$ sudo systemctl restart sshd.service
server@centos:~$ sudo yum update
server@centos:~$ sudo nano /etc/ssh/sshd_config
PermitRootLogin no
server@centos:~$ sudo systemctl restart sshd.service
server@centos:~$ sudo yum update
== 查看SELinux狀態 ==
server@centos:~$ sudo sestatus
SELinux status: enabled
== 關閉SELinux ==
server@centos:~$ sudo setenforce 0
server@centos:~$ sudo nano /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
== 重新開機 ==
server@centos:~$ sudo shutdown -r now
== 再次確認SELinux狀態 ==
server@centos:~$ sudo sestatus
SELinux status: disabled
== 安裝 wget ==
server@centos:~$ sudo yum install wget
== download the Atomicorp installer ==
server@centos:~$ wget -q -O - https://updates.atomicorp.com/installers/atomic | sudo sh
For supported software packages please contact us at:
sales@atomicorp.com
Do you agree to these terms? (yes/no) [Default: yes] yes
Enable repo by default? (yes/no) [Default: yes]: yes
== Enable PowerTools and install extra packages ==
server@centos:~$ sudo yum config-manager --set-enabled PowerTools
server@centos:~$ sudo yum install epel-release
== 安裝 gvm ==
server@centos:~$ sudo yum install gvm
== 更新及設定admin密碼(這個跑很久) ==
server@centos:~$ sudo gvm-setup
== 進入網站 ==
https://127.0.0.1/
https://ipv4/
https://[ipv6]/
路徑
"C:\Users\Duck\AppData\Local\Google\Chrome\Application\chrome.exe"
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
| --proxy-server=myproxy:3128 | 設定proxy |
| --incognito | 無痕模式 |
| --kiosk | 啟動時全螢幕(F11無效) |
| --disable-pinch | 禁止兩指縮放螢幕 |
| --overscroll-history-navigation=0 | 禁止螢幕滑動 |
| --disable-javascript | 禁止javascript |
| --disable-ipv6 | 禁止ipv6 |
| --disable-desktop-notifications | 禁止提示 |
| --disable-audio | 禁止audio |
啟動VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm {name / uuid}
背景啟動VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm {name / uuid} --type headless
列出所有的VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms
列出所有執行中的VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms
暫停VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm {name / uuid} pause
啟動暫停的VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm {name / uuid} resume
重設VM
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm {name / uuid} reset
強制關機
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm {name / uuid} poweroff
關機
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm {name / uuid} acpipowerbutton
查看VM裡的IP設定 (需安裝agent)
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestproperty get {name / uuid} "/VirtualBox/GuestInfo/Net/0/V4/IP"