taoCMS-基于php+sqlite最小巧的CMS http://www.taocms.org/ taoCMS是基于php+sqlite/mysql的国内最小(100Kb左右)的功能完善、开源免费的CMS管理系统 2023-09-29 taoCMS-基于php+sqlite最小巧的CMS 1266 USB/IP PROJECT USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates "USB I/O messages" into TCP/IP payloads and transmits them between computers.


https://pluhuxc.github.io/2018/11/01/usbip.html

https://blog.csdn.net/cclethe/article/details/128809940
https://github.com/cezanne/usbip-win
https://usbip.sourceforge.net/
https://gitlab.com/alelec/wsl-usb-gui]]>
taoCMS-基于php+sqlite最小巧的CMS 2023-09-14 22:09:18
1265 自定义设置 Linux网络带宽、特定Linux进程网络带宽 There may be cases when you need to limit network bandwidth in Linux. Learn how to limit the network bandwidth in Linux globally and application-specifically with two simple programs: wondershaper and trickle.

 SUBSCRIBE for more Linux Videos

Why limit network bandwidth?

There may be multiple reasons why you need to limit network bandwidth in Linux.

One of our subscribers says that the internet data prices are high where he lives, he wants to limit his network bandwidth to reduce the internet spending. As a former Windows user, he used to run Netlimiter for that. Now, he looks for a Netlimiter alternative in Linux.

Traffic limiting is also useful when the internet speed is low. Applications will compete for the traffic, and setting traffic limits on some applications helps to prioritize how the traffic is used.

In another case, a server admin had to limit the outbound traffic, so that the server will not go down due to heavy activity at peak times.

In this article, you will learn how to limit the network bandwidth in Linux globally and application-specifically with two lightweight and user-friendly applications.

Limiting the bandwidth per network interface with Wondershaper

Wondershaper is a simple command-line utility that can limit the network bandwidth in Linux. It can be configured to limit download and upload speed for each network interface of your Linux machine. Let’s have a look.

Install Wondershaper

To install Wondershaper, search for it in your Linux package manager. It is an open-source application that should be available in all Linux distros. This is the installation I recommend. In Ubuntu and other Debian-based distros, you can run this command:

sudo apt install wondershaper

If you want the latest version of Wondershaper, you can install it from GitHub:

git clone https://github.com/magnific0/wondershaper.git
cd wondershaper
sudo make install

Hopefully, this installation goes without errors for you. It is a less reliable way to install Wondershaper than using the version provided with your distro. I have tested this installation on Ubuntu 20.04.3, it works fine. But if you have problems with the Github version, remove it by running this command from the wondershaper git-cloned directory:

sudo make uninstall

If you decide to keep the GitHub version of Wondershaper, keep in mind that unlike the version included with the distro, it will not update itself when the new version is released. You need to update it manually. You can do it by entering the wondershaper folder, pulling the updates from GitHub, and re-installing:

cd wondershaper
git pull 
sudo make install

If you are a complete Linux newbie, I recommend you learn the basics of the Linux command line.

Learn the syntax of Wondershaper

Depending on the version of wondershaper, it may have a different syntax for configuration. You can check it with the man command:

man wondershaper

It will give you an output similar to this:

Wondershaper man output

It is just a sequence of the interface, download and upload speed limit in my case:

wondershaper [ interface ] [ downlink ] [ uplink ]

More recent versions require specifying the option names:

wondershaper -a [interface] -d [downlink] -u [uplink]

Find out the network interface name

Now, when you know the syntax of wondershaper, you only need to find out the network interface name to set the limits on it. In most modern Linux systems, you can list the available network interfaces with this command:

ip addr show

However, some older systems may require to run ifconfig from net-tools:

sudo apt install net-tools
ifconfig

In my system, I only have the Ethernet interface enp0s3:

ip add show output example

You may also have the Wi-Fi interface listed as wlan0 or similar.

Test Wondershaper

Knowing the network interface name, we can test wondershaper. For example, let’s set the bandwidth limit to 6 MB/s for download, and 1 MB/s to upload on the Ethernet interface enp0s3:

sudo wondershaper enp0s3 6144 1024

Now, you can check if these settings have been applied by testing your internet speed at Speedtest.net. This is the results I get with these settings:

Speedtest results for the example limits

If I clear all the limits:

sudo wondershaper clear enp0s3

And test my internet speed again, I get these values:

Speedtest results with the bandwidth limits removed

Note, if you have both the Wi-Fi and Ethernet connections, make sure you set the limit and test the same interface.

Run Wondershaper persistently

The settings we tested above work only until you reboot your Linux system. To apply the limits persistently, you need to create a systemd configuration and service files for Wondershaper.

Open the configuration file:

sudo nano /etc/systemd/wondershaper.conf

And paste the following content with your interface and limit settings:

