2022年4月11日 星期一

clang-format-14 on Ubuntu 20.04 2022

Better

clang-format-14 --version
# Command 'clang-format-14' not found
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" | sudo tee -a /etc/apt/sources.list
apt search clang-format
# clang-format-14/unknown 1:14.0.1~++20220426083040+0e27d08cdeb3
sudo apt install clang-format-14
clang-format-14 --version
# Ubuntu clang-format version 14.0.1-++20220426083040+0e27d08cdeb3


clang-format-14 to clang-format-15 (successful 2023)

clang-format-15 --version
# Command 'clang-format-15' not found, did you mean:
https://askubuntu.com/questions/1409031/how-to-use-a-more-recent-clang-format-or-clang-tidy-version-on-ubuntu-18-04
$ clang-format-15 --version
Ubuntu clang-format version 15.0.7

upgrade clang-10 to to clang-15 on 2023 (successful 2023)

sudo apt-get install clang-15
cd /usr/bin
sudo ln -sfn ../lib/llvm-15/bin/clang++ clang++
sudo ln -sfn ../lib/llvm-15/bin/clang clang


Reference

 https://stackoverflow.com/questions/20756924/how-can-i-install-clang-format-in-ubuntu


wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -

sudo nano /etc/apt/sources.list

append below

# 14
deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main
deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main

sudo apt update

$ apt search clang-format
Sorting... Done
Full Text Search... Done
arcanist-clang-format-linter/focal,focal 0.git20161021-2 all
  clang-format linter for Arcanist

clang-format/focal 1:10.0-50~exp1 amd64
  Tool to format C/C++/Obj-C code

clang-format-10/focal 1:10.0.0-4ubuntu1 amd64
  Tool to format C/C++/Obj-C code

clang-format-11/focal-updates 1:11.0.0-2~ubuntu20.04.1 amd64
  Tool to format C/C++/Obj-C code

clang-format-12/focal-updates,focal-security 1:12.0.0-3ubuntu1~20.04.5 amd64
  Tool to format C/C++/Obj-C code

clang-format-14/unknown 1:14.0.1~++20220407063120+ec13fed5867f-1~exp1~20220407063130.115 amd64
  Tool to format C/C++/Obj-C code

clang-format-6.0/focal 1:6.0.1-14 amd64
  Tool to format C/C++/Obj-C code

clang-format-7/focal 1:7.0.1-12 amd64
  Tool to format C/C++/Obj-C code

clang-format-8/focal 1:8.0.1-9 amd64
  Tool to format C/C++/Obj-C code

clang-format-9/focal 1:9.0.1-12 amd64
  Tool to format C/C++/Obj-C code

sudo apt install clang-format-14

$ clang-format-14 --version
Ubuntu clang-format version 14.0.1-++20220407063120+ec13fed5867f-1~exp1~20220407063130.115
done!

2022年4月2日 星期六

AMD Ryzen 3900x CPU Frequency from 2.2GHz to 3.6GHz Ubuntu 20 cpupower

  https://www.linkedin.com/pulse/how-use-max-cpu-frequency-linux-javad-rajabzade-

 

 AMD Ryzen 3900x CPU Frequency Ubuntu 20 cpupower


sudo apt install linux-tools-common
sudo apt install linux-tools-5.13.0-39-generic
sudo apt install linux-cloud-tools-5.13.0-39-generic

check

$ cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 2.20 GHz - 4.67 GHz
  available frequency steps:  3.80 GHz, 2.80 GHz, 2.20 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 2.20 GHz and 3.80 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 2.20 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no

performance

sudo cpupower frequency-set -g performance

performance after

sudo cpupower frequency-set -g performance
Setting cpu: 0
Setting cpu: 1
...
Setting cpu: 23

$ cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 2.20 GHz - 4.67 GHz
  available frequency steps:  3.80 GHz, 2.80 GHz, 2.20 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 2.20 GHz and 3.80 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.60 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no

ondemand

sudo cpupower frequency-set -g ondemand

 


2022年3月27日 星期日

Intel M.2 Wifi Adaptor 2022

 

CRF

這些 Intel® 無線介面卡是支援 Intel® 整合式連接的 CRF 模組:

    Intel® Wi-Fi 6E AX211
    Intel® Wi-Fi 6 AX201
    Intel® Wireless-AC 9560
    Intel® Wireless-AC 9462
    Intel® Wireless-AC 9461

$ in RMB

2022-03
I bought AC9560NGW at $27 that can reaches 866Mhz with ASUS AC Router.
Sellers said 9260 at $70 with better compatibility with same functions.
Someone sells AX210 with pcie x1 adaptor at $129.

2022-03
I bought AC8260 at $28 with M2 to PCIe x1 at $20.

2022-04

AC8260 on MSI B450M Mortar Max needs to set BIOS PCIe X1 from PCIE_2 to PCIE_3. Ubuntu 20.04 works well with 866MHz. Test Speed with iCable 130MB/s.

Intel

https://ark.intel.com/content/www/tw/zh/ark.html#@Wireless

Inter Killer

AX1675is M.2 2230 M.2 1216 M.2 CNVio2
AX1650is M.2 2230 M.2 1216 M.2 CNVio2
AX1675xw M.2 2230 M.2 1216 PCIe
AX1650xw M.2 2230 M.2 1216 PCIe

Intel Wifi 6E

AX411 M.2 CNVio2
AX211 M.2 2230 M.2 1216 M.2 CNVio2
AX210 M.2 2230 M.2 1216 PCIe

Intel Wifi 6

AX201 M.2 2230 M.2 1216 M.2 CNVio2 $80
AX200 M.2 2230 M.2 1216 PCIe

Intel Wireless 9000

AC9560 M.2 2230 M.2 1216 M.2 CNVio2 $27
AC9462 M.2 2230 M.2 1216 M.2 CNVio2
AC9461 M.2 2230 M.2 1216 M.2 CNVio2
AC9260 M.2 2230 M.2 1216 PCI

Intel Wireless 8000

AC8265 M.2 2230 M.2 1216 PCIe
AC8260 M.2 2230 M.2 1216 PCIe $28

Intel Wireless 7200

AC7265 HMC M.2 2230 M.2 1216 PCIe $35
AC7260 Desktop PCIe $48
AC7260 HMC M.2 2230 M.2 1216 PCIe $28

Intel Wireless 3100

Intel Old Wireless


Intel Driver for Linux

https://www.intel.com/content/www/us/en/support/articles/000005511/wireless.html


2022年3月26日 星期六

Stress test CPU and memory on Ubuntu 20.04

 Stress test CPU and memory on Ubuntu 20.04

 

 psensor

======

https://techhut.tv/monitor-amd-ryzen-temps-in-linux/

 https://wpitchoune.net/psensor/

Ryzen 9 3900x

tctl  51

tdie 58


 not using

======

https://askubuntu.com/questions/1038701/how-do-i-check-system-health

https://askubuntu.com/questions/948854/how-do-i-stress-test-cpu-and-ram-at-the-same-time/948865#948865

sudo apt-get install jq
sudo apt-get install curl


2022年3月17日 星期四

Open VPN Ubuntu 20.04 focal

 https://openvpn.net/cloud-docs/openvpn-3-client-for-linux/


sudo apt install apt-transport-https

sudo wget https://swupdate.openvpn.net/repos/openvpn-repo-pkg-key.pub

sudo apt-key add openvpn-repo-pkg-key.pub

sudo wget -O /etc/apt/sources.list.d/openvpn3.list https://swupdate.openvpn.net/community/openvpn3/repos/openvpn3-focal.list

sudo apt update

sudo apt install openvpn3


Debian 9 stretch

Debian 10 buster

Ubuntu 16.04 xenial

Ubuntu 18.04 bionic

Ubuntu 19.10 eoan

Ubuntu 20.04 focal



# using .ovpn profile

$ openvpn3 config-import --config ovpn.ovpn

Configuration imported.  Configuration path: /net/openvpn/v3/configuration/535489f0xdeeex4b97xb130x4f150b876def


#start

openvpn3 session-start --config ovpn.ovpn

Using pre-loaded configuration profile 'rleung.ovpn'

Session path: /net/openvpn/v3/sessions/7b8b05afscf2fs4207s93b8s9836b9cbaa92

Connected


# list

openvpn3 sessions-list

-----------------------------------------------------------------------------

        Path: /net/openvpn/v3/sessions/7b8b05afscf2fs4207s93b8s9836b9cbaa92

     Created: Thu Mar 17 17:27:29 2018                  PID: 464399

       Owner: ricky                                  Device: tun0

 Config name: ovpn.ovpn

Session name: 172.10.20.11

      Status: Connection, Client connected

-----------------------------------------------------------------------------



# manage disconnect

openvpn3 session-manage --disconnect --config rleung.ovpn


Initiated session shutdown.


Connection statistics:

     BYTES_IN.................7314066

     BYTES_OUT................1384787

     PACKETS_IN..................9189

     PACKETS_OUT.................7968

     TUN_BYTES_IN.............1190233

     TUN_BYTES_OUT............7090182

     TUN_PACKETS_IN..............7957

     TUN_PACKETS_OUT.............9179


2022年3月16日 星期三

GIT How to move some files from a repository to another repository? Use git am and patch

 https://stackoverflow.com/questions/1365541/how-to-move-some-files-from-one-git-repo-to-another-not-a-clone-preserving-hi



cd repository
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch.txt
cd ../another_repository
git am --committer-date-is-author-date < ../repository/patch.txt


Use 
git am --reject --committer-date-is-author-date < ../repository/patch.txt


https://jyx.github.io/apply-patches-in-git.html

$ git am < my_new_feature.patch
$ git apply --reject --whitespace=fix my_new_feature.patch
$ git status
$ vim my_conflicting_file.c*
$ find . -name "*.rej" -exec rm -f {} \;
$ git add .
$ git am --resolved

My Repeat:
git status
rm .rej
git am --skip


git add .
git am --continue



2022年3月15日 星期二

C++ libevent with CMake 2022

http://senlinzhan.github.io/2017/08/12/libevent/
http://man6.org/blog/Libevent/CMake%E7%BC%96%E8%AF%91Libevent.md


libevent-2.1.8

$ wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
$ tar -xzvf libevent-2.1.8-stable.tar.gz
$ cd libevent-2.1.8-stable
$ ./configure
$ make
$ sudo make install


CMakeList.txt

cmake_minimum_required(VERSION 3.10)
project(alligator)

include_directories(/usr/local/include)
link_directories(/usr/local/lib)

add_executable(alligator a.cpp)
target_link_libraries(alligator event)


c.app

#include <event2/event.h>
#include <iostream>
#include <string>
void timer_cb(evutil_socket_t fd, short what, void *arg)
{
    auto str = static_cast<std::string *>(arg);
    std::cout << *str << std::endl;
}
int main()
{
    std::string str = "Hello, World!";
    auto *base = event_base_new();
    struct timeval five_seconds = {1, 0};
    auto *ev = event_new(base, -1, EV_TIMEOUT, timer_cb, (void *)&str);
    event_add(ev, &five_seconds);
    event_base_dispatch(base);
    event_free(ev);
    event_base_free(base);
    return 0;
}


Ends

2007 to 2023 HP and Dell Servers Comparison

  HP Gen5 to Gen11  using ChatGPT HP ProLiant Gen Active Years CPU Socket Popular HP CPUs Cores Base Clock Max RAM Capacity Comparable Dell ...