Python Map, Filter and Reduce functions Python Map, Filter and Reduce are three functions which facilitate a functional approach to programming. We will discuss them one by one and understand their use cases. Python Development
How disable swap in debian or linux system swappiness Swappiness is a Linux kernel parameter that controls the relative weight given to swapping out runtime memory, as opposed to dropping pages from the system page cache . Swappiness can be set to values between 0 and 100 inclusive. A low value causes the kernel to avoid swapping, a higher value causes the kernel to try to use swap space. The default value is 60, and for most desktop systems, setting it to 100 may affect the overall performance, whereas setting it lower (even 0) may decrease response latency. Debian Linux
Python filter and filterfalse functions guide Let's learn about the differences between filter() and itertools.filterfalse() in python. Python Development
Python map and starmap functions python map function python map function map(function, iterable, ...) Python map function Return an iterator that applies function to every item of iterable, yielding the results. If additional iterable arguments are passed, function must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For cases where the function inputs are already arranged into argument tuples, see itertools. Python Development
Install Non Free Firmware to Debian linux based distros I install debian stretch to my old IBM System x3650 yesterday. This old server has a NetXtreme II BCM5708 Gigabit Ethernet from Broadcom that need a load non free firmware. And my install attempt crash with this error: [ 82.956477] bnx2 0000:03:00.0: firmware: failed to load bnx2/bnx2-mips-06-6.2.3.fw (-2) [ 82.956481] bnx2 0000:03:00.0: Direct firmware load for bnx2/bnx2-mips-06-6.2.3.fw failed with error -2 So, how load this non free firmware during instalation and make a NIC ethernet card to UP ? Debian Hardware
Python reduce and accumulate total guide Python reduce function Python’s reduce() implements a mathematical technique commonly known as folding or reduction. You’re doing a fold or reduction when you reduce a list of items to a single cumulative value. Python’s reduce() operates on any iterable (not just lists) and performs the following steps: Apply a function (or callable) to the first two items (default) in an iterable and generate a partial result. Use that partial result, together with the third item in the iterable, to generate another partial result. Python Development
Python case|match - structural pattern matching After many proposals to add a switch/case like syntax to Python failed, a recent proposal by Python language creator Guido van Rossum and a number of other contributors has been accepted for Python 3.10: structural pattern matching . Structural pattern matching not only makes it possible to perform simple switch/case style matches, but also supports a broader range of use cases. Python structural pattern matching Structural pattern matching introduces the match/case statement and the pattern syntax to Python. Python Development
Python Multiprocessing - Right Way We will not write about what multiprocessing is. You can find many articles about what is multiprocessing . Although cumbersome at first sight, multiprocessing does have several advantages. Keeping processes separated in their own virtual memory "cages" can actually help in debugging and avoids confusion. Once you sort out the intercommunication problem in a systematic way and avoid some common pitfalls, programming with python multiprocesses becomes a joy. One frequent error is to mix multithreading and multiprocessing together, creating a crashy/leaky program and then conclude that python sucks. Python Development
Debian Linux and LSI MegaRAID SAS This HowTo show how to check the health of Hard Disks connected to a LSI Logic/Symbios Logic MegaRAID SAS 2108 RAID controller under linux. But is very useful for another hw raid controllers. We look for its presence in the system: ~] lspci | grep RAID 01:00.0 RAID bus controller: Broadcom / LSI MegaRAID SAS 2108 [Liberator] (rev 03) Bingo!, we can work with this one. Install linux utilities LSI provide megacli, a proprietary management command line utility. Debian Linux Hardware
pnp4nagios and icinga2 This is not my article, it is copy from this site . It cover install icinga2 , icinga2 director and pnp4nagios on Ubuntu 20.04, but is very useful as manual for debian buster and Bullseye. This guide shows how to install Icinga2 monitoring software on Ubuntu 20.04 – this includes backend, frontend, director and pnp4nagios (adding graphs to icinga). Especially PNP was hard to get working – but if you follow the guide everything is nicely lined up at the end. Linux Monitoring
Test IMAP with telnet IMAP connection theory The first thing any client needs to do is to make a connection to the remote imap server on a specific port. These ports can vary, but default port for plaintext imap service is 143 , and for encrypted (SSL/TLS) imap service is default port 993 . You can use for plaintext imap connection a telnet utility, or for encrypted imap service you can use openssl s_client command. Networking Linux
Linux Command Line Tips and Tricks Text Editing For mostly all examples we use sed utility with substitution command. The syntax is pretty simple: sed -i 's/SEARCH-WORD/REPLACMENT-WORD/gI' input # or for regular expressions: sed -i 's/SEARCH-REGEXP/REPLACMENT-WORD/gi' input The -i option edit and update text file in place. For piped input from another utility it is not necessary The / are delimiters between words or regexp. sed -i 's/SEARCH-REGEXP/REPLACMENT-WORD/gI' - I flag make search case insensitive sed -i 's/SEARCH-REGEXP/REPLACMENT-WORD/gI' - for text files input use g flag to make search global across the whole file print first N chars We want print first N chars. Linux