Software

Plank is a popular application launcher dock in Linux. By default, most application desktop entries do not provide any additional actions. Say we want to add an open ‘new window’ action to our desktop entry for pkgbrowser:

/usr/share/applications/pkgbrowser.desktop

Our desktop entry file looks as follows:

[Desktop Entry]
Name=PkgBrowser
GenericName=Package Browser
Comment=A utility for browsing pacman databases and the AUR
Exec=pkgbrowser
Terminal=false
Type=Application
Icon=pkgbrowser
StartupNotify=false
Categories=Qt;System;

Simply add the following to the end of the file. Of course, if your desktop entry already has a defined Actions property, you’ll want to add this new-window to it.

Actions=new-window;

[Desktop Action new-window]
Name=New Window
Exec=pkgbrowser

Now, right-clicking the desktop entry will appear as follows:

By default, any desktop entries that come from packages for your Linux distro will be overwritten during a package update. To prevent this from happening, you can made the file read-only using chattr:

sudo chattr +i /usr/share/applications/pkgbrowser.desktop

If the gcc version being used is incompatible with cuda version, there will be errors such as:

[ 68%] Building NVCC (Device) object src/nvtt/CMakeFiles/cuda_compile_1.dir/cuda/cuda_compile_1_generated_CompressKernel.cu.o
/usr/include/c++/10.1.0/type_traits(1396): error: type name is not allowed

/usr/include/c++/10.1.0/type_traits(1396): error: type name is not allowed

/usr/include/c++/10.1.0/type_traits(1396): error: identifier "__is_same_as" is undefined

3 errors detected in the compilation of "/home/nick/Code/Git/github.com/nvidia-texture-tools/src/nvtt/cuda/CompressKernel.cu".
CMake Error at cuda_compile_1_generated_CompressKernel.cu.o.Release.cmake:280 (message):
  Error generating file
  /home/nick/Code/Git/github.com/nvidia-texture-tools/cmake-build-release/src/nvtt/CMakeFiles/cuda_compile_1.dir/cuda/./cuda_compile_1_generated_CompressKernel.cu.o


make[2]: *** [src/nvtt/CMakeFiles/nvtt.dir/build.make:85: src/nvtt/CMakeFiles/cuda_compile_1.dir/cuda/cuda_compile_1_generated_CompressKernel.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:721: src/nvtt/CMakeFiles/nvtt.dir/all] Error 2
make: *** [Makefile:183: all] Error 2

See discussion on GitHub: CUDA Build error on Arch Linux and CUDA Compilers – nvcc compatibility chart.

This can be resolved by using an earlier version of GCC which is compatible with the CUDA version. In my example setting the following CMake variable resolved the issue:

	-DCUDA_HOST_COMPILER=/usr/bin/gcc-9

The default version of gcc in the Arch Linux repositories is now gcc10:

➜  ~ pacman -Qo /usr/bin/c++
/usr/bin/c++ is owned by gcc 10.1.0-2

This can result in errors during linking while building packages, such as:

[ 75%] Linking CXX executable ../../../../../bin/sst_conn_tool
/usr/bin/ld: ../../../../../lib/libadios2_core.so.2.6.0: undefined reference to `int adios2::format::DataManSerializer::GetData<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&)'
/usr/bin/ld: ../../../../../lib/libadios2_core.so.2.6.0: undefined reference to `int adios2::format::DataManSerializer::GetData<float>(float*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&)'

This issue can be resolved by compiling with an earlier version of gcc:

➜  ~ pacman -Qo /usr/bin/g++-9
/usr/bin/g++-9 is owned by gcc9 9.3.0-3

Setting these CMake variables will result in using the gcc9 version of gcc, g++, gcc-ar, and gcc-ranlib:

        -DCMAKE_CXX_COMPILER=/usr/bin/g++-9 \
        -DCMAKE_CXX_COMPILER_AR=/usr/bin/gcc-ar-9 \
        -DCMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-9 \
        -DCMAKE_C_COMPILER=/usr/bin/gcc-9 \
        -DCMAKE_C_COMPILER_AR=/usr/bin/gcc-ar-9 \
        -DCMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-9 \

