TEST

Modify .hcacess on Apache Server to allow CORS for specified domains

Motivation

I purchased a .tech domain recently, and made it a alias domain to hollen9.com.
However, some src requests are blocked due to CORS policy.
Typical symptoms are blank images, failure to load external fonts, scripts, etc. You can verify it by checking your dev console on the browser by pressing Shift+Ctrl/Command+i.

Solution

Locate your .htacess file of your website, for analog it is a config file just like web.config on IIS.
Open it with a text editor, insert the following:

# Allow loading of alias domain resources # You should modify the domains to suit your needs. SetEnvIf Origin "http(s)?://(www\.)?(holllen.tech|hollen9.com)$" AccessControlAllowOrigin=$0 Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin Header merge Vary Origin

Force reload your previous page by pressing Ctrl+F5 or Command+Shift+R, and viola! Now all images are visible!

References

TEST

Easy rclone to quickly backup to Google Drive

> NPC appeared! > Company boss: Brave, please don't delay other work during the completion process! ────────────────────────────────── = [1 local or LAN copy and paste] = = 2 hard Dish to copy = = 3 Escape = = 4 Charm the boss = ──────────────────────────────────── > The brave chose 1. Windows can use fastcopy, but the brave man thinks it takes too much time, so option 1 is not considered. ──────────────────────────────── = = = [ 2 hard disk copies] = = 3 escape = = 4 Charm Boss = ──────────────────────────────────── > The hero chose 2, which should be the fastest, However, the target hard disk should also be backed up to avoid failure. That leaves option 3, and the new unknown option. ──────────────────────────────── = 5 rclone????????? = = = = [ 3 Escape] = = 4 Charm the Boss = ────────────────────────────────── > The hero wants to choose 3, but The heart tells the brave not to escape! I can't always choose 4, so I had to choose 5 > ..? > ..??? > ...!! > rclone took the initiative to solve all the troubles with lightning speed.

I'm sorry for such an 87 opening statement, and I promise to be no nonsense.

rclone one line command, backup all files on the hard disk to Google Drive or other space.
And it's super easy to set up! Below I demonstrate the simplest method, use the built-in GUI to set up Config, and then enter the command to start the backup.

Set up Config to connect to the cloud

After downloading rclone, cd to the same folder, enter the following commands to Terminal such as cmd / bash / zsh.

rclone rcd --rc-web-gui

powershell requires input

"./rclone.exe" rcd --rc-web-gui

This will open the local webserver, allowing you to have an easy-to-use interface.
Enter Config, go to Google Developer Console to open Google Drive Api, set OAuth, copy ID and Key to the corresponding fields, and the next step will be done.

Click Explorer, click the path input box, it will jump out of the Config Name you just set. After clicking, you can browse the cloud drive just like the web version of Google Drive. We create the destination folder that we want to back up and copy the current path, such as this format:
MyGoogleDrive01:/MyBackupFolder/Laptop01/2022

We can go back to Terminal and enter Ctrl + C or Command + C Shut down the webserver.

Enter the following command and it will start backing up everything in C: to Google Drive!
--progress It is to return the upload progress. Without this arg, the Terminal will only be blank, and there is no way to know the backup progress.

rclone copy "C:/" "MyGoogleDrive01:/MyBackupFolder/Laptop01/2022" --progress

Files that fail to copy are skipped, such as files occupied by the system.

TEST

Taiwanese Windows users to M1, M2… macOS list

*This article is for Taiwanese readers who use TranditionalChinese as their language!

This article is my own notes and will be updated continuously.
Suitable for Taiwanese who are used to Windows, making using macOS on Apple Silicon more comfortable.
All paid software will be marked, if not marked, it is free.

  • Freemium - Free for basic features
  • Premium - Payout
  • Subscription - Paid subscription system

Easy and quick to get started

Chinese phonetic input method

Single or long press Ctrl+  or Command +   switch input method

  • Yahoo! Qimo Phonetic Fork Edition - Although it's outdated, I've used wheat and Wei Zhuyin and I've been crushed... In the end, I decided it was him. The usage habits are completely the same as Windows, except that the English input case is a bit sleepy.
  • Wheat Phonetic - Stable to use, not easy to pawn off. The obvious disadvantage is that punctuation ' Enter full-form symbols such as commas and periods in word selection (numbers).
  • Wei Zhuyin - a branch of wheat phonetic, the biggest advantage is that the input method of punctuation is the same as that of Windows. Other differences can refer to: What is the difference between Wei Zhuyin and Mai Zhuyin? -gitee/vChewing-macOS
    I myself like Wei Zhuyin very much, but I still have to switch back to the wheat Zhuyin for backup occasionally.

Windows, toolbar, dock management

  • Tile - Windows 7+-like edge automatic Snapping mechanism
  • uBar (Premium) - similar to the Windows 10 work bar, replace the original Dock, high customization
  • System Preferences > Mission Controls > Hot Zones
    Move the mouse to the lower left corner to open Launcherpad (application selection),
    Move the mouse to the lower right corner to display the desktop.

keyboard text manipulation

  • Home, End Button Reassignment - Changes Home, End button behavior to Windows-like text-oriented functionality. Do the following in Terminal or iterm 2:

    mkdir -p $HOME/Library/KeyBindings echo '{ /* Remap Home / End keys to be correct */ "\UF729" = "moveToBeginningOfLine:"; /* Home */ "\UF72B" = "moveToEndOfLine:"; / * End */ "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */ "$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */ "^\UF729" = "moveToBeginningOfDocument:" ; /* Ctrl + Home */ "^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */ "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */ "$^ \UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */ }' > $HOME/Library/KeyBindings/DefaultKeyBinding.dict
  • Copy Less 2 (Freemium) - Scrapbook like Windows 10, 11

Mouse, trackpad assist

  • ThreeFinger - Enables a three-finger tap or click to trigger the middle mouse button to quickly close a tab and open a new tab.
  • exelban/stats - Free and open source menu bar CPU, RAM, battery status monitoring.

Seamless screen switching across platforms (software KVM)

My three-screen main screen is 144hz with macOS and the secondary screen next to it is Windows 11.

  • Barrier - Very convenient to use, scrapbook records are also synced. The disadvantage is that the setting interface GUI is blunt, and you may not know how to use it at first.

download software

  • The advantage of Baidu Cloud HD - Apple Silicon version is that you can directly install the iOS version, so you don't have to worry about the ransomware problem of Chinese software.
  • Electorrent - A cross-platform BT remote control software that allows you to download the browser's magnetic link painlessly.

decompression software

  • Bandizip (Premium) - Korean zip compression software that supports multi-language encoding, supports 7z and other formats.

Office

The Office downloaded from the mall are all 365 subscriptions, if you have an educational account, you can use it. Go to the university to see if they have access to OneDrive/Outlook.
If not, what you need is the LTSC version, and you will find that it is easier to bypass than Windows (if you know it).

network hard drive

  • WebDAV - The way the Finder is wired is Go > Connect To Server

multimedia video

  • Spotify - AppStore does not have it, please download it from Spotify official website.

Terminal (CMD, Bash)

  • iTerm - Try this better Terminal software before turning Terminal black yourself.

Web browsing related

  • Adguard (Freemium) - Blocks adware, it's special on the home version every now and then, you can pay attention to the PTT money-saving version.

email

  • Microsoft Outlook - I think it is easier to use than the built-in one. It supports POP3, IMAP, so Gmail. Company mailboxes and school mailboxes are not a problem.

Empower iOS devices to use the free store

  • AltServer
TEST

Introduce: LangBranch Shortcode

View Plugin Page On WordPress.org

What is LangBranch

It's a simple plugin enable you to use a shortcode like below to display correspond language version of content based on get_locale().

[langbranch aio en_US="English version" en_GB="en_US" zh_TW="Chinese version" ja_JP="Japanese バージョン"] [langbranch en_US] Content here will only be displayed if get_locale() returns "en_US". [/langbranch ] [langbranch en_US zh_TW] Content here will only be displayed if get_locale() returns "en_US" or "zh_TW". [/langbranch]

Motivation

I've been using TranslatePress to provide multi locale experience for visiters.
However, I had been suffering from losting translated content once I updated original language's content, until I decided to create a simple shortcode to solve this problem.

Usages

AIO (1-liner) Mode

[langbranch aio en_US="English version" en_GB="en_US" zh_TW="Chinese version" ja_JP="Japanese バージョン"]

By appending aio after langbranch main tag, you can setup one specific paragraph in several languages, and if you decide that some locale user to share the same language, you can just type the locale code you want to refer to directly in content. For example, you can make UK version the same as US version.

However, if LangBranch go too deep (chain over 5 stacks) it will fail.
Don't do this:

--1---||---2---||---3---||---4---||---5---||---6-- -> Oh no!
en_US -> en_GB -> en_AU -> en_HK -> zh_TW -> ja_JP

Seperate Mode

[langbranch en_US] Content here will only be displayed if get_locale() returns "en_US". [/langbranch] [langbranch en_US zh_TW] Content here will only be displayed if get_locale() returns "en_US" or "zh_TW". , only displayed when get_locale() returns "en_US" or "zh_TW". [/langbranch]

Very straight forward, isn't?
But when using several shortcodes, I would suggest you don't put a linebreak between [/langbranch] and [langbranch], in order to prevent unwanted linebreak <br> being rendered.

Optional step

All contents enclosed by [langbranch] will be rendered enclosed by <div class="langbranch" data-no-translation=""></div>
So if you are using auto machine translating like TranslatePress offers, you may want to exclude all selector .langbranch.

Recaps

This plugin is at its early stage of developing, so you may encounter some issues while using it.
For the worst case, it breaks your site up.
If that happens, don't be panic! Just go to your wp-content/plugins directory and delete langbranch and you shall be fine.

TEST

Vantage Theme Issue: Sticky Nav doesn't work on mobile view

Solution


Just simply comment out && !isMobileDevice, and it will work like a charm!

Github solved issue: #1

However, to do this directly on a theme However, to do this directly on a theme could be changed in any future updates is probably not a good idea.

Instead, we copy that .js file to our child theme js directory.
Then, we have to dequeue the original .js by inserting the commands to your child theme's functions.php:

function vantage_child_enqueue_parent_style() { wp_dequeue_script('vantage-main'); wp_enqueue_script('vantage-main', get_stylesheet_directory_uri() . '/js/vantage-hollen-main.js', array( 'jquery' ) ) ; } add_action( 'wp_enqueue_scripts', 'vantage_child_enqueue_parent_style', 8 );

In this way, any future minor update pushed by Vantage Dev Team won't clear your modified code, as long as there won't be any structural changes, like ids's and/or classes' renaming.

Reflection

It took me almost two hours at late night debugging (3 AM), and it almost got me: I thought it was caused due to the lack of support of $(body) and scrollTop() on mobile device. Tried so many solution to no avail, then I decided to go to sleep.
and you know what, I solved it in 30 minutes after having a lunch at noon.