developer resources
Codebales holds an ever growing number of solutions to problems that we have experienced in our day to day code writing
Selected filter
105
results
Andrew Fletcher
•
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.
CVE-2022-48624
close_altfile in filename.c in...
Andrew Fletcher
•
To determine the size of a directory using the terminal, you can use the du...
Andrew Fletcher
•
In many terminal text editors, you use find command as reference in Terminal...
Andrew Fletcher
•
You can use the pip list --outdated command to view a list of installed Python...
Andrew Fletcher
•
To begin, note that Lando is often used for web development and it may not be...
Andrew Fletcher
•
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.
Elements
Adjusting the parameters - you can adjust the max_tokens and temperature parameters in the summarize_with_openai function to control the length and...
Andrew Fletcher
•
The "keystore password was incorrect" error in keytool indicates that the...
Andrew Fletcher
•
In Vim, following is an outline of the vi(m) functions you can utilise whilst in...
Andrew Fletcher
•
The os.makedirs(directory_path) function in Python can be used with both...
Andrew Fletcher
•
Permission error
Traceback (most recent call last):
File...
Andrew Fletcher
•
You can move a file from one directory to another in Python using the shutil module. The shutil module provides functions to perform various file operations, including moving files. How you can move a file from one directory to another:
import shutil
# Source file path (the file you want to move)
source_file = "/path/to/source_directory/file.txt"
# Destination directory (the directory where you want to move the file)
destination_directory = "/path/to/destination_directory/"
# Combine...
Andrew Fletcher
•
To set an environment variable on Ubuntu, can be achieved via a few options....
Andrew Fletcher
•
Whilst installing Python 3.11.6 and running the command 'sudo make altinstall',...
Andrew Fletcher
•
Visual Studio Code (VS Code) allows you to manage extensions using the VS Code...
Andrew Fletcher
•
A summary of Node package commands
Short cut commands
npm install...