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.

Connect Kubectl Pods Kubernetes

To connect to a pod in Kubernetes using kubectl port-forward, you can follow the command you provided:

1
kubectl port-forward kubernetes-dashboard-7798c48646-ctrtl 8443:8443 --namespace=kube-system

This command is useful when you want to access a service running inside a Kubernetes pod from your local machine. Here’s a breakdown of the command:

  • kubectl port-forward: This is the command for port forwarding in Kubernetes.
  • kubernetes-dashboard-7798c48646-ctrtl: This is the name of the pod you want to connect to. Replace it with the actual name of the pod you want to access.
  • 8443:8443: This specifies the port forwarding configuration. It forwards port 8443 on your local machine to port 8443 on the pod. You can adjust the port numbers as needed.
  • --namespace=kube-system: This flag specifies the namespace in which the pod is located. In this case, it’s in the kube-system namespace.

After running this command, you can access the service running inside the pod on your local machine by connecting to https://localhost:8443 in your web browser. Make sure that the service you want to access is listening on port 8443 inside the pod for this to work.

About Bash Profile and Bash.Rc on Mac OS

The macOS Terminal.app uses a series of scripts and configuration files to set up the shell environment before you see the command prompt. Here’s an overview of these files and how they are executed:

  1. /etc/profile: This is a system-wide configuration file that is executed for all users when they start a new shell session. It sets up environment variables and configurations that are applicable to all users.

  2. /etc/bashrc: This file is also system-wide and is typically sourced (executed) by /etc/profile. It can contain additional configurations and environment variables that apply to all users and all shell sessions.

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 ([email protected])/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:

0%