Dimas Maulana

Dimas Maulana

Developer

Welcome to my website! I am a developer with a current focus on React and Go. My experience encompasses both front-end and back-end development, enabling me to design and develop seamless and efficient applications.

Running Selenium on Windows 10 From Ubuntu WSL

If you’re trying to run Selenium with Chrome headless on Ubuntu WSL and encountering issues, an alternative approach is to install the Selenium Standalone Server on your Windows 10 machine and then connect to it remotely from the Ubuntu WSL terminal. This can help you overcome the limitations of running Chrome headless directly within WSL.

Here’s a step-by-step guide on how to achieve this:

Step 1: Set Up Selenium Standalone Server on Windows 10

  1. Install Java: Ensure you have Java installed on your Windows 10 machine since Selenium requires it to run. You can download and install Java from the official website.

Resizing a File in Ubuntu by a Specific Size and Removing Lines From the Center

To resize a file to a specific size and remove lines from the center of the file in Ubuntu, you can use a combination of commands like truncate and head and tail. Here’s how you can achieve this:

  1. Resize the File to 10MB using truncate:

    To resize a file to a specific size, you can use the truncate command with the --size (-s) option. In this case, we want to resize the file other_vhosts_access.log to 10MB:

Tracing HTTPS Requests Using Mitmproxy

Mitmproxy is a powerful tool that allows you to intercept, modify, and inspect network traffic. It’s commonly used for debugging, security testing, and analyzing HTTP/HTTPS traffic. In this article, we’ll explore how to trace HTTPS requests using mitmproxy, both with a regular proxy and a transparent proxy setup.

Prerequisites

Before you start, make sure you have mitmproxy installed. You can install it using pip:

How to Delete Old Journal Logs in Ubuntu

If you’re running Ubuntu, you might accumulate a large amount of journal logs over time. These logs can take up valuable disk space. Fortunately, you can easily delete old journal logs to free up space on your system. Here’s how you can do it using the journalctl command with the --vacuum-time option.

Deleting Old Journal Logs

To delete old journal logs in Ubuntu, follow these steps:

Bash Check if Shell on Interactive or Login

In Bash, you can check whether the shell is running in an interactive or login mode using the provided commands. Here’s an explanation of each command and what it checks for:

  1. [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive':

    • This command checks the value of the special shell variable $-, which contains a string of options and flags that are currently set for the shell.
    • The *i* pattern is used to check if the letter ‘i’ appears anywhere in the value of $-. If it does, it indicates that the shell is running in interactive mode.
    • If ‘i’ is found, it echoes ‘Interactive’, otherwise, it echoes ‘Not interactive’.
  2. shopt -q login_shell && echo 'Login shell' || echo 'Not login shell':

How to Fix Wrong Indentation When Pasting Source Code in VIM

When copying and pasting source code into the VIM text editor, you might encounter issues with incorrect indentation due to the way VIM handles auto-indentation. This happens because VIM’s default behavior tries to adjust the indentation based on the surrounding code, which can lead to unwanted results when pasting code from external sources. To prevent this, you can use the :set paste and :set nopaste commands to toggle the paste mode. Here’s how to do it:

0%