Tuesday, September 24, 2024

Avoid unnecessary hidden files like .DS_Store on Mac

Each file occupies 4k, which can become a lot of waste in disk space and speed.

Based on this webpage, use the following command to disable MacOS from creating those hidden files on network and USB drives:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

Another elegant way is to use TinkerTool or CleanMyMac.

Monday, August 19, 2024

 Optimize MTU on internet

Maximum Transmission Unit (MTU) is a setting in TCP/IP. If not properly set, the internet speed could be slow down. This blog provides details on how to test and optimize the MTU.

Wednesday, July 24, 2024

Listing only folders in MacOS shell

On Linux/Unix, one can use "ls -d" to display folders. But somehow this doesn't work in MacOS. Instead, one should use " ls -d */" to display folders. 

Tuesday, May 21, 2024

Install Linux as dual boot with Windows

 Although Windows can run Linux as a subsystem, it may not work properly when GUI is needed. To install Ubuntu as a dual boot system is very straightforward:

1. Download Linux ISO file.

2. Use Etcher to create a bootable USB for Linux. Etcher supports Windows, MacOS and Linux.

3. After using the USB to boot up Windows PC, it allows you to adjust partition of your C: drive to make space for Linux. No need to use other disk partition tools anymore!

After the installation and rebooting, the dual boot menu may not show up and the PC still boots into Windows. Do the following:

4. Go to Setup --> Windows Update --> Recovery, and choose to restart.

5. After rebooting into the recovery mode, choose Troubleshoot --> Advanced --> Repair Disk Image.

Then the system will reboot again. This time the dual boot menu shows up! Done!

Wednesday, May 15, 2024

Switch off internal display of MacBook when connected to external monitor

When connected to external monitor, MacBook still has its internal display turned on. This dual display mode consumes GPU power and drags down performance on graphics and games. BetterDisplay is a powerful tool to customize tones of settings, including turning on/off each display/monitor connected.

Tuesday, March 19, 2024

Monitor Apple M1/M2 CPU performance

 MacBook Air with Apple Silicon CPU is very efficient but it comes with a cost -- reduced CPU performance during heavy-duty jobs. This is due to the lack of cooling fan so the CPU needs to reduce clock speed to prevent overheating.

To monitor this performance change, there are two handy tools:

  • asitop: use simple ASCII graphics to show CPU/GPU frequency and power usage.
  • influxDB dashboard: if you like nice-looking GUI, this is your choice.

To overcome this bottleneck, there are a few ways shown by Max Tech on youtube.

Monday, July 03, 2023

Optimize Java JVM for Matlab


Matlab UI has been very slow and buggy on MacOS due to the default JVM. A fast JVM can be used to fix this: 

1. Download and install Azul JDK 8
    NOTEJDK 11 would also work on latest version of Matlab. Newer version doesn't work with Matlab.

2. Set the new JVM to Matlab using matlab_jenv command:
/Applications/MATLAB_R2021b.app/bin/matlab_jenv /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/
    NOTE: can also run jenv command in Matlab to assign the path of new JVM.
    NOTE: for JDK 11, use /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/

3. Run Matlab and confirm the new JVM by 'version -java'

4. To reset to default JVM, use:
/Applications/MATLAB_R2021b.app/bin/matlab_jenv factory