Skip to main content

Terminal command to find and replace

In many terminal text editors, you use find command as reference in Terminal commands - find.  How about find and replace.  This action depends on the specific text editor you're using in the terminal.  Here are a few common terminal text editors and how you can find and replace strings within them:

Vim

To find: Press / followed by the search term and then Enter.

Resolving CVE-2022-48624 less issue

To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE, potentially allowing shell command injection.

The current less version is 551, which is vulnerable. You'll need to upgrade "less" to a version at or beyond 606.

How to check if Apache Struts 2 is installed on an Ubuntu

You can perform the following steps:

Check Apache Modules

Apache Struts 2 is typically integrated with Java applications and runs on servlet containers like Apache Tomcat. However, if you want to check for any signs of Struts 2 on Apache, you can look for loaded Apache modules. Run the following command:

Using OpenAI to summarise PDF

To use OpenAI to summarise text from a PDF using Python 3.11.6, you'll first need to extract the text from the PDF and then send it to the OpenAI API for summarisation.

 

Preparation

 

Set-up

pip install python-dotenv langchain openai tiktoken pypdf pymupdf

 

Code

The current code is on my Summaries GitHub page.

How to add an environment variable in Ubuntu

To set an environment variable on Ubuntu, can be achieved via a few options.  This depends on whether you want the variable to be system-wide or specific to a user's session.  Here are a couple of more common methods for setting environment variables:

Adding SSL wildcard certificate to Ubuntu running Nginx

Adding an SSL wildcard certificate to an Ubuntu server involves several steps.  A wildcard certificate can secure subdomains of a domain with a single certificate. Here's a general outline of the process:

I'll be using an existing wildcard certificate.

sudo apt update && sudo apt upgrade -y

 

Solving the errors in running Open AI on Ubuntu

While the default version on Ubuntu 20.04 for Python is 3.8, I've added Python 3.11.5 (latest version).

Errors

GPTSimpleVectorIndex is deprecated

Attempting to run python3.11 model-ai.py and I'm seeing the following response

Subscribe to 20.04