Home avatar

Building and implementing end-to-end solutions to solve real-world problems

Moving Files From Google Drive Except Google Drive Files

If you want to move all files from Google Drive except for the ones with specific Google extensions (.gshortcut, .gdoc, .gsheet, .gslides, .gform, .gjam, .gmap, .gsite), you can use the rsync command with the --exclude option to specify the file extensions to be excluded. Additionally, you can exclude common system files like “Icon?” and “.DS_Store” to avoid transferring them. Here’s the command to achieve this:

1
rsync -avP --exclude="*.gshortcut" --exclude="*.gdoc" --exclude="*.gsheet" --exclude="*.gslides" --exclude="*.gform" --exclude="*.gjam" --exclude="*.gmap" --exclude="*.gsite" --exclude="Icon?" --exclude=".DS_Store" --remove-source-files "Google Drive (example@gmail.com)/example/" ./temp

Explanation of the command:

Running a Shell Script From Finder and Keeping the Filepath

If you’re a macOS user and want to run a shell script by double-clicking it in the Finder, you might encounter an issue with the working directory. By default, the working directory of the script becomes the user’s home directory, which can lead to unexpected behavior if your script relies on relative file paths. To ensure that your script runs with the correct working directory, you can include a specific command at the beginning of your script.

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: