How to find all files containing specific text on Linux

Do the following:

grep -rnw '/path/to/somewhere/' -e 'pattern'
  • -r or -R is recursive,
  • -n is line number, and
  • -w stands for matching the whole word.
  • -l (lower-case L) can be added to just give the file name of matching files.
  • -e is the pattern used during the search

Along with these, --exclude--include--exclude-dir flags could be used for efficient searching:

grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude=\*.o -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/search/' -e "pattern"

How to Create an ISO File in Linux

Install the package genisoimage:

sudo apt install genisoimage

Run the command mkisofs:

mkisofs -o destination-filename.iso /home/username/folder-name

Or, using dd, run the following command:

dd if=/dev/cdrom of=/home/username/iso-name.iso

Howto install new kernel

Install Ubuntu Mainline Kernel Installer

sudo add-apt-repository ppa:cappelikan/ppa -y
sudo apt install mainline -y

Open Mainline and install the kernel of choice

how to install Packages in Sublime Text

Package Control is the package manager for Sublime Text. With Package Control you can manage Sublime Text packages. You can install new packages, list installed packages, remove installed packages, update packages and so on. It is a very handy tool for Sublime Text users.

All the Sublime Text packages are hosted in the Package Control’s official website at https://packagecontrol.io.

To install Package Control, Open Sublime Text and go to Toools > Install Package Control… as shown in the screenshot below.

To open Package Control, go to Preferences Package Control as shown in the screenshot below.

To install a new Sublime Text package, click on Package Control: Install Package as marked in the screenshot below.

More info at: https://linuxhint.com/install_packages_sublime_text/

Elastic Search

List indexes

curl 'localhost:9200/_cat/indices?v'
or
curl http://localhost:9200/_aliases?pretty=true

Delete indexes

curl -XDELETE http://localhost:9200/zeebe-record*
curl -XDELETE http://localhost:9200/operate-*

Invoice Ninja Payment Gateway

PayPal integration

➢ Setup: Use this guide to complete PayPal integration inside Invoice Ninja. It’s very
straightforward.
➢ Tip: Test it using a credit card of some friend with a tiny amount of money.

Client Portal

➢ Setup: Use this guide to complete Client Portal setup.
➢ Tip: Test every feature using a test client account, including payment.

API usage

➢ NinjaConfig::setURL('https://<site>/invoiceninja/public/api/v1/'); //replace with your URL
➢ NinjaConfig::setToken('ra3mvgku5fl72orfymk0u40ugzemptll'); //replace with your token
➢ Tip: Use this guide to generate your token.

PyEnv howto

Install prerequisites and pyenv:

sudo apt install -y make build-essential libssl-dev zlib1g-dev  libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl

curl https://pyenv.run | bash

Prepare the startup files by following the output instructions.

Install a specific python version:

pyenv install --list | grep " 3\.[678]"
pyenv install -v <version>
pyenv global/local/shell <version>

Delete a specific version:

pyenv uninstall <version>

Install a virtual environment:

pyenv virtualenv <python_version> <environment_name>

For more information please read: https://realpython.com/intro-to-pyenv/

Fix Time in Ubuntu & Windows – Dual Boot

Ubuntu maintains the hardware clock (RTC, real time clock) in universal time (UTC) by default while Windows maintains the clock in local time, thus causing time conflicts between Ubuntu and Windows.

To fix it, either set Ubuntu to maintain RTC in local time or make Windows uses UTC.

1. Disable UTC and use Local Time in Ubuntu:

# in command prompt execute the following line:
timedatectl set-local-rtc 1 --adjust-system-clock
# to check just run
timedatectl

2. Make MicroSoft Windows uses UTC:

# run command prompt as admin and execute the following line:
Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1

Prusa & Octoprint howto

Download the image from the following link: https://octoprint.org/download/

Burn it to disk:

sudo dd if=2020-12-02-octopi-buster-armhf-lite-0.18.0.img of=/dev/sde bs=1024k status=progress

Print a new case following this article and mount the pi on it: https://www.prusaprinters.org/prints/9284-prusa-i3-octoprint-raspberry-pi-case/files

Check that RPi port is switched on (for GPIO), on the printer.

Login to octoprint, configure wireless, switch on SPI (not so sure about it) and serial modules:

sudo raspi-config -> System Options -> Wireless -> SSID/psk
sudo raspi-config -> Interfacing options -> SPI -yes
sudo raspi-config -> Interfacing options -> Serial -> no -> yes

Configure the interface from the browser: http://octopi.local paying attention to dimensions: 250x210x210 (width, depth, height)