System preferences can be set on macOS using the defaults command. For example, say I wish set the Prevent sleep setting that can be set through the System Preferences interface, but instead via command line.
macOS - System Preferences - Energy Saver - Prevent sleep - disabled

If your settings match those in the screenshot above, running defaults read /Library/Preferences/com.apple.PowerManagement.plist in the terminal should output

{
    "AC Power" =     {
        "Automatic Restart On Power Loss" = 1;
        DarkWakeBackgroundTasks = 1;
        "Disk Sleep Timer" = 180;
        "Display Sleep Timer" = 5;
        "Display Sleep Uses Dim" = 1;
        GPUSwitch = 2;
        "System Sleep Timer" = 15;
        "Wake On LAN" = 1;
    };
    "Battery Power" =     {
        "Automatic Restart On Power Loss" = 1;
        DarkWakeBackgroundTasks = 0;
        "Disk Sleep Timer" = 180;
        "Display Sleep Timer" = 5;
        "Display Sleep Uses Dim" = 1;
        GPUSwitch = 2;
        ReduceBrightness = 1;
        "System Sleep Timer" = 10;
        "Wake On LAN" = 1;
    };
    SystemPowerSettings =     {
        DestroyFVKeyOnStandby = 0;
        "Update DarkWakeBG Setting" = 1;
    };
}

To set System Sleep Timer to 0, run /usr/libexec/PlistBuddy -c "Set 'AC Power':'System Sleep Timer' 0" /Library/Preferences/com.apple.PowerManagement.plist. Now running the original defaults read command will output

{
    "AC Power" =     {
        "Automatic Restart On Power Loss" = 1;
        DarkWakeBackgroundTasks = 1;
        "Disk Sleep Timer" = 180;
        "Display Sleep Timer" = 5;
        "Display Sleep Uses Dim" = 1;
        GPUSwitch = 2;
        "System Sleep Timer" = 0;
        "Wake On LAN" = 1;
    };
    "Battery Power" =     {
        "Automatic Restart On Power Loss" = 1;
        DarkWakeBackgroundTasks = 0;
        "Disk Sleep Timer" = 180;
        "Display Sleep Timer" = 5;
        "Display Sleep Uses Dim" = 1;
        GPUSwitch = 2;
        ReduceBrightness = 1;
        "System Sleep Timer" = 10;
        "Wake On LAN" = 1;
    };
    SystemPowerSettings =     {
        DestroyFVKeyOnStandby = 0;
        "Update DarkWakeBG Setting" = 1;
    };
}

Now opening the System Preferences will reveal the updated value.
macOS - System Preferences - Energy Saver - Prevent sleep - enabled