[wondershaper]

# Adapter
IFACE="enp0s3"

# Download rate in Kbps
DSPEED="6144"

# Upload rate in Kbps
USPEED="1024"

Then create a service file:

sudo nano /etc/systemd/system/wondershaper.service

With the following content:

[Unit]
Description=Bandwidth shaper/Network rate limiter
After=network-online.target
Wants=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/systemd/wondershaper.conf
ExecStart=/usr/sbin/wondershaper $IFACE $DSPEED $USPEED
ExecStop=/usr/sbin/wondershaper clear $IFACE

[Install]
WantedBy=multi-user.target

Note, if your Wondershaper uses option names, you need to edit the ExecStart and ExecStop lines to:

ExecStart=/usr/sbin/wondershaper -a $IFACE -d $DSPEED -u $USPEED
ExecStop=/usr/sbin/wondershaper -c -a $IFACE

FYI, if you are not familiar with the nano editor, to save the changes press Ctrl+O and to exit press Ctrl+X.

Now, activate Wondershaper to run persistently:

sudo systemctl enable --now wondershaper.service

The Wondershaper will now limit network bandwidth in your Linux even after you reboot your system.

If you want to disable the persistent run of Wondershaper, execute:

sudo systemctl disable --now wondershaper.service

Limiting the bandwidth per application with trickle

Trickle is a lightweight bandwidth shaper that can be used to set the data limits per application. By using the Unix loader preloading, it adds a new version of the data transferring functionality to an application through sockets and then limits traffic by delaying the sending and receiving of data over a socket. Unlike Wondershaper, trickle does not require root privileges, so you do not need to use sudo when you run it.

Install trickle

Trickle is available in most Linux distributions. In Ubuntu, you install it with this command:

sudo apt install trickle

How to use trickle

You can see all available options and how to use trickle with its help message:

trickle -h

trickle help message

In most cases, you only need to set the download/upload limits and the application name:

trickle -d [ download speed ] -u [ upload speed ] [ application/command ]

Here is an example of 6 MB/s limit for download, and 1 MB/s to upload in Firefox:

trickle -d 6144 -u 1024 firefox

You can also set download and upload rates separately if you want to limit only one of them:

trickle -d 6144 firefox

You can also limit network bandwidth for Linux commands. For example, you may want to limit the wget download speed:

trickle -d 512 wget https://releases.ubuntu.com/20.04.3/ubuntu-20.04.3-desktop-amd64.iso

You can also launch bash shell with bandwidth limits for all commands:

trickle -d 6144 -u 1024 bash

To reset the bandwidth limits, simply close the bash with the exit command or Ctrl+Q.

You can also add some advanced settings to your trickle command. You can read the detailed description of each option with the man command:

man trickle

where you can find out, for example, what the smoothing time option does:

The smoothing time determines with what intervals trickle will try to let the application transceive data. Smaller values will result in a more continuous (smooth) session, while larger values may produce bursts in the sending and receiving data. Smaller values (0.1 - 1 s) are ideal for interactive applications, while slightly larger values (1 - 10 s) are better for applications that need a bulk transfer.

trickle with rsync

There is a small difference in using trickle with rsync to copy files over ssh. If you simply put trickle in front of rsync, it will not work because rsync forks the ssh process. Thus, ssh will run without trickle limits. To call rsync with trickle limits, run it like this:

rsync --rsh="trickle -d 6144 -u 1024 ssh" SORCE DESTINATION

Test trickle

We can test trickle similarly as we tested Wondershaper at Speedtest.net. Let’s set the download limits to Firefox and add a small smoothing value as it is an interactive application:

trickle -d 6144 -u 1024 -t 0.1 firefox

These settings result in the following network speed for me:

firefox with trickle limits

You can also test trickle with wget:

trickle -d 512 wget https://releases.ubuntu.com/20.04.3/ubuntu-20.04.3-desktop-amd64.iso

You will see that the speed is limited to 547KB/s:

wget with trickle limits

Apply application-specific limits persistently

Trickle can also be configured to have permanent network bandwidth limits and these limits can be global e.g. for all applications or application-specific. It is done through the trickled daemon.

See its options with the -h or man:

trickled help message

You can set the default bandwidth limits for all applications launched with trickle:

trickled -d 6144 -u 1024 -s

Now, every application you start with trickle application will have these limits and you do not need to specify the maximum upload and download rates. To keep these options permanent after the reboot, you can add this command to your ~/.bashrc or /etc/profile if you want these settings to be active for all users.

To set how these limits are shared by each application, you need to add them to the trickled.conf file. Open the configuration file:

sudo nano /etc/trickled.conf

And add each application in the following format:

[service]
Priority = <value>
Time-Smoothing = <value>
Length-Smoothing = <value>

