Buy Me a Coffee

[Linux] How to Download Files and Folders from Remote Server

To use scp to download a file from a remote server to your local machine, you can use the following syntax: scp username@host:/path/to/remote/file /path/to/local/destination This will download the file located at /path/to/remote/file on the remote server, and save it to /path/to/local/destination on your local machine. You will need to replace username with your username on the remote server, host with the hostname or IP address of the remote server, and /path/to/remote/file and /path/to/local/destination with the actual paths to the remote file and the local destination, respectively. ...

[Mail Server] What is DKIM

DKIM (DomainKeys Identified Mail) is an email authentication method that allows the sender of an email to associate their domain name with the email message. This allows the recipient’s email server to check that the email message is authorized by the sender’s domain and has not been tampered with during transit. DKIM uses cryptographic signatures and public-key cryptography to verify the authenticity and integrity of email messages. When an email is sent, the sender’s mail server generates a digital signature for the message, which is then added to the email’s headers. The recipient’s mail server retrieves the sender’s public key from a DNS record and uses it to verify the signature. If the signature is valid, the recipient’s mail server can be confident that the email is from the domain it claims to be from and has not been altered in transit. ...

[Mail Server] What is SMTP Server

SMTP stands for Simple Mail Transfer Protocol. It is a protocol used for sending email messages between servers. Most email systems that send mail over the Internet use SMTP to send messages from one server to another, and to deliver messages to local mail clients like Microsoft Outlook or Apple Mail. An SMTP server is a computer that is responsible for sending and receiving email messages. It uses the SMTP protocol to communicate with other email servers, to receive messages from local clients, and to deliver messages to local clients. ...

[DroneCI] How to Build Multiarch Docker Image for Private Registry

Few months ago, I wrote a post about DroneCI: How to configure pipeline to build and push docker image. It worked well for multiple personal projects of mine. However, recently I am working on a new project which I want to deploy the image in the VPS instances with different platforms and architecture. 1. Solution Thanks to the Drcone CI plugin drone-docker-buildx, the task becomes a lot of easier. Here you go. ...

[WSL] cgo: C compiler 'gcc' not found

When I first time built a Golang project from VS Code wsl mode, I got the below error: Build Error: go build -o /home/oscar/source/github.com/xx/xx/__debug_bin -gcflags all=-N -l . # runtime/cgo cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH (exit status 2) My first reaction for this error is to install the gcc compiler in my Windows environment. However, the solution is actually to install gcc compiler in the wsl environment. ...

[WSL] Could not access the service hosted in WSL from host by IP

If you just started to use WSL, you may encounter the issue that You only can access your service hosted in the WSL from the host by localhost, but not the IP address. For example, you have a web service that listens to port 8080. In your web browser, you can browse the site with http://localhost:8080, but http://127.0.0.1:8080. The reason is that you need to use the WSL IP address. An easy way to find the address is to execute the below command in WSL terminal. ...

[Golang] go get: fatal: could not read Username for 'xxx': terminal prompts disabled

1. Error 1: fatal: could not read Username for 'https://github.com': terminal prompts disabled The issue appears when I tried to download a private golang repository by the command go get github.com/oscarzhou/private-helloworld. The completed error shows as below: % go get github.com/oscarzhou/private-helloworld go: module github.com/oscarzhou/private-helloworld: git ls-remote -q origin in /Users/oscarzhou/go/pkg/mod/cache/vcs/c5fb5660c8bfa54f1b957fc4e651ac76f19b939fc9015bf3bcbc21a34c925af7: exit status 128: fatal: could not read Username for 'https://github.com': terminal prompts disabled Confirm the import path was entered correctly. If this is a private repository, see https://golang.org/doc/faq#git_https for additional information. If you have already googled this issue, you may find that most of the answers tell you to configure your git as shown below: ...

[Wget] Unable to locally verify the issuer's authority

1. Error This issue happens when I run the command wget https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-linux-x86_64 in my Ubuntu WSL. The completed error looks like below: The extracted error is >> connected. >> ERROR: cannot verify objects.githubusercontent.com's certificate, issued by ‘CN=ospanel’: >> Unable to locally verify the issuer's authority. >> ERROR: certificate common name ‘localhost’ doesn't match requested host name ‘objects.githubusercontent.com’. >> To connect to objects.githubusercontent.com insecurely, use `--no-check-certificate'. You can see there are basically four highlight errors above and many answers for each error if you google them. I had tried the below workarounds in WSL: ...

[Git] How to configure SSH profile for Github account

There are many benefits for using Git with SSH connection. Do not need to type the password every time when pushing the project. Able to configure multiple git accounts in the same machine without using password every time. For Golang projects that reference other Golang private repositories, SSH connection is must thing. This post will show you how to configure SSH profile for your GitHub account from scratch. I assume that you did not ever configure the Git on your host. To check it, you can run git config --global --list. The expected output should be empty. If it is not, don’t worry, leave it there for now. We can figure it out later. ...

[Nginx] Expose specified port for Nginx in Dockerfile

When we build a custom docker image based on nginx docker image, the default lisenting port will be 8080. However, port 8080 is a quite popular, so sometimes I want to give a different port for my service. The below snippet of code is the solution. FROM nginx COPY ./public/ /usr/share/nginx/html EXPOSE 1313 CMD ["/bin/sh", "-c", "sed -i 's/listen .*/listen 1313;/g' /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"]

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !