Skip to content

Instantly share code, notes, and snippets.

View Denilson-Semedo's full-sized avatar
🌴
On vacation

Denilson Tavares Denilson-Semedo

🌴
On vacation
View GitHub Profile
@Denilson-Semedo
Denilson-Semedo / linux_recovering.md
Last active June 30, 2023 10:54
Recovering a Linux System in Dual Boot with Windows

Fixing the Arch Linux Bootloader using Commands

Arch Linux is a powerful and versatile operating system used by many Linux enthusiasts around the world. However, sometimes things can go wrong, and one of the common issues faced by Arch Linux users is a corrupted or broken bootloader. The bootloader is a crucial component of any operating system as it loads the kernel and initializes the system. If the bootloader is not working correctly, the system may not be able to boot. In this article, we will explain how to fix the Arch Linux bootloader using the following commands:

  1. Identify the partitions
    sudo fdisk -l

This command is used to list all the available disks and their partitions on your system. This will help you identify the correct partition where Arch Linux is installed.

@Denilson-Semedo
Denilson-Semedo / BeautifulSoup.md
Last active June 8, 2023 01:29
BeautifulSoup Spreadsheet

Introduction to Beautiful Soup

Beautiful Soup is a popular Python library used for parsing HTML and XML documents. It provides a simple and intuitive interface to extract data from web pages or analyze structured markup data.

With Beautiful Soup, you can navigate and search through the parse tree, extract desired information, and even modify the content of the document. Whether you are scraping data from websites, parsing XML files, or working with HTML documents, Beautiful Soup can greatly simplify the process.

One of the key features of Beautiful Soup is its ability to handle poorly formatted or invalid markup. It is designed to be resilient and flexible, allowing you to work with imperfect HTML or XML and still extract the data you need.

The official Beautiful Soup documentation.

Selenium

Selenium is an open-source framework widely used for automating web browsers. It provides a suite of tools and libraries that enable testers and developers to automate browser actions, interact with web elements, and perform functional testing of web applications. Selenium supports various programming languages such as Java, C#, Python, Ruby, and JavaScript, making it accessible to a wide range of developers.

Selenium Documentation

Topic Description
What is Selenium? Selenium is an open-source framework for automating web browsers. It allows testers to write tests in various programming languages.
Selenium Components Selenium WebDriver, Selenium IDE, Selenium Grid
@Denilson-Semedo
Denilson-Semedo / requests.md
Last active June 8, 2023 01:29
Requests Library

Requests Library: Simplifying HTTP Requests in Python

The Requests library is a popular Python library for making HTTP requests and interacting with web services. It provides a simple and intuitive API that allows you to send HTTP requests, handle responses, manage cookies, handle authentication, and much more.

With the Requests library, you can easily perform common HTTP methods such as GET, POST, PUT, DELETE, HEAD, PATCH, and OPTIONS. It supports various features like passing parameters, adding headers, handling response content (including JSON), uploading files, managing cookies, and session management.

The library is widely used due to its user-friendly design, robustness, and extensive documentation. It abstracts the complexities of working with HTTP and provides a high-level interface that makes it straightforward to integrate web services into your Python applications.

Python Requests Documentation

httplib2

httplib2 is a Python library that provides a comprehensive HTTP client for making requests and handling responses. It offers a simple and intuitive interface, making it easier to work with HTTP protocols in your Python applications. The library supports both HTTP/1.1 and HTTPS, handling redirects, cookies, authentication, caching, and more.

Installation

To install httplib2 using pip, you can run the following command:

pip install httplib2 

urllib

urllib is a Python standard library that provides a set of modules for handling URLs and performing various tasks related to network communication. It allows you to open URLs, retrieve data from web servers, parse URLs, encode and decode URL parameters, handle errors, manage cookies, and more.

The main module in urllib is urllib.request, which provides functions and classes for making HTTP requests, interacting with web servers, and handling responses. With urllib.request.urlopen(), you can open a URL and obtain a file-like object to read the response. This method supports both GET and POST requests, allowing you to send data to the server if needed.

urllib - Python Standard Library Documentation

Function/Method Description Example
@Denilson-Semedo
Denilson-Semedo / postgresql.md
Last active December 28, 2023 18:37
PostgreSQL cheatsheet guide

[review] Schemas

PostgreSQL Cheatsheet

Connection

psql -d database -U username -p port

Also you can use -W to prompt a password
psql -d database -U username -p port -W

Alter Password (Set new password)

@Denilson-Semedo
Denilson-Semedo / mongo_db.md
Created November 30, 2023 06:01
MongoDB Cheatsheet

MongoDB Cheatsheet

Introduction to MongoDB

Welcome to the MongoDB Cheatsheet – A short and comprehensive guide to MongoDB, the NoSQL database renowned for its flexibility, scalability, and high performance. This cheatsheet is designed to help with the MongoDB implementation in Pyhton.

For more in-depth information and detailed documentation, visit the official MongoDB documentation https://www.mongodb.com/docs/
Here you can access a MongoDB CRUD operations tutorial with Python(Fastapi) https://www.mongodb.com/languages/python/pymongo-tutorial

Key Concepts

POETRY | PYTHON PACKAGING AND DEPENDENCY MANAGEMENT

Poetry serves as a versatile tool for dependency management and packaging within Python projects. With Poetry, you can effortlessly specify the libraries your project relies on, and it takes care of managing their installation and updates. Moreover, Poetry provides a lockfile mechanism to ensure consistent installs and facilitates project distribution through its build capabilities.

Requirements

Poetry mandates Python 3.8 or higher for its operation. It boasts multi-platform compatibility, aiming to deliver seamless performance across Linux, macOS, and Windows environments.

Installing Poetry

If you haven't installed Poetry yet, you can do so by running the following command in your terminal:

venv | Python Virtual Environment

Python Virtual Environment is a tool to keep the dependencies required by different projects in separate places. The venv module provides support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories. Each virtual environment has its own Python binary (which matches the version of the binary that was used to create this environment) and can have its own independent set of installed Python packages in its site directories.

Creating a Virtual Environment

To create a virtual environment, decide upon a directory where you want to place it, and run the venv module as a script with the directory path:

python3 -m venv /path/to/new/virtual/environment