We have looked at the time smoothing parameter above. The purpose of the length smoothing is the same, the only difference is that it is defined in KB. It is a fallback of the smoothing time option.

The priority parameter defines how the traffic is prioritized across applications. A lower value has a higher priority, and thus applications with a lower value get more bandwidth than the one with the higher value.

Here is an example of how a real trickled.conf file may look like:

[www]
Priority = 1
Time-Smoothing = 1

[ssh]
Priority = 2
Time-Smoothing = 0.1
Length-Smoothing = 2

[ftp]
Priority = 8
Time-Smoothing = 5
Length-Smoothing = 10

Create trickle launchers for graphical apps

Running trickle application in the terminal may not be the most convenient for graphical applications. Luckily, there is also an option to add trickle to the graphical launchers.

Open the launcher configuration file:

sudo nano /usr/share/applications/application.desktop

For example, to edit the Firefox launcher, create a backup copy and open edit the original file:

sudo cp /usr/share/applications/firefox.desktop /usr/share/applications/firefox.desktop.backup
sudo nano /usr/share/applications/firefox.desktop

Find the lines starting with Exec= and edit them by adding trickle to each command. There are three such lines in firefox.desktop:

Exec=trickle -d 6144 -u 1024 firefox %u
...
Exec=trickle -d 6144 -u 1024 firefox -new-window
...
Exec=trickle -d 6144 -u 1024 firefox -private-window

firefox launcher settings file

Now, every time you click on the launcher in the menu, it will start Firefox with this modified command and limited network bandwidth.

If you want to remove these limits, restore the backup copy:

sudo cp /usr/share/applications/firefox.desktop.backup /usr/share/applications/firefox.desktop

Some applications may not have the application.desktop files in /usr/share/applications/. This is the case for AppImages, snap, and flatpak apps. You can easily create a custom launcher for them by following our tutorial on how to create a custom launcher in Linux.

Disable automatic updates

I would like to share with you just one more tip on how to limit the internet traffic in your Linux. You may want to disable automatic updates in your system, so you update less often and when you have access to the faster and cheaper internet connection.

In Ubuntu, you do that by enabling the “Metered connection”:

Settings -> Network -> Wired/Wi-Fi connection settings -> Details -> enable Metered connection

Option to enable Metered connection in Ubuntu

When you need to update your system, you do it manually in the Update Manager or the command line.

Conclusion

I tried to provide simple and clear instructions on how to limit network bandwidth in Linux with Wondershaper and trickle without technical details. I hope these instructions helped you to configure your Linux bandwidth, and it saved you a couple of backs.

If you want to learn more technical things about trickle, you are welcome to read the trickle technical paper. To get more information on Wondershaper, visit the Wondershaper GitHub page.

There is also an option to use the tc command and iptables configuration for traffic shaping, but this is one of the advanced topics which we do not cover on this website. However, you can get an idea of how tc is configured from the Arch Linux Wiki.

If you know more user-friendly tools that can help to limit network bandwidth in Linux, please share them in the comments below.

]]>
taoCMS-基于php+sqlite最小巧的CMS 2023-01-31 02:01:45
1264 Win10如何设置自动登录​(无需输入密码进入windows) ​​如果win10没有给账号设置密码(即密码为空),系统启动的时候会自动进入系统桌面,但是为了安全及隐私有时候又不得不设置一个密码。设置了密码后,每次开机都得输入密码才能进入桌面,那么有时候就要让电脑在开机时自动登录并进入桌面。

(本文不讨论是否应该设密码,也不讨论为什么设置了密码又要弄自动登陆是不是多此一举,只介绍新版的如何设置自动登录)


在以前的系统我们只要运行命令Netplwiz,打开用户账户便可以轻松设置系统自动登录指定的用户。

但是最近几版win10中发现,运行Netplwiz后,发现少了一个【要使用本计算机,用户必须输入用户名和密码】复选框。

因为要设置Win10自动登录指定的用户,需要取消这个复选框后进行配置。所以最好的办法是找回这个复选框来。


找回自动登录复选框的办法

要找回这个复选框其实也很简单,只需要修改注册表的一个小地方即可。

同时按下快捷键Win+R唤出运行窗口,然后输入regedit单击确定。


打开注册表路径HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsNTCurrentVersionPasswordLessDevice


修改下面的DevicePasswordLessBuildVersion值为0,那么再运行Netplwiz,【要使用本计算机,用户必须输入用户名和密码】复选框就又出现了。

找回复选框后,只需要取消勾选,再点【应用】,会弹出自动登陆设置框,输入要自动登陆的账号密码,点确定即可。

总结:其实就是微软将这个复选框给隐藏了。以上便是恢复自动登陆的方法。​​​​

]]>
taoCMS-基于php+sqlite最小巧的CMS 2022-11-21 01:11:15
1263 Gdrive:Linux下同步Google Drive文件、自动备份网站到Google Drive

Gdrive,Linux下上传、下载Google Drive文件的一款CLI工具,安装简单、使用方便。

一、安装Gdrive:(SSH下,基于centos 7)
1、安装

去https://github.com/prasmussen/gdrive/releases下载最新版本,解压后复制到/usr/bin/gdrive
chmod +x /usr/bin/gdrive

2、授权

gdrive about

然后会出现一串网址并询问验证码
gdrive-oauth.jpg

将地址粘贴到浏览器并登陆账号,会返回一串代码
gdrive-oauth-2.jpg

将代码粘贴到SSH下,然后会返回你的账户信息
gdrive-oauth-3.jpg

gdrive程序会自动将你的token保存在用户目录下的.gdrive目录中,所以如果不需要了记得把这个文件删掉

二、使用
常用命令如下,更多查看gdrive官网;gdrive
列出Google Drive根目录下文件、文件夹

gdrive list

下载Google Drive根目录下文件到本地(xxxx为文件名)

gdrive download xxxx

下载Google Drive根目录下文件夹到本地(xxx为文件夹名)

gdrive download xxx

把本地文件上传到Google Drive根目录下(xxxx为文件名)

gdrive upload xxxx

在Google Drive根目录下创建文件夹(xxx为文件夹名)

gdrive mkdir xxx

三、创建网站自动备份脚本,上传文件到Google Drive
1、网站自动备份脚本(基于Mysql数据库)
脚本下载googledrive.sh
修改以下部分:
第3行:my-database-name 改为自己的数据库名
第4行:my-database-user 改为自己的数据库用户名
第5行:my-database-password 改为自己的数据库用户名对应的密码
第7行:zhujiwiki 改为自己的网站目录
第8行:/home/wwwroot 改为自己的网站所在目录(即需备份目录为 /home/wwwroot/zhujiwiki)
第9行:/backups 改为备份文件存放目录
第35行:youremail@yourdomain.com 修改为自己的邮箱

2、更改权限

chmod +x googledrive.sh

3、创建定时任务

vi  /etc/crontab

添加

0 2 * * * /backups/googledrive.sh

以上备份脚本存放在 /backups/ 下,每日2点备份
重启crontab

/etc/init.d/crond restart

四、应用
配合以下博文,可以更合理利用资源。
使用Tumblr爬虫,结合h5ai创建私有视频库、图库
使用VPS创建Tumblr解析站
VPS安装Nextcloud、共享Google Drive、BT下载


]]>
taoCMS-基于php+sqlite最小巧的CMS 2022-10-02 03:10:21
1253 windows上OpenSSH服务安装及启动

GitHub下载链接


我安装的是64位版本


2,解压到C:Program FilesOpenSSH,建议是放在此目录下


3,cmd到openSSH路径下


依次执行


1)安装sshd服务


powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
1
2)开放22号端口(如果你在windows关闭了防火墙并配置了入站规则可以不执行如下命令,多执行不影响)


netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22
1
3)配置开机自启sshd服务


sc config sshd start= auto
1
到此就安装完成,建议将C:Program FilesOpenSSH添加到path中,免得每次都要切到C:Program FilesOpenSS才能使用ssh


4,启动ssh服务


net start sshd
1
5.然后就可以在cmd中连接


ssh 用户名@ip -p 端口
1
连接时注意服务器上的杀毒软件拦截




转自 https://www.cnblogs.com/GoCircle/p/11461151.html




————————————————
版权声明:本文为CSDN博主「Tomcow2021」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Tomcow2021/article/details/121537634]]>
taoCMS-基于php+sqlite最小巧的CMS 2022-07-12 00:07:12
1252 Telegram Bot - how to get a group chat id?
创建机器人:https://www.telegramstr.com/article/120.html

In order to get the group chat id, do as follows:
  1. Add the Telegram BOT to the group.

  2. Get the list of updates for your BOT:

     https://api.telegram.org/bot<YourBOTToken>/getUpdates
    

    Ex:

     https://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdates
    
  3. Look for the "chat" object:

{"update_id":8393,"message":{"message_id":3,"from":{"id":7474,"first_name":"AAA"},"chat":{"id":<group_ID>,"title":""},"date":25497,"new_chat_participant":{"id":71,"first_name":"NAME","username":"YOUR_BOT_NAME"}}}

This is a sample of the response when you add your BOT into a group.

  1. Use the "id" of the "chat" object to send your messages.

  2. (If you created the new group with the bot and you only get {"ok":true,"result":[]}, remove and add the bot again to the group)

  3. Private chart only works in image argoprojlabs/argocd-notifications:v1.1.0 or above.

]]>
taoCMS-基于php+sqlite最小巧的CMS 2022-07-07 16:07:52