I’ve recently been using Beijing Yitongxing to scan QR codes to ride buses and subways. To be more efficient, I started researching whether I could pop up the subway or bus code with one click. After all, finding the App, launching it, and then switching to the corresponding ride code is quite cumbersome.

The core of this feature—one click to open a specific page in an App—is essentially a URL Scheme. The key is whether I can obtain that information.

To summarize, I could only manage to open the Yitongxing App with RuubyPay://, but I couldn’t get to the specific subway or bus code page. This is because I couldn’t find the relevant SDK or didn’t guess the correct page URL. Although I didn’t fully solve the problem, I did figure out the general method for finding the URL Scheme of a specific App, which could be useful in the future.

Basic Methods

  1. Google/GitHub Search

    The first step is always to search widely since many others may have already found it, like weixin://scanqrcode for WeChat’s QR code scanner.

  2. Official Documentation

    Some well-documented apps provide detailed information about URL Schemes, such as Surge or Things. For apps like WeChat or Meituan, however, there isn’t systematic documentation, so users rely on community discoveries, which is less ideal.

  3. Checking the info.plist with tools like iMazing, or directly viewing the app’s contents in Finder for Mac apps.

    Search for the CFBundleURLSchemes keyword in info.plist; the array values will be the URL Schemes.

Read more »

The npm publish command is used to publish a JS package to a private or public registry. However, I previously ignored how the lock file is handled during publishing, such as the processing of the resolutions field. Here, I will organize the issues I have learned.

Package publish without package-lock.json

  1. When developing a JS package, we need to include package-lock.json in VCS management, but the lock file will not be published when using npm publish.
  2. When we execute the npm install command in a specific project, the lock file of the top-level package (i.e., the target project) zeds for a recognize-specific version installation. Still, the lock files included in the dependent packages will be directly ignored.

Including lock file in published package?

  • With npm cli >=v6, package-lock.json will not be published regardless of whether it is configured in the package.json files whitelist. However, under the older CLI, it can be published through a whitelist configuration.
  • Testing with v6 will show this issue. From the official version history, it can be seen that, for example, nodev8 default npm CLI is v6, and trying that version can reproduce this issue.
Read more »

When implementing terminal search highlighting using xterm.js, it’s necessary to recognize whether the terminal is currently in vi editor mode. Upon investigation, it was found that xterm.buffer.active.type can be used for this purpose.

Upon examining the corresponding type definitions, it was found that the values are only “normal” and “alternate.” It wasn’t clear why it’s called “alternate,” so further investigation revealed that this concept originates from the terminal’s alternate screen. Here’s an overall introduction.

Alternate Screen

  1. The alternate screen is a temporary screen for interactive input, which eventually returns to the main screen. For example, in VI mode, the screen display area is the same as in normal mode. When the alternate screen is activated, the original screen content is saved, and the original content is restored upon exiting the alternate screen.
  2. Therefore, the normal/alternate concepts in xterm are not original but are inherent to the terminal’s design, with these two modes being standard and alternate.

At the end

Read more »

Besides the Mac version, Alfred also offers a iOS App for iPhone/iPad. After some time of use, here is a summary of my personal practice.

  1. The remote itself is just an extension of the desktop version of Alfred, essentially still operating the Mac version of Alfred, so it is somewhat fun but still quite limited.
  2. If there is no need for a remote control of the Mac, I personally do not recommend purchasing it, as it is not frequently used.

For those who need it, continue reading 👇

Download/Cost

Read more »

Recently, when using an open source tool, I found a tool called tmux. Then I found that Tmux is quite popular, the repo star has 20K+, and my commonly used iTerm2 is also integrated with tmux. Based on this, it is necessary to understand tmux and clarify the usage scenarios.

Since the current use is still shallow, please point out if any mistakes

Concept

Start with the concept and understand its function.

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

  1. Personal understanding is that tmux saves the terminal session on-site. For example, SSH is connected to a VPS, vi edit a file, directly closes the session, and then reopens the connection, you will find that the state is lost, you need to re-enter the target path and reopen it edit. With tmux, you can save this session, re-access the target machine, load the previously saved session, and everything will be restored as before.
  2. The reason why tmux can save sessions is because after tmux is installed on the target server, a separate service will be started for on-site saving.

Tmux Installation

Understand the above principles, you can understand that tmux is not necessarily installed locally, but installed on the machine that needs to save the session.

The installation commands in common operating system environments are as follows

1
2
3
4
5
# macOS
brew install tmux

# centos
yum install tmux
Read more »
0%