Linux kernal update and turn on the TCP BBR

Linux内核升级与开启TCP BBR Reference: https://github.com/iMeiji BBR 目的是要尽量跑满带宽,并且尽量不要有排队的情况,效果并不比速锐差。 Linux kernel 4.9+ 才支持 tcp_bbr。下面简单讲述基于 KVM 架构的 virtual p server 如何开启。 附: OpenVZ 架构VPS开启BBR(容易导致判定滥用ban机,慎用!) Debian/Ubuntu TCP BBR 魔改版(不支持4.13.*及更新的内核) Debian 8+ / Ubuntu 14.04 下载最新内核,最新内核查看这里 http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16/linux-image-4.16.0-041600-generic_4.16.0-041600.201804012230_amd64.deb 安装内核 dpkg -i linux-image-4.*.deb 删除旧内核(可选) dpkg -l | grep linux-image apt-get purge <旧内核> 更新 grub 系统引导文件并重启 update-grub reboot Ubuntu 16.04 安装 Hardware Enablement Stack (HWE),自动更新内核 apt install --install-recommends linux-generic-hwe-16.04 删除旧内核(可选) sudo apt autoremove CentOS 6 下载更换内核,最新内核查看这里 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install kernel-ml -y 查看内核是否安装成功 rpm -qa | grep kernel 删除旧内核(可选) rpm -ev <旧内核> 更新 grub 系统引导文件并重启 sed -i 's:default=.

READ MORE

Fixing Kernel headers not found for target kernel error when Installing VirtualBox Guest Additions

Fixing VirtualBox Guest Additions: Kernel headers not found for target kernel OS system for testing: CentOS7 1. why this error: The version of kernel-devel does not match the version of your running kernel. You can check them by running uname -r and rpm -q kernel-devel. 2. update the kernel follow the link or do the following: # yum update -y # rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org # yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm # yum --disablerepo="*" --enablerepo="elrepo-kernel" list available # yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y #or: # yum –-enablerepo=elrepo-kernel install kernel-lt-devel kernel-lt -y # reboot After update the kernel, you can find the not-the-newest version of kernel.

READ MORE

Across folders' module calling in python

Across folders’ module calling in python This topic involves understainding: how Py modules system works organizing your proj. files’ structure using the appropriate import systements 1. Proj. Structure 1.1 Packages and Modules ❤️A module is a Python file containing code and definitions. A module is just a Python program that ends with .py extension ❤️A package is a directory that contains a special __init__.py file, making it a Python package. A folder that contains a module becomes a package. see:

READ MORE

The URL tricks to download YouTube videos

The URL tricks to save YouTube offline The ways below show you the most direct method to download YouTube videos by changing URL without any software. Try any of them as you need. Method 1: Change YouTube to ssyoutube youtube.com/watch?v=C6MVEwl0ceI&t=2s -> ssyoutube.com/watch?v=C6MVEwl0ceI&t=2s Method 2: Change YouTube to youpak youtube.com/watch?v=C6MVEwl0ceI&t=2s -> youpak.com/watch?v=C6MVEwl0ceI&t=2s Method 3: Change YouTube to youtubepp youtube.com/watch?v=C6MVEwl0ceI&t=2s -> youtubepp.com/watch?v=C6MVEwl0ceI&t=2s Method 4: Change YouTube to pwnyoutubepp youtube.com/watch?v=C6MVEwl0ceI&t=2s -> pwnyoutube.com/watch?v=C6MVEwl0ceI&t=2s FAQ: Are there any video quality restrictions when downloading from YouTube

READ MORE

3 Ways to Convert Python App into APK

3 Ways to Convert Python App into APK When you write an android app with python (see how to), with packages like kivy, it is suffering that convert your Python code into installable/runable APK file for real mobile Android devices. This blog is borrowing Kaustubh Gupta’s blog and is re-edited to introduce the 3 ways to obtain the APK from Python Android app code. 1. The challege we need to package the python code properly, otherwise, Python apps build with Kivy cannot be directly transferred to android devices.

READ MORE

Example of Reverse Proxy Configuration - Nginx & Caddy

Example of Nginx Reverse Proxy Configuration server { listen 80; listen [::]:80; server_name <your_server_name>; rewrite ^(.*)$ https://$host$1 permanent; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name <your_server_name>; ssl_certificate /path/to/ssl_cert; ssl_certificate_key /path/to/ssl_cert_key; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://127.0.0.1:9000/; } } Example of Caddy Reverse Proxy Configuration # This is a comment yourdomain.

READ MORE

Custom IPython Notebook keyboard shortcut to duplicate current line in edit mode

Custom IPython Jupyter Notebook keyboard shortcut to duplicate current line in edit mode For Microsoft Windows User (pcDefault) Create a new JS file under ~/.jupyter/custom/custom.js if it does not exist, and add the next code: /** * * Duplicate a current line in the Jupyter Notebook * Used only CodeMirror API - https://codemirror.net * **/ CodeMirror.keyMap.pcDefault["Ctrl-Down"] = function(cm){ // get a position of a current cursor in a current cell var current_cursor = cm.doc.getCursor(); // read a content from a line where is the current cursor var line_content = cm.

READ MORE

Medical Image Preprocessing with python

1. Load data and get to know the meta data import pydicom raw_medical_image = pydicom.read_file(file_path) print(raw_medical_image) medical_image = raw_medical_image.pixel_array plt.imshow(medical_image, cmap='gray') # cmap -- color map 2. Five steps of processing 2.1 Transforming to HU: obtain the HU by using Rescale_Intercept and Rescale_Slope headers: hu_image = image * medical_image.RescaleSlope + medical_image.RescaleIntercept #window_image: img_min = window_center - window_width // 2 img_max = window_center + window_width // 2 window_image = image.copy() window_image[window_image < img_min] = img_min window_image[window_image > img_max] = img_max 2.2 Removing Noises segmentation = morphology.

READ MORE

基于pycomm3包的Ethernet/IP协议的python实现

基于pycomm3包的Ethernet/IP协议的python实现 Ethernet/IP(EIP)协议的通信python实现,用pycomm3包进行支持。 Ethernet/IP 协议可能要求包含的功能:隐式报文通信、显示报文通信 (Explicit 讯息通信)、支持UCMM 及Class3 如果您需要创建Ethernet/IP协议的自定义实现,则通常需要研究Ethernet/IP规范、处理低级套接字通信、消息编码和解码、消息的组装和拆解以及各种其他特定于协议的细节。这是一项复杂的任务,需要对网络协议和编程有扎实的理解。在大多数情况下,建议使用现有的库或工具来节省时间并确保可靠的通信。 Ethernet/IP 协议的从头实现比较复杂,但是也有相关的库可以调用。比如 python 的 pycomm3。 pycomm3库抽象了许多Ethernet/IP协议的复杂性,但是了解协议的概念和结构对于有效地使用库并排除可能出现的任何问题仍然很重要。 Here’s a basic example of how you might use it to communicate with an Ethernet/IP device: $ pip install pycomm3 #====== python通信代码:========= from pycomm3 import LogixDriver # Create a LogixDriver instance with LogixDriver('192.168.1.100') as plc: # replace '192.168.1.100' with the actual IP address of your device # Read tag values tag_values = plc.read('Tag1', 'Tag2') # adjust the tag names and values as needed # Write tag values plc.

READ MORE

My first Hugo post

Below is installing and creating a hugo site with theme=fluency with operations like: hugo new site sonictl.github.io cd sonictl.github.io git submodule add https://github.com/wayjam/hugo-theme-fluency.git themes/fluency echo "theme = 'fluency'" >> hugo.toml hugo server by following this https://gohugo.io/getting-started/quick-start/ add blog content: **directly add a .md file in content/posts ** or ask hugo to creat one post: hugo new posts/my-first-post.md this create a new file under content/posts Note the draft value in the front matter of your post. if its value == true, You can run either of the following commands to include draft content.

READ MORE