Can awk patterns match multiple lines?

Awk can easily detect multi-line combinations of patterns, but you need to create what is called a state machine in your code to recognize the sequence. Consider this input: how second half #1 now first half second half #2 brown second half #3 cow As you have seen, it’s easy to recognize a single pattern. … Read more

How to make an executable ELF file in Linux using a hex editor?

Decompile a NASM hello world and understand every byte in it Version of this answer with a nice TOC and more content: http://www.cirosantilli.com/elf-hello-world (hitting the 30k char limit here) Standards ELF is specified by the LSB: core generic: http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/elf-generic.html core AMD64: http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-AMD64/LSB-Core-AMD64/book1.html The LSB basically links to other standards with minor extensions, in particular: generic … Read more

Setting the umask of the Apache user

For CentOS and other Red Hat distros, add the umask setting to /etc/sysconfig/httpd and restart apache. [root ~]$ echo “umask 002” >> /etc/sysconfig/httpd [root ~]$ service httpd restart More info: Apache2 umask | MDLog:/sysadmin For Debian and Ubuntu systems, you would similarly edit /etc/apache2/envvars.

Automating running command on Linux from Windows using PuTTY

Putty usually comes with the “plink” utility. This is essentially the “ssh” command line command implemented as a windows .exe. It pretty well documented in the putty manual under “Using the command line tool plink”. You just need to wrap a command like: plink root@myserver /etc/backups/do-backup.sh in a .bat script. You can also use common … Read more

Bluetooth Low Energy: listening for notifications/indications in linux

Try this… Run gatttool -b <MAC Address> –interactive like you did before. You’ll get a prompt and then you type connect. You should see a CON in the prompt indicating that you’ve connected to the device. Then type char-read-uuid 2902. You should get a list of all CCC (Client Characteristic Configuration) attributes on the device. … Read more

Error when using Git credential helper with gnome-keyring as Sudo

Beside the use of sudo, note that in 2016, libgnome-keyring is specific to GNOME and is now deprecated (since January 2014, actually). 2022 option: git-credential-manager Microsoft provides a cross-platform credential helper named GCM (Git Credential Manager), which you can install (no need to build it) and configure: git-credential-manager-core configure You will need Git 2.27+ to … Read more

How can I get CMake to find my alternative Boost installation?

You should have a look at FindBoost.cmake script, which handles Boost detection and setting up all Boost variables. It typically resides in /usr/share/cmake-2.6/Modules/. In it, you will find documentation. For instance: # These last three variables are available also as environment variables: # # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for # … Read more