Line breaks issue

When we use command “ssh” with auto-completion, we get this error result.

This is because we used the editor “sublime text” to edit the config before, which used the line endings of Windows. Then we can edit the setting of the sublime text editor to Mac OS.

Now we can get the desired result.

Posted in Mac, Sublime Text 2, Sublime Text 3 | Comments Off on Line breaks issue

[VirtualBox] Host-only network is not working.

We can usually find the information about connecting to the Guest machine in VirtualBox. Most of the practices are performed using the Host-only setting method.

But in version 7.0.4 of VirtualBox, the same setting does not work. This is because the new network interface in the Guest is not enabled correctly. This document describes the steps on how to enable the network interface.

  1. First check the number of the network interface.

    ifconfig -a | more

    Now we will get the number of the network interface is “enp0s8”

  2. Edit the network configuration. (Here we use Ubuntu 22.04)

    vim /etc/netplan/00-installer-config.yaml

    Add enp0s8 settings to this file.

  3. Execute the following command to apply the above settings.

    netplan generate

    netplan apply

Posted in Virtualbox | Comments Off on [VirtualBox] Host-only network is not working.

[Java] String with number format

Reference

Posted in Java | Comments Off on [Java] String with number format

[Java] Mask some part of String

Reference: [stackoverflow] Mask some part of String

Posted in Java | Comments Off on [Java] Mask some part of String

Trace URL request

Reference

Posted in Network | Comments Off on Trace URL request

Mount remote folder over ssh on mac

  1. Install sshfs

    Use brew (brew install sshfs) will get this error message, “Error: sshfs has been disabled because it requires FUSE!”

    Ref. https://github.com/telepresenceio/telepresence/issues/1654#issuecomment-1204676705

    So download and install https://github.com/osxfuse/sshfs/releases/download/osxfuse-sshfs-2.5.0/sshfs-2.5.0.pkg

  2. Create local folder

  3. Mount remote folder

  4. Umount floder

Posted in Mac | Comments Off on Mount remote folder over ssh on mac

RocksDB Tool

  1. Install rocksdb first.

  2. Add alias in zshrc

  3. List all column families

  4. Scan command:

  5. Show result with hex value

  6. Command description (Some commands are inconsistent with how they are used on linux servers)

Posted in RocksDB | Comments Off on RocksDB Tool

[Java] Append string with adaptive font size to image

Ref: https://blog.csdn.net/zengrenyuan/article/details/80281738

Posted in Java | Comments Off on [Java] Append string with adaptive font size to image

[Docker] time sync with host

Source: stackoverflow: How to make sure docker’s time syncs with that of the host?

Posted in Docker | Comments Off on [Docker] time sync with host

[Docker] Common commands

show all containers:

docker ps -a

stop all containers:

docker kill $(docker ps -q)

remove all containers:

docker rm $(docker ps -a -q)

remove all docker images:

docker rmi $(docker images -q)

enter docker container:

docker exec -it $(container id) bash

build docker image:

docker build -t $(image name) .

show all build failure images:

docker images -f “dangling=true” -q

remove all build failure images:

docker rmi $(docker images -f “dangling=true” -q)

create docker-machine on virtualbox:

docker-machine create -d virtualbox $(machine name)

set docker environment:

eval “$(docker-machine env)”

unset docker environment:

eval “$(docker-machine env -u)”

show docker all network:

docker network ls

show docker network detail information:

docker network inspect $(docker network)

start container with forwarding port setting

docker run -p $(host_port1):$(container_port1) -p $(host_port2):$(container_port2) $(docker_image)

ex. # docker run -p 60022:22 -p 2181:2181 -p 8090:8090 -p 60000:60000 -p 60010:60010 -p 60020:60020 -p 60030:60030 qmi

start container with hostname setting

docker run –hostname $(hostname) $(docker_image)

ex. # docker run –hostname qmi_docker qmi

start container with input/output tty

docker run -it $(docker_image)

stop container

docker stop $(container id)

build image from container

docker commit $(container_id) $(docker_image)

Posted in Docker | Leave a comment