How to divert connection or packet before routing decision entering the default

Posted on

before the packets ports (443) entering the firewall i would like to divert incoming packet of server (443) to input chain goes to FORWARD chain<br> so thats the incoming packets 100.43.xx.xx –sport 443 are send it to FORWARD instead of input chain<br> how to configure this in OUTPUT,FORWARD,POST AND PREROUTING CHAIN and this is my
Read more

How to decode a quoted URL in Python?

Posted on

How to decode a quoted URL in Python? For example, an quoted URL as follows https://www.example.com/tag/%E9%93%B6%E8%A1%8C/ should be decoded to https://www.example.com/tag/银行/ In Python 3, we can use `urllib.parse_plus()` (for URL only). One example is as follows. $ python3 Python 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0] on linux Type “help”, “copyright”, “credits” or “license”
Read more

How to exclude a package from a specific repository only in yum?

Posted on

This post https://www.systutorials.com/1661/making-dnf-yum-not-update-certain-packages/ introduces how to exclude a package from yum. But is it possible to exclude a package from a specific repository only? For example, a repository R1 I am using contains an updated version of gdb while I don’t want to use the gdb from it as I trust the version (although older)
Read more

How to split and iterate a string separated by a specific character in C++?

Posted on

How to split and iterate a string separated by a specific character in C++? For example, “a string separated by space” by ‘ ‘=> [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” by ‘,’ => [“a”, “string”, “separated”, “by”, “comma”] C++ standard library’s getline() function can be used to build a function. getline() can accept a
Read more

How to iterate all dirs and files in a dir in C++?

Posted on

How to iterate all dirs and files in a dir in C++? To open a dir, we can use opendir() to open a directory stream. DIR *opendir(const char *name); Then we can use readdir() to iterate the directory stream. struct dirent *readdir(DIR *dirp); Here is an example C++ program using these 2 library functions. #include
Read more

How to test whether a given path is a directory or a file in C++?

Posted on

How to test whether a given path is a directory or a file in C++? For example, pathtype(“/”) –> “a dir” pathtype(“/tmp/file.txt”) –> “a file” # if there is a file file.txt pathtype(“/tmp/dir.txt”) –> “a dir” # if there is a dir named dir.txt The type of a file/dir can be found out using lstat()
Read more

What are the differences between NUMA architecture and SMP architecture?

Posted on

NUMA Architecture: Non-Uniform Memory Access architecture. SMP: Symmetric Multiprocessing architecture. In a Symmetric Multiprocessor, the architectural “distance” to any memory location is the same for all processors, i.e. “symmetric”. In a NonUniform Memory Access machine, each processor is “closer” to some memory locations than others; i.e. memory is partitioned among them Asymmetrically. From my understanding,
Read more

What is the difference between work conserving I/O scheduler and non-work conserving I/O scheduler?

Posted on

What is the difference between work conserving I/O scheduler and non-work conserving I/O scheduler? In a work-conserving mode, the scheduler must choose one of the pending requests, if any, to dispatch, even if the pending requests are far away from the current disk head position. The rationale for non-work-conserving schedulers, such as the anticipatory scheduler
Read more

How to check interrupts lively in your systems?

Posted on

I need to see what kind of interrupts are handled by which CPU. Please run command: # cat /proc/interrupts or you can execute $ watch -n1 “cat /proc/interrupts” to watch interrupts every 1 second. See [1] [2] for more details. References: [1] https://stackoverflow.com/questions/28301875/how-to-observe-interrupts-in-windows-or-linux-ubuntu-14-04 [2] http://www.linuxjournal.com/content/watch-live-interrupts

How to tune systems to achieve high performance in virtualization circumstances?

Posted on

Most time, we need to tune system parameters to achieve better performance but what the general parameters to be tuned in Linux systems. I think you may want to add following parameters to Kernel boot (/etc/default/grub) parameters intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll intel_pstate=disable At the same time, you may also want to shutdown/open Pause Loop Exiting (PLE).
Read more

How to get processes’ I/O utilization percentage

Posted on

Two notices: 1, a process has only one main thread which is itself. 2, a process has many threads. Solution 1: Please use taskstats [1] related interfaces, and send TASKSTATS_TYPE_PID and TASKSTATS_TYPE_TGID commands to kernel to get a process’s ‘blkio_delay_total’ parameter for a process with one main thread and a process with threads separately. Solution
Read more

For QEMU/KVM, how to share data between host and guest

Posted on

General question for developers to access data between VM and VMM. As I know, paravirtualization solution is a good way to share data for VM and VMM since it has better performance. Please use Virtio 9p solution for QEMU/KVM. Note that you need to load 9p related modules for guest kernel. Add following in your
Read more

How to add PHP DOMDocument extension to httpd in CentOS 7?

Posted on

Just migrated a PHP site to a new server. However, in /var/log/httpd/error_log, there are errors like [:error] [pid 2810] [client 61.92.242.24:43372] PHP Fatal error: Class ‘DOMDocument’ not found in /var/www/…/some.php on line 16 How to add PHP DOMDocument extension to httpd in CentOS 7? You need to install the package php-xml to have DOMCoument support
Read more

How to write a SQL to replace strings in a column in a MySQL database table?

Posted on

How to replace strings in a column in a MySQL database table? For example, I would like to replace http://www.systutorials.com with https://www.systutorials.com in a content column of a table post. You may use a SQL statement as follows. update post set content = replace(content, ‘http://www.systutorials.com’, ‘https://www.systutorials.com’) where content like ‘%http://www.systutorials.com%’

What are the best academic citation tool

Posted on

What is the best academic citation tool does anyone help? Here, we list 2 choices that are open source, or free, or have free plans. Zotero Zotero is open source and developed by an independent, nonprofit organization. Zotero can help you collect, organize, cite, and share research. Zotero can automatically senses research on the web.
Read more