Notepad++ is undoubtedly one of the most popular code/text editors available for Windows. While it does not run natively on Linux (or macOS), many have ran it successfully with Wine. There is also a clone of Notepad++ called Notepadqq that runs natively on Linux that is written using the well-known cross-platform UI library Qt.

  1. Download a fresh copy of VMware Workstation Player for Windows or Linux from the official VMware site. The free trial of this product has no expiration if used for non-commercial purposes.
  2. You’ll need to unlock your installation of VMware to use Mac operating system as a guest following these instructions (external link).
  3. On a computer running an official/genuine instance of OS X, download macOS High Sierra from the App Store:
    App Store - macOS High Sierra
  4. Once the download completes, open the Terminal application, and either save a new file with the following contents,
     #!/bin/bash
    # Mount the installer image
    hdiutil attach /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/macOS-High-Sierra
    
    # Create the macOS-HighSierra Blank ISO Image of 7316mb with a Single Partition - Apple Partition Map
    hdiutil create -o /tmp/macOS-HighSierra-Base.cdr -size 7316m -layout SPUD -fs HFS+J
    
    # Mount the macOS High Sierra Blank ISO Image
    hdiutil attach /tmp/macOS-HighSierra-Base.cdr.dmg -noverify -mountpoint /Volumes/install_build
    
    # Restore the Base System into the macOS High Sierra Blank ISO Image
    asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    
    # Remove Package link and replace with actual files
    rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
    cp -R /Volumes/macOS-High-Sierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
    
    # Unmount the installer image
    hdiutil detach /Volumes/OS\ X\ Base\ System/
    
    # Unmount the macOS High Sierra ISO Image
    hdiutil detach /Volumes/macOS-High-Sierra/
    
    mv /tmp/macOS-HighSierra-Base.cdr.dmg /tmp/BaseSystem.dmg
    
    # Restore the macOS High Sierra Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
    hdiutil create -o /tmp/macOS-HighSierra.cdr -size 8965m -layout SPUD -fs HFS+J
    hdiutil attach /tmp/macOS-HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
    asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
    cp /tmp/BaseSystem.dmg /Volumes/OS\ X\ Base\ System
    hdiutil detach /Volumes/OS\ X\ Base\ System/
    
    # Convert the macOS-Sierra ISO Image to ISO/CD master
    hdiutil convert /tmp/macOS-HighSierra.cdr.dmg -format UDTO -o /tmp/macOS-HighSierra.iso
    
    # Rename the macOS-Sierra ISO Image and move it to the desktop
    mv /tmp/macOS-HighSierra.iso.cdr ~/Desktop/macOS-HighSierra.iso
    rm /tmp/macOS-HighSierra.cdr.dmg

    or run

    curl https://www.nickmcummins.com/make-macos-high-sierra-iso.sh > /tmp/make-macos-high-sierra-iso.sh

    and then execute it by running sudo chmod +x /tmp/make-macos-high-sierra-iso.sh && /tmp/make-make-macos-high-sierra-iso.sh. Once completed, you should see a file named macOS-High-Sierra.iso on your desktop.

  5. Now boot up VMware Player and create a new virtual machine using the File dialog. Using the iso disk image we just created, and with macOS 10.13 selected as the guest os, finish the setup for your new image.
    Guest Operating System - Select macOS 10 13
  6. You’ll need to erase the virtual hard disk medium as seen in the following screenshots. DiskUtility - VMware Virtual STA hHard Drive
    DiskUtility - Erase Hard Drive confirmation
  7. Now you will be able to proceed with the installation. Once completed, you should be all ready to enjoy your new macOS High Sierra vm!
    Installation macOS Sierra
    macOS Sierra Screenshot

Screenshot tools for Linux and macOS generally produce image files in the .png file format. PNG is a lossless compression format, meaning that it can be compressed without losing quality, which is unlike another commonly used image format, JPG. There are 3 command-line tools which can be used to compress PNG files, pngout, optipng, and advpng.

➜  pngout terminator-terminal-window.png 
 In:   11405 bytes               terminator-terminal-window.png /c6 /f5
Out:    8790 bytes               terminator-terminal-window.png /c2 /f5
Chg:   -2615 bytes ( 77% of original)
➜  optipng -o7 terminator-terminal-window.png 
** Processing: terminator-terminal-window.png
800x266 pixels, 3x8 bits/pixel, RGB+transparency
Input IDAT size = 8715 bytes
Input file size = 8790 bytes

Trying:
  zc = 9  zm = 9  zs = 0  f = 0		IDAT size = 8140
  zc = 9  zm = 8  zs = 0  f = 0		IDAT size = 8140
                               
Selecting parameters:
  zc = 9  zm = 8  zs = 0  f = 0		IDAT size = 8140

Output IDAT size = 8140 bytes (575 bytes decrease)
Output file size = 8215 bytes (575 bytes = 6.54% decrease)

➜  advpng -z4 terminator-terminal-window.png 
        8215        7232  88% terminator-terminal-window.png
        8215        7232  88%