Posted onEdited on Symbols count in article: 2.3kReading time ≈2 mins.
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.
Personal understanding is that tmux saves the terminal session on-site. For example, SSH is connected to a VPS, vi edits 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.
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
Posted onEdited on Symbols count in article: 1.3kReading time ≈1 mins.
Now many site services have a 2FA mechanism, and services such as login or online payment need to send a text message. Enter the verification code after receiving the text message.
In response to this mechanism, the iPhone supports automatic extraction, which can be filled by clicking, while on the Mac, only Safari has a similar experience. If you use other apps such as Chrome, you will lose this experience. In order to solve this deficiency, a workflow is developed here to optimize the experience.
As above, wait for dozens of seconds after sending the message, when the text message is received, enter 2fa to evoke the workflow, select the verification code item, and press Enter to copy to clipboard board, ⌘ + v fills the target input box.
Notice
There are differences in the validity period of different verification codes, so workflow provides the option to set the validity period. By default, the SMS verification code received within 10 minutes is queried.
In order to read text messages on Mac, Alfred needs to have disk access permissions
Posted onEdited on Symbols count in article: 1.8kReading time ≈2 mins.
The Alfred sdk has been packaged before. The way to use it is to manually install the package in the specific workflow js, and then require the corresponding module. The commonly used script filter construction, screening, and quicklook have encapsulated fn, which is easy to use. But there is no CLI support yet. In order to further improve efficiency, the development of CLI can be driven out. Mark it here for a little experience.
Solve pain points
Use the CLI to automatically install the Alfred SDK package
Generate default or specified JS files, and module loading is also built-in at the code level, which does not need to be written manually.
In this way, you only need npx @stacker/alfred-utils init , and then open index.js to write for business.
Posted onEdited on Symbols count in article: 1.6kReading time ≈1 mins.
Recently, a community project received a request for users to connect an external camera to their Mac, hoping that Alfred would support one-click switching between different cameras. Because there is a rarely need to open video, I haven’t noticed how to use an external device on a Mac before, so I try it here.
Camera Installation
I remembered that I once bought a Logitech Webcam C110, so I found it and tried it, USB interface, I converted the connection through the docking station USB=>TypeC, then opened Tencent Meeting or Facetime, and can see the plug in the camera options of new equipment. Select Discovery work.
After trying, I found a few problems
The settings such as default camera/disabling a camera can‘t be selected in the Apple Settings Center.
It can only be set correspondingly in the app that uses the camera, such as Tencent Meeting, and the setting can’t be shared.
Used scenarios
At home, I often run my Mac in host mode. In host mode, mic/camera is unavailable. At this time, if there is a video demand, the value of an external camera will appear, and the camera quality of the Mac is not so good as well.
Support Alfred
After solving how to use the external camera, looking back at the efficiency plug-in support of netizens, the Mac GUI must have a setting place, or the terminal/command has corresponding support.
I found that through the command system_profiler SPCameraDataType -json that comes with the Mac after searching material, I can get all the camera devices connected to the Mac, but script control to open a camera is not supported, therefore it is impossible to switch cameras with one key in Alfred.
Finally, the conclusion is that the camera list can be displayed, but the specific operation to open a camera is not work.
Write at the End
When the Mac is turn off, the external camera still needs to be operated in a specific app. At present, there is no way to solve this automatically.
Posted onEdited on Symbols count in article: 2.5kReading time ≈2 mins.
It has been a few months since Alfred launched Universal Action, and I have become accustomed to using it to solve demands of some scenarios. Here is a summary of the role that action plays in my efficient use.
Position of Universal Action
Here, let’s talk about the difference between this interaction method and the keywords and hotkey scenarios provided by Alfred before.
Main Difference
The fundamental difference between Universal Action and the previous scene is the difference in trigger conditions. The trigger condition of Universal Action is that you select any element [file/link/text], and execute an action based on such an input value. For example, you can select a piece of text, automatically send Twitter, send emails, select a URL to automatically open browser links, etc., and the previous scene is your direct keyword or hotkey. So the difference is mainly here.
Therefore, when there is a certain requirement, you only need to consider what the interaction scenario is, and then choose an appropriate way to solve it.
Position
Universal Action can be used to perform an operation based on an element [file/link/text]
Common Points
The essence is workflow. For example, if you develop it yourself, you will create a workflow. The main difference is that the interaction/triggering method is different.
Common Action Sharing
If you can’t fully understand, please check below example:
String Manipulation by yourself
Sometimes if you want to change the format of the selected text, such as Pascal, kebab, upper snake, etc. At this time, I only need to select the target text, ⌘\ to evoke, select the corresponding action and press Enter to modify successfully
If it is a commonly used editor, it generally has this feat, but considering the scenarios without IDE, such as browsers, this is still in demand
Sometimes I want to personalize the open app in a certain format, such as PDF, I don’t want to use preview, so I can wake up, select Open with, and then select the target app and press Enter
Note that Open with only changes the open app this time, it is not permanent. If you need to change the open app of a certain file type, you need to modify the default open app in the file details
Hotkey Setting
My hotkeys are set as follows
Alfred’s hotkey is ⌘ double tap i.e. double tap ⌘
The hotkey for Universal Action is ⌘\
Consideration points: Both types of triggers belong to Alfred, so the hotkey settings are close, and ⌘ is the modifier key used in high frequency
Write at the End
I haven’t written an Alfred user guide for a long time, because the efficiency workflow that conforms to my habits has been polished through continuous use, and there are not many new things.
I didn’t think Universal Action is useful to me from the beginning, but after trying it a few times, I gradually realized that it still has certain usage scenarios, so you still need to try to use it for new things, otherwise you may lose the opportunity to improve
Posted onEdited on Symbols count in article: 2.1kReading time ≈2 mins.
I really like the sense of achievement obtained by open source projects. In the past year, I have insisted on doing several open source projects, and I have also gained some stars from netizens, some also add WeChat, raise requirements, the charm of open source is here.
For example, if someone stars your project, it would be better to be able to receive telegram notifications in time, because the NPM package release notification has been done before, so this is easy to do, but because there are still some pitfalls, so mark here, maybe help some friends.
There are many variables in GitHub Action, ${{ github.event.repository.name }}, ${{github.repository}} are context variables, which do not need to be configured, use directly, ${ { secrets.TELEGRAM_TO }} is a warehouse configuration variable, which needs to be set in the warehouse settings.
GITHUB_SERVER_URL is not Worked?
The official website has said that the default environment variable is $GITHUB_SERVER_URL, and the usage method is $GITHUB_SERVER_URL, but if it is written in the above message, it will not work, the reason is that the environment variable is used when using the shell, if it is a job The github context needs to be used in the step
Telegram Configuration Parameter Acquisition
TELEGRAM_TOKEN
Through @BotFather, create a Bot to obtain, note that the complete format of the Token will be like this 12345678:BBFntuCD6nRx1ZIYZ-eCyfP1UO4FeAjnz2M
TELEGRAM_TO
Need to send a message to the bot, make sure chat is turned on
Visit https://api.telegram.org/bot$TELEGRAM_TOKEN/getUpdates to get the chatID in it
Write at the End
As above, you can realize the telegram notification, start!
Posted onEdited on Symbols count in article: 990Reading time ≈1 mins.
I love Alfred so much that once I find one of my efficiency needs, I will study the feasibility of Alfred. If it is feasible, I will immediately find a third-party or my own custom development. Until today, I have developed 16 workflows, and there are also many experience posts, so proud of myself.
Whether it is self-developed or third-party, most of them are used frequently in my daily life. Share here, maybe I can help some friends.
Notice
Click the workflow title link to access the download page. The download page will have an introduction, so I won’t go into details here, just show the main functions with GIF animation
Posted onEdited on Symbols count in article: 2.4kReading time ≈2 mins.
I have always liked to use Alfred’s Snippet to input commonly used text blocks, and also support configure some parameters, which can usually save the time of inputting repeated text. For example, we often did CR before and we needed a simple summary at the end. In order to improve the efficiency of the summary, I made a Snippet.
But the downside of Snippet is that Alfred only exists on MacOS, and I am unhappy as an Apple user. Because the Apple system itself has text replacement function, I had to place a part of the text block in the system layer configuration, so that it can be supported across Apple devices. However, if use the two at the same time, will cause issues. So I thought about the cooperation between the two, and marked it here.
Alfred Snippet vs Apple Text Replacement
First, let’s sort out the differences between the two.
Platform limitations
Alfred only supports Mac, there is no iOS version. There is a remote App, but the essence is only to remotely control some functions of the Mac version App, not a real iOS ported version
Apple’s text replacement will be synchronized to each device using iCloud, and once modified, all devices can be used immediately
Functional limitations
Alfred’s Snippet itself supports various variables. In addition, it can use workflow to achieve more powerful replacement, and it can also control the position of the final cursor. In a word, it is powerful
Apple’s text replacement is relatively simple, just replace between strings
On the Mac system, text replacement in EN state does not work in all apps, such as MacDown, or the address bar of Chrome, but the above apps work in Chinese. Comparing devices, such as iPhone and iPad, work both in EN and Chinese. It is estimated that there is an App adaptation problem with text replacement.
Uniform convention
text prefix
Although text replacement is good, if the text itself has no features, it will often be accidentally triggered in actual high-frequency input. In order to solve this problem, it is necessary to formulate a prefix, here I use t, such as codereview, it will be tcodeview.
There are some considerations for this
Letters are better than special symbols
Because this text replacement scheme is often used in the iPhone, and the layout of the mobile phone keyboard determines the letter prefix, the text replacement can be quickly implemented without switching the keyboard, which is more efficient.
t means text, better associative memory, friendly
Text Phrase Division
As mentioned above, Alfred does not cross terminals, so for daily simple text phrases, such as mobile phone number, home address, email and other high-frequency input simple text, configure it at the Apple system level
For complex ones used at work and mainly solved on the desktop side, configure in Alfred
Effect
Alfred Snippet
Apple Text Replacement
Write at the End
Constantly polishing tools, high efficiency is the king
Posted onEdited on Symbols count in article: 1.3kReading time ≈1 mins.
Because of the large-screen display at home, I likes to use the host mode without using the screen on Mac. But note that if Mac is on closed-display mode, the mic of the Mac itself is not available, and the speakers can still be used normally. If you want to use the mic normally, just switch to the headset, but if you don’t want to use the headset, then the question is, how to connect the mic?
Buy Mic and Headphone Adapter Cable
The cost is listed as below:
Asphan (XFAN) D1 set top microphone 153RMB
UGREEN headphone and microphone one-to-two transfer cable 21RMB
Installnation
Notice
If you see that the Mac recognizes the external mic normally, the connection is successful As shown above
To use XFAN’s camera cable that is two-level cable to connect to the mic input of the UGREEN adapter cable
Although I have not connected the headset here, but you can see the external headset in the Mac-sound-input device, just ignore it
I saw some introductions on the Internet that it is necessary to ensure that the headphones with the adapter cable also need to be connected to ensure that the Mac can detect the external mic normally. After testing, it is not necessary
Fixed on table
Since I am using it on a desktop Mac, it needs to be fixed.
The following two schemes can be used after try
Blue Butadiene solved
Mini portable tripod with 1/4 screw
Currently I use option 1
Write at the End
After simple settings as above
On closed-display mode, you can use the Mac’s built-in speaker + external mic, nice!
Of course, you can also use an external speaker such as HomePod alone, which is flexible.
Posted onEdited on Symbols count in article: 3.2kReading time ≈3 mins.
I have combed before, my commonly used APP, commonly used hardware. This time, I will sort out the plugins that Chrome uses every day, and share my experience.
For the plugins I use, they can be roughly divided into two categories.
For someone with poor written English, it’s fantastic, and is free. Sometimes it is often necessary to write questions and comments on platforms such as GitHub or medium. With this plugin, combined with Google Translate, at least basic communication problems are solved.
For some operations on web pages, you can use vim habits, such as G to quickly move to the bottom, yy to copy the current URL. After these operations are proficient, part of the efficiency can be improved.
Note that because the shortcut keys conflict with the GitHub webpage shortcut keys, you need to add exclusion rules
This plugin can browse GitHub repositories in the form of a tree, which I like very much.
Tampermonkey This plug-in, I personally feel that as a supplement to all plug-ins, uses JS to achieve personalized operations on the target site collection. For example, a movie download website that I often visit, it loads some advertising JS, which leads to entering the website, clicking on the movie, and always jumping to a rogue website first, which is very annoying. So this plugin comes in handy.
For a website you are visiting, you sometimes need to know the basic information of the website, such as which country the corresponding service is in, IP information, and so on.
For well-known reasons, we can’t access Google normally, and so can’t enter the store to download plug-ins. But chrome can install plugins offline. So how to find the crx file of the plugin?
Recommend such a website, enter the store address of the plug-in, and click to download the file. Also this site is not walled.
Click the chrome extension, drag the crx file into chrome, and it will be installed automatically
Although the above solution can solve the problem of plug-in installation when Google cannot be used. But I sincerely hope that the Google problem will be solved, this is the root cause.
Write at the End
The above are the plug-ins that I commonly use, or the same sentence, don’t use tools for the sake of tools, and don’t use efficiency for the sake of efficiency. It is the best to find the one that suits you and solve the actual problem after being familiar with it.