[!TIP]

installer

[!NOTE]

sdkman

$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"

$ sdk version
SDKMAN!
script: 5.18.2
native: 0.4.6

$ sdk install gradle

cargo

$ curl https://sh.rustup.rs -sSf | sh

snap

# debine
$ sudo apt update
$ sudo apt install snapd

# fedora
$ sudo dnf install snapd
$ sudo ln -s /var/lib/snapd/snap /snap

application

python

vim

nvim

copilot

[!NOTE|label:references]

CLI



GitHub Copilot CLI

$ npm install -g @github/copilot-cli
$ copilot review --pr ${{ github.event.pull_request.number }} --repo ${{ github.repository }} > review_output.txt

java

  • download jdk 1.8.0_121

    $ mkdir -p /opt/java && cd /opt/java
    $ wget --no-check-certificate \
           -c \
           --header "Cookie: oraclelicense=accept-securebackup-cookie" \
           http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
    
    # or
    $ curl -L -C - -b "oraclelicense=accept-securebackup-cookie" \
           -O http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
    $ tar xf jdk-8u121-linux-x64.tar.gz
    
    # or
    $ curl -L -C - -b "oraclelicense=accept-securebackup-cookie" \
           -fsS http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz |
      tar xzf - -C /opt/java
    
  • setup java environment

    $ sudo bash -c 'cat >> /etc/bash.bashrc' << EOF
    JAVA_HOME="/opt/java/jdk1.8.0_121"
    CLASSPATH=".:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar"
    PATH=/home/marslo/.marslo/myprograms/vim80/bin:$JAVA_HOME/bin:$PATH
    export JAVA_HOME CLASSPATH PATH
    EOF
    
  • setup default jdk

    $ sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_121/bin/java 999
    $ sudo update-alternatives --auto java
    $ sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.8.0_121/bin/javac 999
    $ sudo update-alternatives --auto javac
    

groovy

  • download groovy binary pakcage

    $ mkdir -p /opt/groovy && cd /opt/groovy
    $ wget --no-check-certificate -c https://akamai.bintray.com/1c/1c4dff3b6edf9a8ced3bca658ee1857cee90cfed1ee3474a2790045033c317a9?__gda__=exp=1490346679~hmac=6d64a1c3596da50e470fb6a46b182ba2cacab553c66843c8ea292e1e70e4e243&response-content-disposition=attachment%3Bfilename%3D%22apache-groovy-binary-2.4.10.zip%22&response-content-type=application%2Foctet-stream&requestInfo=U2FsdGVkX19cWhR3RJcR6SCy74HUcDg470ifD-nH2EiE5uxtdI5EbUiW_jGoHgZZTVR3qgks9tiU5441axygT9z3ykqpL45d_-9oyTlOp8Gild5Z7iGRzCiwf0kba9uza8iWDxnIxgnUIg5tDe6N8ZQ3R0yFCY4c4w7czwBGyK0
    $ unzip apache-groovy-binary-2.4.10.zip
    
  • setup groovy environment

    $ sudo bash -c 'cat >> /etc/bash.bashrc' << EOF
    export GROOVY_HOME="/opt/groovy/groovy-2.4.10"'
    export PATH=$GROOVY_HOME/bin:$PATH'
    EOF
    
  • set default groovy

    $ sudo update-alternatives --install /usr/bin/groovy groovy /opt/groovy/groovy-2.4.10/bin/groovy 999999999
    $ sudo update-alternatives --auto groovy
    
    # or
    $ sudo alternatives --config groovy
    

groovy completions

# .bash_profile
GROOVY_HOME="$(brew --prefix groovy)"

test -d "${GROOVY_HOME}/bin" && source <( cat "${GROOVY_HOME}"/bin/*_completion )
# or
find "${GROOVY_HOME}/bin" -name '*_completion' -print0 | xargs -0 -I FILE bash -c "source FILE"

gcc

[!NOTE]

  • install

    $ mdir -p /opt/gcc
    $ curl -fsSL https://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-13.2.0/gcc-13.2.0.tar.gz | tar xzf - -C /opt/gcc
    $ cd /opt/gcc/gcc-13.2.0
    
    # prerequisites
    gcc-13.2.0 $ grep base_url= contrib/download_prerequisites
    base_url='http://gcc.gnu.org/pub/gcc/infrastructure/'
    gcc-13.2.0 $ ./contrib/download_prerequisites
    
    # config
    gcc-13.2.0 $ mkdir ../objdir && cd $_
    objdir $ ../gcc-13.2.0/configure --disable-multilib
    
    # make
    objdir $ NPROC="$(nproc)"
    objdir $ tmux                # it will take very long time to build, better using tmux to avoid interrupt by ssh session down
    objdir $ make -j${NPROC} [ | tee make.log ]
    
    # install
    objdir $ sudo make install
    
  • configure

    $ sudo mv /usr/bin/g++{,.8.5.0}
    $ sudo mv /usr/bin/gcc{,.8.5.0}
    $ sudo mv /usr/bin/c++{,.8.5.0}
    
    $ sudo alternatives --install /usr/bin/g++ g++ /usr/local/bin/g++ 50
    $ sudo alternatives --install /usr/bin/gcc gcc /usr/local/bin/gcc 50
    $ sudo alternatives --install /usr/bin/c++ c++ /usr/local/bin/c++ 50
    
  • verify

    $ gcc --version
    gcc (GCC) 13.2.0
    Copyright (C) 2023 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ g++ --version
    g++ (GCC) 13.2.0
    Copyright (C) 2023 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ c++ --version
    c++ (GCC) 13.2.0
    Copyright (C) 2023 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

info-zip

[!TIP|label:references]

brew install

[!NOTE|label:references]

$ brew install zip [unzip]
brew install zip -v --debug
$ brew install zip -v --debug
...
==> Downloading https://ghcr.io/v2/homebrew/core/zip/manifests/3.0-2
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.4.11-27-g9783ab0\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.7.2\)\ curl/8.7.1 --header Accept-Language:\ en --fail --retry 3 --header Accept:\ application/vnd.oci.image.index.v1+json --header Authorization:\ Bearer\ QQ== --remote-time --output /Users/marslo/Library/Caches/Homebrew/downloads/794b38c4c17afd41abe76b9b8dc73cabd3543bdb3816b4acca62ff0132aa1225--zip-3.0-2.bottle_manifest.json.incomplete --location https://ghcr.io/v2/homebrew/core/zip/manifests/3.0-2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11876  100 11876    0     0  26371      0 --:--:-- --:--:-- --:--:-- 26391
==> Fetching zip
==> Downloading https://ghcr.io/v2/homebrew/core/zip/blobs/sha256:99265457598a09b6312520471980b7b8429ebfef5be40d3e00a0980544ff12c2
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.4.11-27-g9783ab0\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.7.2\)\ curl/8.7.1 --header Accept-Language:\ en --fail --retry 3 --header Authorization:\ Bearer\ QQ== --remote-time --output /Users/marslo/Library/Caches/Homebrew/downloads/ebd73b309783778b2985d2b1cec6aa2ba756923db8dd48e300e04d6587ec9ef8--zip--3.0.arm64_sonoma.bottle.2.tar.gz.incomplete --location https://ghcr.io/v2/homebrew/core/zip/blobs/sha256:99265457598a09b6312520471980b7b8429ebfef5be40d3e00a0980544ff12c2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  307k  100  307k    0     0   407k      0 --:--:-- --:--:-- --:--:--  870k
==> Verifying checksum for 'ebd73b309783778b2985d2b1cec6aa2ba756923db8dd48e300e04d6587ec9ef8--zip--3.0.arm64_sonoma.bottle.2.tar.gz'
==> Verifying attestation for zip
/usr/bin/env GH_TOKEN=****** GH_HOST=github.com /opt/homebrew/bin/gh attestation verify /Users/marslo/Library/Caches/Homebrew/downloads/ebd73b309783778b2985d2b1cec6aa2ba756923db8dd48e300e04d6587ec9ef8--zip--3.0.arm64_sonoma.bottle.2.tar.gz --repo Homebrew/homebrew-core --format json
==> falling back on backfilled attestation for #<Bottle:0x000000016ba57a00>
/usr/bin/env GH_TOKEN=****** GH_HOST=github.com /opt/homebrew/bin/gh attestation verify /Users/marslo/Library/Caches/Homebrew/downloads/ebd73b309783778b2985d2b1cec6aa2ba756923db8dd48e300e04d6587ec9ef8--zip--3.0.arm64_sonoma.bottle.2.tar.gz --repo trailofbits/homebrew-brew-verify --format json
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading zip
==> Pouring zip--3.0.arm64_sonoma.bottle.2.tar.gz
/usr/bin/env tar --extract --no-same-owner --file /Users/marslo/Library/Caches/Homebrew/downloads/ebd73b309783778b2985d2b1cec6aa2ba756923db8dd48e300e04d6587ec9ef8--zip--3.0.arm64_sonoma.bottle.2.tar.gz --directory /private/tmp/homebrew-unpack-20241212-61524-9jfahk
mv /private/tmp/homebrew-unpack-20241212-61524-9jfahk/zip /opt/homebrew/Cellar/zip
==> Finishing up
==> Caveats
zip is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have zip first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/zip/bin:$PATH"' >> /Users/marslo/.bash_profile
==> Summary
🦍  /opt/homebrew/Cellar/zip/3.0: 15 files, 871.6KB
...

build from source

[!NOTE|label:references]

  • zip30

    $ curl -fsSL ftp://ftp.info-zip.org/pub/infozip/src/zip30.zip | bsdtar xzf - -C /tmp/
    # for zipnote issue -- rename filename in zip
    $ curl -o /tmp/zipinfo.patch -fsSL https://gist.githubusercontent.com/marslo/70a3f6728633c49bed865da684378b31/raw/cf402112315ededbfb58c0e17629e9a74708e370/zipinfo.patch
    # for macOS
    $ curl -o /tmp/xcode15.patch -fsSL https://raw.githubusercontent.com/Homebrew/formula-patches/d2b59930/zip/xcode15.diff
    
    $ cd /tmp/zip30
    
    # apply patches
    $ patch -p1 < /tmp/zipinfo.patch
    $ patch -p1 < /tmp/xcode15.patch
    # or
    $ patch -u zipnote.c -i /tmp/zipinfo.patch
    $ patch -u unix/Makefile -i /tmp/xcode15.patch
    
    # build
    $ make -f unix/Makefile generic
    # gcc
    $ make -f unix/Makefile generic CC=gcc
    # clang
    $ make -f unix/Makefile generic CC=clang
    
    # install
    $ sudo make -f unix/Makefile install
    # or customized BINDIR and MANDIR
    $ sudo make -f unix/Makefile BINDIR=/tmp/bin MANDIR=/tmp/man install
    
  • zip31d

    $ curl -fsSL ftp://ftp.info-zip.org/pub/infozip/beta/zip31d.zip | bsdtar xzf - -C /tmp/
    $ curl -fsSL https://gist.githubusercontent.com/marslo/70a3f6728633c49bed865da684378b31/raw/cea315f1ae855c602515b79ddf205cba71fbb2b0/xcode15-zip31d.patch -o /tmp/xcode15-zip31d.patch
    
    $ cd /tmp/zip31d
    $ patch -p1 < /tmp/xcode15-zip31d.patch
    # or
    $ patch -u unix/configure -i /tmp/xcode15-zip31d.patch
    
    # -- build --
    $ make -f unix/Makefile generic
    # gcc
    $ make -f unix/Makefile generic CC=gcc
    # clang
    $ make -f unix/Makefile generic CC=clang
    
    # install
    $ sudo make -f unix/Makefile install
    # or customized BINDIR and MANDIR
    $ sudo make -f unix/Makefile BINDIR=/tmp/bin MANDIR=/tmp/man install
    

glibc

[!NOTE|label:references:]

$ mkdir -p /opt/glibc
$ curl -fsSL https://ftp.gnu.org/gnu/glibc/glibc-2.38.tar.xz | tar -xJf - -C /opt/glibc
$ mkdir -p /opt/glibc/glibc-2.38/build && cd $_

build $ ../configure --prefix=/opt/glibc/2.38
# or
build $ ../configure --prefix `pwd`/../install

build $ make -j $(nproc)
build $ sudo make install
# highly recommended
build $ make install DESTDIR=/root/glibc-2.14/staging

glibc troubleshooting

  • No rule to make target glibc-build/Versions.all, needed by glibc-build/abi-versions.h. Stop.

    $ sudo dnf install gawk texinfo
    
  • make[2]: * [/mnt/lfs/sources/glibc-build/misc/syslog.o] Error 1

    $ make clean
    $ make -j2 CFLAGS="-U_FORTIFY_SOURCE -O2 -fno-stack-protector"
    
  • ldconfig: Can't open configuration

    /opt/glibc-2.14/etc $ sudo sh -c "echo '/usr/local/lib' >> ld.so.conf"
    /opt/glibc-2.14/etc $ sudo sh -c "echo '/opt/lib' >> ld.so.conf"
    
  • manpath

    $ echo $MANPATH
    /usr/local/opt/coreutils/libexec/gnuman:/usr/local/share/man:/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
    
    $ eclr
    >> unset MANPATH
    .. /usr/local/opt/coreutils/libexec/gnuman:/usr/local/share/man:/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
    $ echo $MANPATH
    
    $ manpath
    /Users/marslo/.local/share/man:/usr/local/Cellar/icu4c@71.1/71.1/share/man:/usr/local/vim/share/man:/Applications/MacVim.app/Contents/man:/usr/local/nvim/share/man:/usr/local/opt/gnu-getopt/share/man:/usr/local/opt/binutils/share/man:/usr/local/opt/ruby/share/man:/usr/local/opt/tcl-tk/share/man:/usr/local/opt/node@21/share/man:/usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home/man:/usr/local/opt/ed/share/man:/usr/local/opt/gettext/share/man:/usr/local/opt/file-formula/share/man:/usr/local/opt/curl/share/man:/usr/local/opt/openssl/share/man:/usr/local/opt/libiconv/share/man:/usr/local/opt/sqlite/share/man:/usr/local/share/man:/usr/share/man:/Library/Apple/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
    

lua

[!NOTE]

$ mkdir -p /opt/lua
$ curl -fsSL https://www.lua.org/ftp/lua-5.4.6.tar.gz | tar xzf - -C /opt/lua
$ cd /opt/lua/lua-5.4.6

$ make all test
$ sudo make install
  • build with .so file

    $ patch --ignore-whitespace < <(curl -fsSL https://gist.githubusercontent.com/marslo/767e339e32e0dbc038a3e00e3c8a7cba/raw/01f29ac774a468221082f4d504b013d264435567/Makefile.patch)
    $ cd src
    $ patch --ignore-whitespace < <(curl -fsSL https://gist.githubusercontent.com/marslo/767e339e32e0dbc038a3e00e3c8a7cba/raw/01f29ac774a468221082f4d504b013d264435567/src.Makefile.patch)
    
    $ make all test && sudo make install
    

ruby

[!NOTE|label:references:]

  • rbenv

    # debine
    $ sudo apt install libffi-dev libyaml-dev
    
    $ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
    # or
    $ wget -q https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer -O- | bash
    
    $ ~/.rbenv/bin/rbenv init
    $ echo 'export PATH="$PATH:$HOME/.rbenv/bin"' >> ~/.bashrc
    $ echo 'eval "$(/home/marslo/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
    
    # list latest available versions
    $ rbenv install -l
    3.0.6
    3.1.4
    3.2.2
    3.3.0
    jruby-9.4.5.0
    mruby-3.2.0
    picoruby-3.0.0
    truffleruby-23.1.1
    truffleruby+graalvm-23.1.1
    
    # install
    $ rbenv install 3.3.0
    ==> Downloading ruby-3.3.0.tar.gz...
    -> curl -q -fL -o ruby-3.3.0.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 21.0M  100 21.0M    0     0  27.6M      0 --:--:-- --:--:-- --:--:-- 27.5M
    ==> Installing ruby-3.3.0...
    # linux
    -> ./configure "--prefix=$HOME/.rbenv/versions/3.3.0" --enable-shared --with-ext=openssl,psych,+
    # osx
    -> ./configure "--prefix=$HOME/.rbenv/versions/3.3.0" --enable-shared --with-readline-dir=/usr/local/opt/readline --with-libyaml-dir=/usr/local/opt/libyaml --with-gmp-dir=/usr/local/opt/gmp --with-ext=openssl,psych,+ --with-openssl-dir=/usr/local/opt/openssl
    -> make -j 32
    -> make install
    ==> Installed ruby-3.3.0 to /home/marslo/.rbenv/versions/3.3.0
    
    $ rbenv global 3.3.0
    
    • install offline package

      [!TIP]

      # online machine
      $ curl -q -fL -o ruby-3.3.0.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz
      $ scp ruby-3.3.0.tar.gz account@server.com:~/.rbenv/cache
      
      # offline machine
      $ sudo apt install libyaml-dev libyaml-doc
      $ export CPPFLAGS=-I/usr/local/include
      $ export LDFLAGS=-L/usr/local/lib
      $ rbenv install 3.3.0
      ==> Installing ruby-3.3.0...
      -> ./configure "--prefix=$HOME/.rbenv/versions/3.3.0" --enable-shared --with-ext=openssl,psych,+
      -> make -j 128
      -> make install
      ==> Installed ruby-3.3.0 to /home/marslo/.rbenv/versions/3.3.0
      $ rbenv global 3.3.0
      
    • result

      $ ruby --version
      ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
      
      $ bundler --version
      Bundler version 2.5.3
      
  • rvm

    $ sudo yum update -y
    $ sudo yum install curl gpg gcc gcc-c++ make libyaml-devel openssl-devel readline-devel zlib-devel -y
    
    $ command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
    $ command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
    $ curl -sSL https://get.rvm.io | bash -s stable
    $ echo "export PATH=\"$PATH:$HOME/.rvm/bin\"" >> ~/.bashrc
    
    # verify
    $ rvm --version
    rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
    
    # install ruby
    $ rvm install 3.3
    $ rvm use 3.3 --default
    

mono

[!NOTE]

# centos 7
$ sudo su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo |tee /etc/yum.repos.d/mono-centos7-stable.repo'

# centos 8
$ sudo rpm --import 'http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef'
$ sudo dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo

$ sudo yum install mono-devel
$ mono --version
Mono JIT compiler version 6.12.0.107 (tarball Wed Dec  9 21:44:58 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          yes(610)
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

# optional
$ sudo yum install mono-complete
  • repo files

    $ cat -pp mono-centos7-stable.repo
    [mono-centos7-stable]
    name=mono-centos7-stable
    baseurl=https://download.mono-project.com/repo/centos7-stable/
    enabled=1
    gpgcheck=1
    gpgkey=https://download.mono-project.com/repo/xamarin.gpg
    
    $ cat -pp mono-centos8-stable.repo
    [mono-centos8-stable]
    name=mono-centos8-stable
    baseurl=https://download.mono-project.com/repo/centos8-stable/
    enabled=1
    gpgcheck=1
    gpgkey=https://download.mono-project.com/repo/xamarin.gpg
    

cmake

[!NOTE|label:references]

# snap
$ sudo snap install cmake --classic

# pip
$ pip install --user cmake

# dnf
$ sudo dnf install cmake make

llvm

[!NOTE|label:references:]

# dnf
$ sudo dnf install llvm llvm-libs

clang++ in windows

[!NOTE|label:references:]

go

[!NOTE|label:references:]

# snap
$ sudo snap install go --classic

# apt
$ sudo apt install golang-1.21 golang-1.21-go golang-1.21-doc
# or
$ sudo apt install golang-go
$ sudo update-alternatives --install /usr/bin/go go /usr/lib/go-1.21/bin/go 99
$ sudo update-alternatives --install /usr/bin/gofmt gofmt /usr/lib/go-1.21/bin/gofmt 99
$ sudo update-alternatives --auto go
$ sudo update-alternatives --auto gofmt
$ go version
go version go1.21.5 linux/amd64

# standalone pacakge
$ mkdir -p /opt/go
$ curl -fsSL https://dl.google.com/go/go1.21.5.linux-amd64.tar.gz | tar xzf - -C /opt/go

$ cat >> ~/.bashrc << EOF
export GOPATH=/opt/go
export PATH=$GOPATH/bin:$PATH
EOF

node && npm

# snap
$ sudo snap install node --classic --channel=15
# upgrade version to 20.x
$ sudo snap refresh --channel=20 node
node (20/stable) 20.8.0 from OpenJS Foundation (iojs✓) refreshed

config

  • list all configure

    $ npm config list -l
    # or
    $ npm info
    
  • npm prefix

    export NPM_CONFIG_PREFIX="$HOME/.npm"
    
    # or
    $ cat ~/.npmrc
    prefix = "$HOME/.npm"
    
  • registry

    $ npm --registry=https://registry.npm.taobao.org install <package-name>
    
    # set in config
    $ npm config set registry https://registry.npm.taobao.org
    

nodesource/distributions

nodejs for ubuntu/debian

# via apt
$ sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
$ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
$ NODE_MAJOR=20
$ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
$ sudo apt-get update && sudo apt-get install nodejs -y

# via script
$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -

nodejs for centos/rhel

# via rpm
$ sudo yum install https://rpm.nodesource.com/pub_20.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y
$ sudo yum install nsolid -y

# via script
$ curl -fsSL https://rpm.nodesource.com/setup_21.x | sudo bash -
$ yum install -y nodejs

node/npm troubleshooting

[!NOTE]

$ sudo chown -R $USER /usr/local/lib/node_modules
$ npm install -g ..

# or
$ export NPM_CONFIG_PREFIX="$HOME/.npm"
$ npm config set prefix "$NPM_CONFIG_PREFIX"
$ export PATH="$PATH:$NPM_CONFIG_PREFIX/bin"
$ npm install -g ..

# or
$ sudo groupadd nodegrp
$ sudo usermode -aG nodegrp `logname`
# without re-login
$ newgrp nodegrp
$ sudo chgrp -R nodegrp /usr/lib/node_modules
$ sudo chgrp nodegrp /usr/bin/node
$ sudo chgrp nodegrp /usr/bin/npm
$ npm instal -g ...

install from private registry

$ npm config set registry https://artifactory.sample.com/artifactory/api/npm/npm-remote/
$ sudo mkdir -p /usr/local/n && sudo chwon -R $(whoami) /usr/local/n
$ sudo n latest
$ npm i -g npm-completion --verbose

upgrade via n

# upgrade nodejs
$ node --version
v12.22.5
$ sudo npm i -g n
$ sudo mkdir -p /usr/local/n && sudo chown -R $(whoami) /usr/local/n
$ sudo n latest
$ which -a node
/usr/local/bin/node
/usr/bin/node
$ node --version
v20.8.1
$ /usr/bin/node --version
v12.22.5

node warnings

[!NOTE|label:references:]

  • ExperimentalWarning

    [!NOTE|label:references:]

    • to prevent warning as below:
      Updating...(node:69018) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      (Use `node --trace-warnings ...` to show where the warning was created)
      

gradle

[!NOTE]

# snap
$ sudo snap install gradle --classic

# standalone package
$ curl -O https://services.gradle.org/distributions/gradle-7.6.1-bin.zip    # download somewhere and sync to server
$ unzip gradle-7.6.1-bin.zip -d /opt/gradle
$ ln -sf /opt/gradle/gradle-7.6.1 /opt/gradle/latest
$ sudo update-alternatives --install /usr/local/bin/gradle gradle /opt/gradle/latest/bin/gradle 99
$ sudo update-alternatives --auto gradle

# ubuntu
$ sudo add-apt-repository ppa:cwchien/gradle
$ sudo apt-get update
$ sudo apt upgrade gradle

flags for gradle

[!NOTE|label:references:]

$ curl -fsSL -O https://confluence.atlassian.com/kb/files/779355358/779355357/1/1441897666313/SSLPoke.class

$ $JAVA_HOME/bin/java SSLPoke services.gradle.org 443
Successfully connected

$ $JAVA_HOME/bin/java -Djavax.net.debug=ssl SSLPoke services.gradle.org 443
javax.net.ssl|DEBUG|10|main|2025-02-17 21:53:53.169 PST|SSLCipher.java:432|jdk.tls.keyLimits:  entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
javax.net.ssl|DEBUG|10|main|2025-02-17 21:53:53.176 PST|SSLCipher.java:432|jdk.tls.keyLimits:  entry =  ChaCha20-Poly1305 KeyUpdate 2^37. CHACHA20-POLY1305:KEYUPDATE = 137438953472
Successfully connected

# with `truststore`
$ $JAVA_HOME/bin/java -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/security/cacerts -Djavax.net.debug=ssl SSLPoke services.gradle.org 443
javax.net.ssl|DEBUG|10|main|2025-02-17 21:55:55.826 PST|SSLCipher.java:432|jdk.tls.keyLimits:  entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
javax.net.ssl|DEBUG|10|main|2025-02-17 21:55:55.833 PST|SSLCipher.java:432|jdk.tls.keyLimits:  entry =  ChaCha20-Poly1305 KeyUpdate 2^37. CHACHA20-POLY1305:KEYUPDATE = 137438953472
Successfully connected

rust

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

haskell

[!NOTE|label:references:]

haskell-platform

$ sudo apt install -y haskell-platform

haskell-stack

$ curl -sSL https://get.haskellstack.org/ | sh
# or
$ wget -qO- https://get.haskellstack.org/ | sh
# or
$ sudo apt install -y haskell-stack
  • system dependency
    # ubuntu/debian
    $ sudo apt-get install g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase
    # centos/fedora
    $ sudo dnf install perl make automake gcc gmp-devel libffi zlib zlib-devel xz tar git gnupg
    

docker

[!NOTE|label:references:]

# amd64
$ curl -o /tmp/Docker.dmg -fsSL -g 'https://desktop.docker.com/mac/main/arm64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-mac-arm64'

# install
$ sudo hdiutil attach Docker.dmg
$ sudo /Volumes/Docker/Docker.app/Contents/MacOS/install
$ sudo hdiutil detach /Volumes/Docker

jfrog-cli

  • build from source
    $ git clone https://github.com/jfrog/jfrog-cli.git
    $ go build -o=/opt/homebrew/Cellar/jfrog-cli/HEAD-ce298c1/bin/jf -ldflags=-s -w
    

pandoc

[!NOTE|label:references:]

$ brew install pandoc
# or
$ brew install pandoc --HEAD

# -- optional --
$ brew install librsvg python homebrew/cask/basictex

to pdf

[!NOTE|label:references:]

# download github.css
$ curl -fsSL -O https://raw.githubusercontent.com/simov/markdown-viewer/master/themes/github.css
# or
$ curl -fsSL -O https://github.com/simov/markdown-viewer/raw/master/themes/github.css

# with default pdf engine - weasyprint
$ python3 -m pip install weasyprint
$ pandoc -f gfm -t html5 --metadata pagetitle="test.md" --css github.css input.md -o input.pdf

# with wkhtmltopdf pdf engine
$ brew install wkhtmltopdf
$ pandoc -f gfm -t html5 --metadata pagetitle="test.md" --css github.css input.md -o input.pdf --pdf-engine=wkhtmltopdf

# -- highly recommended --
$ pandoc -f gfm -t html5 \
         --embed-resources --standalone \
         --metadata pagetitle="Title Here" \
         --css github.inter.css \
         input.md -o input-new.pdf

# -- or --
$ pandoc -f gfm -t html5 \
         --embed-resources --standalone \
         --metadata title="Title Here" \
         --metadata date="2025-03-13" \
         --toc --toc-depth=4 \
         --css github.css \
         --css custom.css \
         -H header.html \
         --pdf-engine=weasyprint \
         input.md -o output.pdf             # or output.html, to generate the html format
  • css

    # download github.css
    $ curl -fsSL -O https://raw.githubusercontent.com/simov/markdown-viewer/master/themes/github.css
    # or
    $ curl -fsSL -O https://github.com/simov/markdown-viewer/raw/master/themes/github.css
    
    # custom.css
    $ cat custom.css
    /* custom.css */
    @page {
      size: A4;
      margin-top: 3cm;
      margin-bottom: 3cm;
    
      @top-center {
        content: var(--title);                                         /* 从元数据获取标题 */
        font-family: DejaVu Sans, sans-serif;
        font-size: 11pt;
      }
    
      @bottom-right {
        content: counter(page) "/" counter(pages) " · " var(--author); /* 自动页码+作者 */
        font-family: DejaVu Sans, sans-serif;
        font-size: 9pt;
        color: #666;
      }
    }
    
    /* optional */
    body {
      font-family: DejaVu Sans, sans-serif;                            /* 确保中文字体 */
      padding: 0 1cm;                                                  /* 正文左右留白 */
    }
    
  • header.html

    #!/bin/bash
    
    TITLE="文档标题"
    AUTHOR="作者名称"
    DATE="2025-03-13"
    
    cat << EOF > header.html
    <style>
    :root {
      --title: "$TITLE";
      --author: "$AUTHOR";
    }
    </style>
    EOF
    
    <style>
    :root {
      --title: "interview questions";
      --author: "marslo";
    }
    </style>
    
  • convert to pdf with header and footer

    $ TITLE='TITLE HERE'
    $ AUTHOR='marslo'
    $ DATE='2025-03-13'
    $ pandoc -f gfm -t html5 \
      --embed-resources --standalone \
      --metadata title="$TITLE" \
      --metadata author="$AUTHOR" \
      --metadata date="$DATE" \
      --toc \
      --css github.css \
      --css custom.css \
      -H header.html \
      --pdf-engine=weasyprint
      input.md -o output.pdf \
    

mysql

built from source code

  • build

    $ sudo groupadd mysql
    $ sudo useradd -g mysql mysql
    $ wget http://cdn.mysql.com/archives/mysql-5.5/mysql-5.5.41.tar.gz
    $ apt install ncurses-dev
    
    $ cd myaql-5.5.41
    $ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
    -DDEFAULT_CHARSET=utf8 \
    -DDEFAULT_COLLATION=utf8_general_ci \
    -DENABLED_LOCAL_INFILE=ON \
    -DWITH_INNOBASE_STORAGE_ENGINE=1 \
    -DWITH_FEDERATED_STORAGE_ENGINE=1 \
    -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
    -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
    -DWITH_DEBUG=0 \
    -DMYSQL_TCP_PORT=3306
    $ make
    $ sudo make install
    
    $ sudo systemctl enable mysqld
    # or
    $ sysv-rc-conf mysqld on
    
  • configure

    $ sudo chown -R mysql:mysql /usr/local/mysql
    $ /usr/local/mysql/scripts/mysql_install_db --user=mysql
    $ sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
    $ sudo chown -R root /usr/local/mysql/
    $ sudo chown -R mysql /usr/local/mysql/data
    $ /usr/local/mysql/bin/mysqld_safe --user=mysql &
    
    $ /usr/local/mysql/bin/mysqladmin -u root password '<PASSWORD>'
    # or
    $ /usr/local/mysql/bin/mysql_secure_installtion
    

install from apt repo

$ sudo apt install mysql-server

install old version

$ sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
$ sudo apt update
$ sudo apt install mysql-server-5.6 mysql-client-5.6 -y
$ sudo mysql_secure_installation

reconfiguration

$ sudo service mysql start
$ sudo mysql_secure_installation

mysql-connector (jdbc)

  • download mysql-connector-java-*.tar.gz in mysql official website -> Platform Independent
    $ wget http://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.40.tar.gz
    

vncserver

[!NOTE|label:see more:]

$ sudo apt install vnc4server
$ sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

compiler environment

pkg-config

$ pkg-config --cflags openssl
-I/usr/local/Cellar/openssl@3/3.2.0_1/include
$ pkg-config --variable pc_path pkg-config
/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/11.0

# list all
$ pkg-config --list-all
$ pkg-config --list-all
$ pkg-config --list-all
sqlite3                          SQLite - SQL database engine
libgcrypt                        libgcrypt - General purpose cryptographic library
xcb-xevie                        XCB Xevie - XCB Xevie Extension
xcb-damage                       XCB Damage - XCB Damage Extension
pixman-1                         Pixman - The pixman library (version 1)
gmodule-export-2.0               GModule - Dynamic module loader for GLib
libevent_pthreads                libevent_pthreads - libevent_pthreads adds pthreads-based threading support to libevent
cairo-svg                        cairo-svg - SVG surface backend for cairo graphics library
recordproto                      RecordProto - Record extension headers
libmagic                         libmagic - Magic number recognition library
nettle                           Nettle - Nettle low-level cryptographic library (symmetric algorithms)
gnutls                           GnuTLS - Transport Security Layer implementation for the GNU system
fmt                              fmt - A modern formatting library
libpcreposix                     libpcreposix - PCREPosix - Posix compatible interface to libpcre
imlib2                           imlib2 - Powerful image loading and rendering library
lqr-1                            lqr-1 - LiquidRescale seam-carving library
libglog                          libglog - Google Log (glog) C++ logging framework
jemalloc                         jemalloc - A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support.
lua-5.4                          Lua - An Extensible Extension Language
cairo-tee                        cairo-tee - Tee surface backend for cairo graphics library
applewmproto                     AppleWMProto - AppleWM extension headers
xcb-render                       XCB Render - XCB Render Extension
ImageMagick-7.Q16HDRI            ImageMagick - ImageMagick - convert, edit, and compose images (ABI Q16HDRI)
xwaylandproto                    XwaylandProto - Xwayland extension headers
libjq                            libjq - Library to process JSON using a query language
libpcre2-16                      libpcre2-16 - PCRE2 - Perl compatible regular expressions C library (2nd API) with 16 bit character support
dri3proto                        DRI3Proto - DRI3 extension headers
libfolly                         libfolly - Facebook (Folly) C++ library
dpmsproto                        DPMSProto - DPMS extension headers
libjxl_threads                   libjxl_threads - JPEG XL multi-thread runner using std::threads.
cairo-png                        cairo-png - PNG functions for cairo graphics library
libcurl                          libcurl - Library to transfer files with ftp, http, etc.
gflags                           gflags - A commandline flags library that allows for distributed flags.
xcmiscproto                      XCMiscProto - XCMisc extension headers
libidn                           Libidn - IETF stringprep, nameprep, punycode, IDNA text processing.
libxslt                          libxslt - XSLT library version 2.
yaml-0.1                         LibYAML - Library to parse and emit YAML
python3-embed                    Python - Embed Python into an application
xf86vidmodeproto                 XF86VidModeProto - XF86VidMode extension headers
python-3.10-embed                Python - Embed Python into an application
xbuild12                         XBuild 12.0 - XBuild/MSBuild 12.0
caca                             caca - Colour ASCII-Art library
damageproto                      DamageProto - Damage extension headers
libraw_r                         libraw - Raw image decoder library (thread-safe)
mono-options                     Mono.Options - Command Line Parsing Library
odbccr                           odbccr (unixODBC) - unixODBC Cursor Library
videoproto                       VideoProto - Video extension headers
cairo-xlib                       cairo-xlib - Xlib surface backend for cairo graphics library
xcb-xvmc                         XCB XvMC - XCB XvMC Extension
gnutls-dane                      GnuTLS-DANE - DANE security library for the GNU system
kbproto                          KBProto - KB extension headers
expat                            expat - expat XML parser
gmp                              GNU MP - GNU Multiple Precision Arithmetic Library
xf86dgaproto                     XF86DGAProto - XF86DGA extension headers
libpcre2-8                       libpcre2-8 - PCRE2 - Perl compatible regular expressions C library (2nd API) with 8 bit character support
libraw                           libraw - Raw image decoder library (non-thread-safe)
uuid                             uuid - Universally unique id library
xcb-dri2                         XCB DRI2 - XCB DRI2 Extension
xcb-dri3                         XCB DRI3 - XCB DRI3 Extension
libpcre2-32                      libpcre2-32 - PCRE2 - Perl compatible regular expressions C library (2nd API) with 32 bit character support
randrproto                       RandrProto - Randr extension headers
apr-util-1                       APR Utils - Companion library for APR
libhwy                           libhwy - Efficient and performance-portable SIMD wrapper
Magick++                         Magick++ - Magick++ - C++ API for ImageMagick (ABI Q16HDRI)
MagickWand-7.Q16HDRI             MagickWand - MagickWand - C API for ImageMagick (ABI Q16HDRI)
libjxl_cms                       libjxl_cms - CMS support library for libjxl
x265                             x265 - H.265/HEVC video encoder
scrnsaverproto                   ScrnSaverProto - ScrnSaver extension headers
MagickCore-7.Q16HDRI             MagickCore - MagickCore - C API for ImageMagick (ABI Q16HDRI)
libtasn1                         libtasn1 - Library for ASN.1 and DER manipulation
dri2proto                        DRI2Proto - DRI2 extension headers
OpenEXR                          OpenEXR - OpenEXR image library
harfbuzz-cairo                   harfbuzz-cairo - HarfBuzz cairo support
system.web.mvc                   System.Web.Mvc - System.Web.Mvc - ASP.NET MVC
dotnet                           Standard libraries in a .NET setup - References all the standard .NET libraries for compilation
cairo-ps                         cairo-ps - PostScript surface backend for cairo graphics library
libheif                          libheif - HEIF image codec.
p11-kit-1                        p11-kit - Library and proxy module for properly loading and sharing PKCS
fixesproto                       FixesProto - X Fixes extension headers
gpg-error                        gpg-error - GPG Runtime
libcares                         c-ares - asynchronous DNS lookup library
python-3.11-embed                Python - Embed Python into an application
python3                          Python - Build a C extension for Python
xcb-dpms                         XCB DPMS - XCB DPMS Extension
gmodule-2.0                      GModule - Dynamic module loader for GLib
ImageMagick                      ImageMagick - ImageMagick - convert, edit, and compose images (ABI Q16HDRI)
reactive                         Reactive Extensions - Reactive Extensions
libvmaf                          libvmaf - VMAF, Video Multimethod Assessment Fusion
libargon2                        libargon2 - Development libraries for libargon2
libutf8proc                      libutf8proc - UTF8 processing
libturbojpeg                     libturbojpeg - A SIMD-accelerated JPEG codec that provides the TurboJPEG API
xcb-xinput                       XCB XInput - XCB XInput Extension (EXPERIMENTAL)
Magick++-7.Q16HDRI               Magick++ - Magick++ - C++ API for ImageMagick (ABI Q16HDRI)
Imath                            Imath - Imath library: vector/matrix and math operations, plus the half type.
xcb-dbe                          XCB Dbe - XCB Double Buffer Extension
lua                              Lua - An Extensible Extension Language
xcb-xtest                        XCB XTEST - XCB XTEST Extension
libsodium                        libsodium - A modern and easy-to-use crypto library
libedit                          libedit - command line editor library provides generic line editing, history, and tokenization functions.
xcb-ge                           XCB GenericEvent - XCB GenericEvent Extension
fontsproto                       FontsProto - Fonts extension headers
xineramaproto                    XineramaProto - Xinerama extension headers
guile-3.0                        GNU Guile - GNU's Ubiquitous Intelligent Language for Extension
compositeproto                   CompositeExt - Composite extension headers
xf86bigfontproto                 XF86BigFontProto - XF86BigFont extension headers
aspnetwebstack                   AspNetWebStack - References Microsoft ASP.NET Web Stack
xcb-xselinux                     XCB SELinux - XCB SELinux Extension
libpcre                          libpcre - PCRE - Perl compatible regular expressions C library with 8 bit character support
ksba                             ksba - X.509 and CMS support library
libpcre16                        libpcre16 - PCRE - Perl compatible regular expressions C library with 16 bit character support
cairo-xcb-shm                    cairo-xcb-shm - XCB/SHM functions for cairo graphics library
libavif                          libavif - Library for encoding and decoding .avif files
glproto                          GLProto - GL extension headers
cairo-pdf                        cairo-pdf - PDF surface backend for cairo graphics library
libevent_openssl                 libevent_openssl - libevent_openssl adds openssl-based TLS support to libevent
lcms2                            lcms2 - LCMS Color Management Library
dmxproto                         DMXProto - DMX extension headers
xcb-glx                          XCB GLX - XCB GLX Extension
aom                              aom - Alliance for Open Media AV1 codec library v3.8.0.
python-3.12-embed                Python - Embed Python into an application
libusb-1.0                       libusb-1.0 - C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace
gthread-2.0                      GThread - Thread support for GLib
x11-xcb                          X11 XCB - X Library XCB interface
xf86driproto                     XF86DRIProto - XF86DRI extension headers
libssl                           OpenSSL-libssl - Secure Sockets Layer and cryptography libraries
libpcrecpp                       libpcrecpp - PCRECPP - C++ wrapper for PCRE
cairo-xcb                        cairo-xcb - XCB surface backend for cairo graphics library
xcb-screensaver                  XCB Screensaver - XCB Screensaver Extension
lua5.4                           Lua - An Extensible Extension Language
xcb-composite                    XCB Composite - XCB Composite Extension
odbcinst                         odbcinst (unixODBC) - unixODBC Configuration Library
cairo-quartz-image               cairo-quartz-image - Quartz Image surface backend for cairo graphics library
mpfr                             mpfr - C library for multiple-precision floating-point computations
MagickWand                       MagickWand - MagickWand - C API for ImageMagick (ABI Q16HDRI)
libxml-2.0                       libXML - libXML library version2.
harfbuzz-subset                  harfbuzz-subset - HarfBuzz font subsetter
apr-1                            APR - The Apache Portable Runtime library
xcb-xv                           XCB Xv - XCB Xv Extension
xextproto                        XExtProto - XExt extension headers
cairo-gobject                    cairo-gobject - cairo-gobject for cairo graphics library
dotnet35                         Standard libraries in a .NET setup - References all the standard .NET libraries for compilation (.NET Framework 3.5 compatibility)
gmodule-no-export-2.0            GModule - Dynamic module loader for GLib
libde265                         libde265 - H.265/HEVC video decoder.
libbrotlienc                     libbrotlienc - Brotli encoder library
libcrypto                        OpenSSL-libcrypto - OpenSSL cryptography library
bdw-gc                           Boehm-Demers-Weiser Conservative Garbage Collector - A garbage collector for C and C++
x11                              X11 - X Library
xcb-res                          XCB Res - XCB X-Resource Extension
system.web.extensions.design_1.0 System.Web.Extensions.Design - System.Web.Extensions.Design ASP.NET 2.0 add-on
bigreqsproto                     BigReqsProto - BigReqs extension headers
jasper                           JasPer - Image Processing/Coding Tool Kit with JPEG-2000 Support
libpcre32                        libpcre32 - PCRE - Perl compatible regular expressions C library with 32 bit character support
libjxl                           libjxl - Loads and saves JPEG XL files
libevent                         libevent - libevent is an asynchronous notification event loop library
libopenjp2                       openjp2 - JPEG2000 library (Part 1 and 2)
gsl                              GSL - GNU Scientific Library
cairo-quartz-font                cairo-quartz-font - Quartz font backend for cairo graphics library
hogweed                          Hogweed - Nettle low-level cryptographic library (public-key algorithms)
resourceproto                    ResourceProto - Resource extension headers
libexslt                         libexslt - EXSLT Extension library
libassuan                        libassuan - IPC library for the GnuPG components
cecil                            Mono Internal -- Do not use. - Mono Internal Libraries -- Do not use
bash                             bash - Bash headers for bash loadable builtins
cairo-fc                         cairo-fc - Fontconfig font backend for cairo graphics library
z3                               z3 - The Z3 Theorem Prover
cairo                            cairo - Multi-platform 2D graphics library
glib-2.0                         GLib - C Utility Library
libevent_core                    libevent_core - libevent_core
tidy                             tidy - tidy - HTML syntax checker
cairo-ft                         cairo-ft - FreeType font backend for cairo graphics library
jbig2dec                         libjbig2dec - JBIG2 decoder library.
xcb-sync                         XCB Sync - XCB Sync Extension
xcb-xprint                       XCB Xprint - XCB Xprint Extension
gio-unix-2.0                     GIO unix specific APIs - unix specific headers for glib I/O library
MagickCore                       MagickCore - MagickCore - C API for ImageMagick (ABI Q16HDRI)
cairo-quartz                     cairo-quartz - Quartz surface backend for cairo graphics library
system.web.mvc2                  System.Web.Mvc2 - System.Web.Mvc - ASP.NET MVC v2
system.web.mvc3                  System.Web.Mvc3 - System.Web.Mvc - ASP.NET MVC v3
presentproto                     PresentProto - Present extension headers
xcb-xfixes                       XCB XFixes - XCB XFixes Extension
librtmp                          librtmp - RTMP implementation
libwebpdecoder                   libwebpdecoder - Library for the WebP graphics format (decode only)
python-3.10                      Python - Build a C extension for Python
python-3.11                      Python - Build a C extension for Python
monodoc                          Monodoc - Monodoc - Mono Documentation Tools
python-3.12                      Python - Build a C extension for Python
libssh2                          libssh2 - Library for SSH-based communication
libnghttp2                       libnghttp2 - HTTP/2 C library
xcb-xkb                          XCB XKB - XCB Keyboard Extension (EXPERIMENTAL)
libpng                           libpng - Loads and saves PNG files
libpcre2-posix                   libpcre2-posix - Posix compatible interface to libpcre2-8
libwebpdemux                     libwebpdemux - Library for parsing the WebP graphics format container
wcf                              WCF - References WCF for compilation
odbc                             odbc (unixODBC) - unixODBC Driver Manager library
libhwy-contrib                   libhwy-contrib - Additions to Highway: dot product, image, math, sort
lzo2                             lzo2 - LZO - a real-time data compression library
mono-2                           Mono - Mono Runtime
xcb-randr                        XCB RandR - XCB RandR Extension
IlmBase                          IlmBase - Base math and exception libraries
cairo-script-interpreter         cairo-script-interpreter - script surface backend for cairo graphics library
freetype2                        FreeType 2 - A free, high-quality, and portable font engine.
xext                             Xext - Misc X Extension Library
libjpeg                          libjpeg - A SIMD-accelerated JPEG codec that provides the libjpeg API
xcb-xf86dri                      XCB XFree86-DRI - XCB XFree86-DRI Extension
libtiff-4                        libtiff - Tag Image File Format (TIFF) library.
xau                              Xau - X authorization file management library
system.web.extensions_1.0        System.Web.Extensions - System.Web.Extensions ASP.NET 2.0 add-on
xcb-record                       XCB Record - XCB Record Extension
xcb-present                      XCB Present - XCB Present Extension
harfbuzz                         harfbuzz - HarfBuzz text shaping library
libbrotlidec                     libbrotlidec - Brotli decoder library
openssl                          OpenSSL - Secure Sockets Layer and cryptography libraries and tools
mono-cairo                       Mono.Cairo - Cairo bindings for Mono
libuv                            libuv - multi-platform support library with a focus on asynchronous I/O.
libwebpmux                       libwebpmux - Library for manipulating the WebP graphics format container
libzstd                          zstd - fast lossless compression algorithm library
libevent_extra                   libevent_extra - libevent_extra
cairo-script                     cairo-script - script surface backend for cairo graphics library
libzip                           libzip - library for handling zip archives
ncursesw                         ncursesw - ncurses 5.7 library
libffi                           libffi - Library supporting Foreign Function Interfaces
xcb-shape                        XCB Shape - XCB Shape Extension
libqrencode                      libqrencode - A QR Code encoding library
harfbuzz-icu                     harfbuzz-icu - HarfBuzz text shaping library ICU integration
pthread-stubs                    pthread stubs - Meta package for pthread symbols - defaults to heavyweight ones if the C runtime does not provide lightweight ones.
isl                              isl - isl Library
shared-mime-info                 shared-mime-info - Freedesktop common MIME database
caca++                           caca++ - Colour ASCII-Art library C++ bindings
gdlib                            gd - GD graphics library
gmpxx                            GNU MP C++ - GNU Multiple Precision Arithmetic Library (C++ bindings)
liblz4                           lz4 - extremely fast lossless compression algorithm library
xrender                          Xrender - X Render Library
inputproto                       InputProto - Input extension headers
xproto                           Xproto - Xproto headers
libgit2                          libgit2 - The git library, take 2
xcb-shm                          XCB Shm - XCB Shm Extension
monosgen-2                       Mono - Mono Runtime
oniguruma                        oniguruma - Regular expression library
libpng16                         libpng - Loads and saves PNG files
mono                             Mono - Mono Runtime
xcb                              XCB - X-protocol C Binding
graphite2                        Graphite2 - Font rendering engine for Complex Scripts
liblzma                          liblzma - General purpose data compression library
python-3.9-embed                 Python - Embed Python into an application
mono-lineeditor                  Mono.Terminal.LineEditor - Terminal text entry editor using System.Console.
libunbound                       unbound - Library with validating, recursive, and caching DNS resolver
libwebp                          libwebp - Library for the WebP graphics format
ncurses                          ncurses - ncurses 5.7 library
jansson                          Jansson - Library for encoding, decoding and manipulating JSON data
fontconfig                       Fontconfig - Font configuration and customization library
libsharpyuv                      libsharpyuv - Library for sharp RGB to YUV conversion
cairo-xlib-xrender               cairo-xlib-xrender - Xlib Xrender surface backend for cairo graphics library
harfbuzz-gobject                 harfbuzz-gobject - HarfBuzz text shaping library GObject integration
libbrotlicommon                  libbrotlicommon - Brotli common dictionary library
zlib                             zlib - zlib compression library
python-3.9                       Python - Build a C extension for Python
gobject-2.0                      GObject - GLib Type, Object, Parameter and Signal Library
libidn2                          libidn2 - Library implementing IDNA2008 and TR46
gio-2.0                          GIO - glib I/O library
xdmcp                            Xdmcp - X Display Manager Control Protocol library
xcb-xinerama                     XCB Xinerama - XCB Xinerama Extension
libiodbc                         iODBC - iODBC Driver Manager
renderproto                      RenderProto - Render extension headers

ldconfig

# rebuild ldconfig
$ sudo ldconfig

# show all
$ sudo ldconfig --print-cache

auto completion

[!NOTE|label:references:]

  • check all commands: compgen -c

bash-completion

[!TIP|label:references:]

# osx
HOMEBREW_PREFIX="$(brew --prefix)"
BASH_COMPLETION="$(brew --prefix bash-completion)/etc/bash_completion"       # for bash_completion 1.3_3 BASH_COMPLETION="${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
BASH_COMPLETION_DIR="$(brew --prefix)/etc/bash_completion.d"                 # BASH_COMPLETION="${HOMEBREW_PREFIX}/opt/bash-completion/etc/bash_completion"

if [[ $(command -v brew) != '' ]] && [[  -f $(brew --prefix)/etc/bash_completion ]]; then
  source $(brew --prefix)/etc/bash_completion;
fi
# or
[[ -f '/usr/local/etc/bash_completion' ]] && source /usr/local/etc/bash_completion

# debian
BASH_COMPLETION_DIR=$(pkg-config --variable=completionsdir bash-completion)

bash-completion@2

[!NOTE|label:references:]

  • completion files: $(brew --prefix bash-completion@2)/share/bash-completion/completions
    $ ls -Altrh $(brew --prefix bash-completion@2)/share/bash-completion/completions | wc -l
    918
    
  • brew info bash_completion@2

    ==> Caveats
    Add the following line to your ~/.bash_profile:
      [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
    
    Bash completion has been installed to:
      /usr/local/etc/bash_completion.d
    
  • local files:

    $ ls -Altrh /usr/local/etc/bash_completion
    lrwxr-xr-x 1 marslo admin 51 Dec 15 12:19 /usr/local/etc/bash_completion -> ../Cellar/bash-completion/1.3_3/etc/bash_completion
    $ ls -Altrh /usr/local/etc/profile.d/bash_completion.sh
    lrwxr-xr-x 1 marslo admin 70 May 21 16:47 /usr/local/etc/profile.d/bash_completion.sh -> ../../Cellar/bash-completion@2/2.14.0/etc/profile.d/bash_completion.sh
    $ ls -Altrh /usr/local/Cellar/bash-completion@2/2.14.0/share/bash-completion/bash_completion
    -rw-r--r-- 1 marslo staff 120K May 21 16:47 /usr/local/Cellar/bash-completion@2/2.14.0/share/bash-completion/bash_completion
    
BASH_COMPLETION="$(brew --prefix bash-completion@2)/etc/profile.d/bash_completion.sh"
# or
BASH_COMPLETION="$(brew --prefix)/opt/bash-completion@2/etc/profile.d/bash_completion.sh"
BASH_COMPLETION_2_DIR="$(brew --prefix bash-completion@2)/share/bash-completion/completions"

test -f "${BASH_COMPLETION}" && source "${BASH_COMPLETION}"
if test -d "${BASH_COMPLETION_DIR}"; then
  source <( cat "${BASH_COMPLETION_DIR}"/{brew,tmux,tig-completion.bash} )
  if ls "${BASH_COMPLETION_DIR}"/*git*    >/dev/null 2>&1; then source <( cat "${BASH_COMPLETION_DIR}"/*git* )    ; fi
  if ls "${BASH_COMPLETION_DIR}"/*docker* >/dev/null 2>&1; then source <( cat "${BASH_COMPLETION_DIR}"/*docker* ) ; fi
fi

troubleshooting

-bash: [: too many arguments

  • files:

    • vim $(brew --prefix)/etc/bash_completion.d/gcc
    • vim $(brew --prefix)/etc/bash_completion.d/ifupdown
    • vim $(brew --prefix)/etc/bash_completion.d/ipsec
    • vim $(brew --prefix)/etc/bash_completion.d/kldload
    • vim $(brew --prefix)/etc/bash_completion.d/man
    • vim $(brew --prefix)/etc/bash_completion.d/net-tools
    • vim $(brew --prefix)/etc/bash_completion.d/pkg_install
    • vim $(brew --prefix)/etc/bash_completion.d/procps
    • vim $(brew --prefix)/etc/bash_completion.d/wireless-tools
  • modify to:

    [ ... = ...  ] to [[ ... = ... ]]
    
    # and
    [ ... = ... -o ... = ... ] to [[ ... = ... || ... = ... ]]
    

-bash: _compopt_o_filenames: command not found

[!NOTE|label:references:]

  • solution 1

    [!TIP|label:highly recommended in OSX:]

    • using bash-completion@2 instead of bash-completion
    # original
    $ ls -Altrh $(brew --prefix)/etc/bash_completion.d | grep ssh
    lrwxr-xr-x 1 marslo admin   60 Dec 15  2023 ssh -> ../../Cellar/bash-completion/1.3_3/etc/bash_completion.d/ssh
    lrwxr-xr-x 1 marslo admin   62 Dec 15  2023 sshfs -> ../../Cellar/bash-completion/1.3_3/etc/bash_completion.d/sshfs
    
    # using bash-completion@2
    $ ln -sf $(brew --prefix bash-completion@2)/share/bash-completion/completions/ssh $(brew --prefix)/etc/bash_completion.d/ssh
    
  • solution 2

    • replace _compopt_o_filenames to compopt -o filenames in $(brew --prefix)/etc/bash_completion.d/ssh

      • impacted files:
        $ rg -l _compopt_o_filenames $(brew --prefix)/etc/bash_completion.d/
        /usr/local/etc/bash_completion.d/gdb
        /usr/local/etc/bash_completion.d/perl
        /usr/local/etc/bash_completion.d/monodevelop
        /usr/local/etc/bash_completion.d/gzip
        /usr/local/etc/bash_completion.d/xz
        /usr/local/etc/bash_completion.d/lzop
        /usr/local/etc/bash_completion.d/lrzip
        /usr/local/etc/bash_completion.d/kldload
        /usr/local/etc/bash_completion.d/mutt
        /usr/local/etc/bash_completion.d/postfix
        /usr/local/etc/bash_completion.d/rpm
        /usr/local/etc/bash_completion.d/lzma
        /usr/local/etc/bash_completion.d/ssh
        /usr/local/etc/bash_completion.d/cpio
        /usr/local/etc/bash_completion.d/bzip2
        
    • or workaround function to handle _compopt_o_filenames

      ## ~/.bash_profile
      # workaround
      if ! declare -f _compopt_o_filenames > /dev/null; then
        _compopt_o_filenames() {
          type compopt &>/dev/null && compopt -o filenames 2>/dev/null
        }
      fi
      
    • or workaround script to handle _compopt_o_filenames

      ## ~/.config/.completion/.legacy.sh
      
      #!/usr/bin/env bash
      _compopt_o_filenames() {
        type compopt &> /dev/null && compopt -o filenames 2> /dev/null || compgen -f /non-existing-dir/ > /dev/null
      }
      
      # vim:tabstop=2:softtabstop=2:shiftwidth=2:expandtab:filetype=sh
      
      ## ~/.bash_profile
      test -f "${HOME}/.config/.completion/.legacy.sh" && eval "$(cat "${HOME}/.config/.completion/.legacy.sh")"
      

_comp_compgen_known_hosts__impl

[!NOTE|label:references:]

  • issue: ssh bash_completion: _comp_compgen_known_hosts__impl: -F: an empty filename is specified
  • solution: * iMarslo: bash-completion

tools

fzf

if test -f "$HOME"/.fzf.bash; then
  source "$HOME"/.fzf.bash
else
  [[ '1' = "$(isOSX)" ]] && FZF_HOME="$(brew --prefix fzf)" || FZF_HOME="${iRCHOME}"/utils/fzf
  command -v fzf >/dev/null                     && eval "$(fzf --bash)"
  test -f "${FZF_HOME}/shell/key-bindings.bash" && source "${FZF_HOME}/shell/key-bindings.bash"
fi

## or `fzf --bash` can be also:
[[ $- == *i* ]] && test -f "${FZF_HOME}/shell/completion.bash" && source "${FZF_HOME}/shell/completion.bash" 2> /dev/null

npm

[!NOTE|label:references:]

command -v npm >/dev/null && source <( npm completion )
# or
NPM_COMPLETION_PATH="/usr/local/lib/node_modules/npm-completion"               # https://github.com/Jephuff/npm-bash-completion

python

  • pipenv

    # $(brew --prefix bash-completion@2)/share/bash-completion/completions/_pipenv
    $ brew install bash-completion@2
    
    # or
    $ command -v pipenv >/dev/null && eval "$(pipenv --completion)"
    
  • pipx

    $ command -v pipx    >/dev/null && eval "$(register-python-argcomplete pipx)"
    
  • pip

    $ command -v pip     >/dev/null && eval "$(pip completion --bash)"
    

ansible

ANSIBLE_COMPLETION_PATH="${iRCHOME}/.completion/ansible-completion"            # https://github.com/dysosmus/ansible-completion
test -d "${ANSIBLE_COMPLETION_PATH}" && source <( cat "${ANSIBLE_COMPLETION_PATH}"/*.bash )

git

if ls "${BASH_COMPLETION_DIR}"/*git* >/dev/null 2>&1; then source <( cat "${BASH_COMPLETION_DIR}"/*git* )    ; fi
# or
ls "${BASH_COMPLETION_DIR}"/*git* >/dev/null 2>&1; [ $? -eq 0 ] && source "${BASH_COMPLETION_DIR}"/*git*

# or
GIT_COMPLETION_DIR="$(brew --prefix)"/opt/git/etc/bash_completion.d
# or
GIT_COMPLETION_DIR="$(brew --prefix git)"/etc/bash_completion.d
[[ -d "${GIT_COMPLETION_DIR}" ]] && source "${GIT_COMPLETION_DIR}/*git*"

# or
source $(brew --prefix git)/etc/bash_completion.d/git-prompt.sh
source $(brew --prefix git)/etc/bash_completion.d/git-completion.bash

vault CLI

$ vocomplete-installault -autocomplete-install
$ vault -autocomplete-install
Error executing CLI: 3 errors occurred:
  * already installed in /Users/marslo/.bash_profile
  * already installed in /Users/marslo/.zshrc
  * already installed at /Users/marslo/.config/fish/completions/vault.fish

# or for bash
$ vault -autocomplete-install --bash
# or
command -v vault >/dev/null && complete -C /usr/local/bin/vault vault

others

ADDITIONAL_COMPLETION="${iRCHOME}/.completion/bash_completion_init_completion" # workaround: https://github.com/mobile-shell/mosh/issues/675#issuecomment-156457108
MACCLI_COMPLETION='/usr/local/bin/mac-cli/completion/bash_completion'
VBOX_COMPLETION="${iRCHOME}/.completion/vbox/VBoxManage-completion.bash"       # ╮ https://github.com/gryf/vboxmanage-bash-completion
                                                                               # ╯ https://github.com/mug896/virtualbox-bash-completion
test -f "${ADDITIONAL_COMPLETION}"  && source "${ADDITIONAL_COMPLETION}"
test -f "${MACCLI_COMPLETION}"      && source "${MACCLI_COMPLETION}"
test -f "${VBOX_COMPLETION}"        && source "${VBOX_COMPLETION}"

lint

[!NOTE|label:references:]

LANGUAGE LINTER
BASH bash-exec
BASH shellcheck
BASH shfmt
C/C++ cpplint
C/C++ clang-format
CLOJURE clj-kondo
CLOJURE cljstyle
COFFEE coffeelint
C# dotnet-format
C# csharpier
C# roslynator
DART dartanalyzer
GO golangci-lint
GO revive
GROOVY npm-groovy-lint
JAVA checkstyle
JAVA pmd
JAVASCRIPT eslint
JAVASCRIPT standard
JAVASCRIPT prettier
JSX eslint
KOTLIN ktlint
KOTLIN detekt
LUA luacheck
LUA selene
LUA stylua
MAKEFILE checkmake
PERL perlcritic
PHP phpcs
PHP phpstan
PHP psalm
PHP phplint
PHP php-cs-fixer
POWERSHELL powershell
POWERSHELL powershell_formatter
PYTHON pylint
PYTHON black
PYTHON flake8
PYTHON isort
PYTHON bandit
PYTHON mypy
PYTHON pyright
PYTHON ruff
PYTHON ruff-format
R lintr
RAKU raku
RUBY rubocop
RUST clippy
SALESFORCE sfdx-scanner-apex
SALESFORCE sfdx-scanner-aura
SALESFORCE sfdx-scanner-lwc
SALESFORCE lightning-flow-scanner
SCALA scalafix
SQL sqlfluff
SQL tsqllint
SWIFT swiftlint
TSX eslint
TYPESCRIPT eslint
TYPESCRIPT ts-standard
TYPESCRIPT prettier
.Net dotnet-format
FORMAT LINTER
CSS stylelint
ENV dotenv-linter
GRAPHQL graphql-schema-linter
HTML djlint
HTML htmlhint
JSON jsonlint
JSON eslint-plugin-jsonc
JSON v8r
JSON prettier
JSON npm-package-json-lint
LATEX chktex
MARKDOWN markdownlint
MARKDOWN remark-lint
MARKDOWN markdown-link-check
MARKDOWN markdown-table-formatter
PROTOBUF protolint
RST rst-lint
RST rstcheck
RST rstfmt
XML xmllint
YAML prettier
YAML yamllint
YAML v8r
TOOLING FORMAT LINTER ADDITIONAL
ACTION actionlint
ANSIBLE ansible-lint
API spectral
ARM arm-ttk
BICEP bicep_linter
CLOUDFORMATION cfn-lint
DOCKERFILE hadolint
EDITORCONFIG editorconfig-checker
GHERKIN gherkin-lint
KUBERNETES kubeconform
KUBERNETES helm
KUBERNETES kubescape
PUPPET puppet-lint
SNAKEMAKE snakemake
SNAKEMAKE snakefmt
TEKTON tekton-lint
TERRAFORM tflint
TERRAFORM terrascan
TERRAFORM terragrunt
TERRAFORM terraform-fmt
CODE QUALITY CHECKER LINTER
COPYPASTE jscpd
REPOSITORY checkov
REPOSITORY devskim
REPOSITORY dustilock
REPOSITORY git_diff
REPOSITORY gitleaks
REPOSITORY grype
REPOSITORY kics
REPOSITORY ls-lint
REPOSITORY secretlint
REPOSITORY semgrep
REPOSITORY syft
REPOSITORY trivy
REPOSITORY trivy-sbom
REPOSITORY trufflehog
SPELL cspell
SPELL proselint
SPELL vale
SPELL lychee

hadolint

# linux
$ curl -o /usr/bin/hadolint \
       -fsSL https://github.com/hadolint/hadolint/releases/download/v2.12.1-beta/hadolint-Linux-x86_64
$ chmod +x /usr/bin/hadolint

npm-groovy-lint

[!NOTE|label:rerefences]

VARIABLE DESCRIPTION DEFAULT VALUE
GROOVY_NPM_GROOVY_LINT_ARGUMENTS User custom arguments to add in linter CLI call. Ex: -s --foo "bar" -
GROOVY_NPM_GROOVY_LINT_COMMAND_REMOVE_ARGUMENTS User custom arguments to remove from command line before calling the linter. Ex: -s --foo "bar" -
GROOVY_NPM_GROOVY_LINT_FILTER_REGEX_INCLUDE Custom regex including filter. Ex: `(src\ lib)` include every file
GROOVY_NPM_GROOVY_LINT_FILTER_REGEX_EXCLUDE Custom regex excluding filter. Ex: `(test\ examples)` exclude no file
GROOVY_NPM_GROOVY_LINT_CLI_LINT_MODE Override default CLI lint mode
  • file: Calls the linter for each file
  • list_of_files: Call the linter with the list of files as argument
  • project: Call the linter from the root of the project
list_of_files
GROOVY_NPM_GROOVY_LINT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files. Ex: [".py", ""] [".groovy", ".gvy", ".gradle", ".nf"]
GROOVY_NPM_GROOVY_LINT_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files. Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] ["Jenkinsfile"]
GROOVY_NPM_GROOVY_LINT_PRE_COMMANDS List of bash commands to run before the linter -
GROOVY_NPM_GROOVY_LINT_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling GROOVY_NPM_GROOVY_LINT and its pre/post commands -
GROOVY_NPM_GROOVY_LINT_CONFIG_FILE npm-groovy-lint configuration file nameUse LINTER_DEFAULT to let the linter find it .groovylintrc.json
GROOVY_NPM_GROOVY_LINT_RULES_PATH Path where to find linter configuration file workspace folder, then megalinter default rules
GROOVY_NPM_GROOVY_LINT_DISABLE_ERRORS Run linter but consider errors as warnings false
GROOVY_NPM_GROOVY_LINT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0
GROOVY_NPM_GROOVY_LINT_CLI_EXECUTABLE Override CLI executable ['npm-groovy-lint']

commitlint

[!NOTE|label:references:]

# -- install --
$ npm install -g @commitlint/{cli,config-conventional}

# -- config --
$ echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
# or
$ echo "module.exports = {extends: ['@commitlint/config-conventional']};" > .commitlintrc.js

Checkpatch

[!NOTE|label:references:]

# generate patch
$ git format-patch -n1 -q -o patches
# usage
$ ./scripts/checkpatch.pl --list-types
$ ./scripts/checkpatch.pl --ignore NEW_TYPEDEFS,SUBJECT_LINES,MAINTAINERS,FILE_PATH_CHANGES --max-line-length=1000 --no-tree patchs/*

troubleshooting

issues

cheatsheet

to use the bundled libc++ please add the following LDFLAGS

LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm/lib/c++ -Wl,-rpath,$HOMEBREW_PREFIX/opt/llvm/lib/c++"

check osx compilers

$ while read -r _compiler; do
  echo -e '\n';
  which -a "${_compiler}";
  "${_compiler}" --version;
done < <(echo 'cc c++ gcc g++ clang clang++' | fmt -1)

/usr/bin/cc
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

/usr/bin/c++
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

/usr/bin/gcc
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

/usr/bin/g++
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

/usr/bin/clang
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

/usr/bin/clang++
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

check *.o file

objdump
$ objdump -d ar-test1.o
ar-test1.o:     file format mach-o-x86-64

Disassembly of section .text:

0000000000000000 <_ar_test1>:
   0: 55                    push   %rbp
   1: 48 89 e5              mov    %rsp,%rbp
   4: 48 8d 3d 09 00 00 00  lea    0x9(%rip),%rdi        # 14 <_ar_test1+0x14>
   b: b0 00                 mov    $0x0,%al
   d: e8 00 00 00 00        call   12 <_ar_test1+0x12>
  12: 5d                    pop    %rbp
  13: c3                    ret
execsnoop
$ sudo execsnoop -a -c ar-test1.o
dtrace: system integrity protection is on, some features will not be available

dtrace: invalid probe specifier
 /*
  * Command line arguments
  */
 inline int OPT_dump  = 0;
 inline int OPT_cmd   = 1;
 inline int OPT_time  = 1;
 inline int OPT_timestr = 1;
 inline int OPT_zone  = 0;
 inline int OPT_safe  = 0;
 inline int OPT_proj  = 1;
 inline int FILTER  = 1;
 inline string COMMAND  = "ar-test1.o";

 #pragma D option quiet
 #pragma D option switchrate=10hz

 /*
  * Print header
  */
 dtrace:::BEGIN
 {
  /* print optional headers */
  OPT_time    ? printf("%-14s ", "TIME") : 1;
  OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
  OPT_zone    ? printf("%-10s ", "ZONE") : 1;
  OPT_proj    ? printf("%5s ", "PROJ") : 1;

  /* print main headers */
  /* APPLE: Removed "ZONE" header, it has no meaning in darwin */
  OPT_dump    ? printf("%s %s %s %s %s %s %s\n",
      "TIME", "PROJ", "UID", "PID", "PPID", "COMM", "ARGS") :
      printf("%5s %6s %6s %s\n", "UID", "PID", "PPID", "ARGS");
 }

 /*
  * Print exec event
  */
 /* SOLARIS: syscall::exec:return, syscall::exece:return */
proc:::exec-success
 /(FILTER == 0) || (OPT_cmd == 1 && COMMAND == strstr(COMMAND, execname)) || (OPT_cmd == 1 && execname == strstr(execname, COMMAND))/
 {
  /* print optional fields */
  OPT_time ? printf("%-14d ", timestamp/1000) : 1;
  OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
  OPT_zone ? printf("%-10s ", zonename) : 1;
  OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1;

  /* print main data */
  /* APPLE: Removed the zonename output, it has no meaning in darwin */
  OPT_dump ? printf("%d %d %d %d %d %s ", timestamp/1000,
      curpsinfo->pr_projid, uid, pid, ppid, execname) :
      printf("%5d %6d %6d ", uid, pid, ppid);
  OPT_safe ? printf("%S\n", curpsinfo->pr_psargs) :
      printf("%s\n", curpsinfo->pr_psargs);
 }
: probe description proc:::exec-success does not match any probes. System Integrity Protection is on

env

manpath

[!NOTE|label:references:]

  • show manpath

    $ man -aw bash
    /usr/local/share/man/man1/bash.1
    /usr/share/man/man1/bash.1
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man/man1/bash.1
    
    $ manpath | tr ':' '\n'
    # or
    $ manpath | perl -nE 's/:/\n/g; print'
    /Users/marslo/perl5/man
    /Users/marslo/.local/share/man
    /usr/local/Cellar/icu4c@71.1/71.1/share/man
    /usr/local/vim/share/man
    /Applications/MacVim.app/Contents/man
    /usr/local/opt/llvm/share/man
    /usr/local/opt/util-linux/share/man
    /usr/local/opt/gnu-getopt/share/man
    /usr/local/opt/binutils/share/man
    /usr/local/opt/ruby/share/man
    /usr/local/opt/tcl-tk/share/man
    /usr/local/Cellar/node/21.1.0/share/man
    /usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/man
    /usr/local/opt/ed/share/man
    /usr/local/opt/git-extras/share/man
    /usr/local/opt/gettext/share/man
    /usr/local/opt/file-formula/share/man
    /usr/local/opt/openldap/share/man
    /usr/local/opt/curl/share/man
    /usr/local/opt/openssl/share/man
    /usr/local/opt/libiconv/share/man
    /usr/local/opt/sqlite/share/man
    /usr/local/share/man
    /usr/local/man
    /usr/share/man
    /Library/Apple/usr/share/man
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man
    /Applications/Xcode.app/Contents/Developer/usr/share/man
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
    
  • config file

    $ cat /private/etc/man.conf | sed -r '/^(#.*)$/d;/^\s*$/d'
    MANPATH   /usr/share/man
    MANPATH   /usr/local/share/man
    MANPATH   /usr/X11/man
    MANPATH   /Library/Apple/usr/share/man
    MANSECT   1:1p:8:2:3:3p:4:5:6:7:9:0p:tcl:n:l:p:o
    
    $ cat /etc/man.conf | sed -r '/^(#.*)$/d;/^\s*$/d'
    MANPATH   /usr/share/man
    MANPATH   /usr/local/share/man
    MANPATH   /usr/X11/man
    MANPATH   /Library/Apple/usr/share/man
    MANSECT   1:1p:8:2:3:3p:4:5:6:7:9:0p:tcl:n:l:p:o
    
    $ cat /etc/manpaths
    /usr/share/man
    /usr/local/share/man
    
  • manpath

    $ manpath -d
    -- Searching PATH for man directories
    --   Adding /Users/marslo/perl5/man to manpath
    --   Adding /Users/marslo/.local/share/man to manpath
    --   Adding /usr/local/Cellar/icu4c@71.1/71.1/share/man to manpath
    --   Adding /usr/local/vim/share/man to manpath
    --   Adding /Applications/MacVim.app/Contents/man to manpath
    --   Adding /usr/local/opt/llvm/share/man to manpath
    --   Adding /usr/local/opt/util-linux/share/man to manpath
    --   Adding /usr/local/opt/gnu-getopt/share/man to manpath
    --   Adding /usr/local/opt/binutils/share/man to manpath
    --   Adding /usr/local/opt/ruby/share/man to manpath
    --   Adding /usr/local/opt/tcl-tk/share/man to manpath
    --   Adding /usr/local/Cellar/node/21.1.0/share/man to manpath
    --   Adding /usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/man to manpath
    --   Adding /usr/local/opt/ed/share/man to manpath
    --   Adding /usr/local/opt/git-extras/share/man to manpath
    --   Adding /usr/local/opt/gettext/share/man to manpath
    --   Adding /usr/local/opt/file-formula/share/man to manpath
    --   Adding /usr/local/opt/openldap/share/man to manpath
    --   Adding /usr/local/opt/curl/share/man to manpath
    --   Adding /usr/local/opt/openssl/share/man to manpath
    --   Adding /usr/local/opt/libiconv/share/man to manpath
    --   Adding /usr/local/opt/sqlite/share/man to manpath
    --   Adding /usr/local/share/man to manpath
    --   Adding /usr/local/man to manpath
    --   Adding /usr/share/man to manpath
    --   Adding /Library/Apple/usr/share/man to manpath
    --   Adding /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man to manpath
    --   Adding /Applications/Xcode.app/Contents/Developer/usr/share/man to manpath
    --   Adding /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man to manpath
    -- Adding default manpath entries
    -- Parsing config file: /etc/man.conf
    -- Using manual path: /Users/marslo/perl5/man:/Users/marslo/.local/share/man:/usr/local/Cellar/icu4c@71.1/71.1/share/man:/usr/local/vim/share/man:/Applications/MacVim.app/Contents/man:/usr/local/opt/llvm/share/man:/usr/local/opt/util-linux/share/man:/usr/local/opt/gnu-getopt/share/man:/usr/local/opt/binutils/share/man:/usr/local/opt/ruby/share/man:/usr/local/opt/tcl-tk/share/man:/usr/local/Cellar/node/21.1.0/share/man:/usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/man:/usr/local/opt/ed/share/man:/usr/local/opt/git-extras/share/man:/usr/local/opt/gettext/share/man:/usr/local/opt/file-formula/share/man:/usr/local/opt/openldap/share/man:/usr/local/opt/curl/share/man:/usr/local/opt/openssl/share/man:/usr/local/opt/libiconv/share/man:/usr/local/opt/sqlite/share/man:/usr/local/share/man:/usr/local/man:/usr/share/man:/Library/Apple/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
    /Users/marslo/perl5/man:/Users/marslo/.local/share/man:/usr/local/Cellar/icu4c@71.1/71.1/share/man:/usr/local/vim/share/man:/Applications/MacVim.app/Contents/man:/usr/local/opt/llvm/share/man:/usr/local/opt/util-linux/share/man:/usr/local/opt/gnu-getopt/share/man:/usr/local/opt/binutils/share/man:/usr/local/opt/ruby/share/man:/usr/local/opt/tcl-tk/share/man:/usr/local/Cellar/node/21.1.0/share/man:/usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/man:/usr/local/opt/ed/share/man:/usr/local/opt/git-extras/share/man:/usr/local/opt/gettext/share/man:/usr/local/opt/file-formula/share/man:/usr/local/opt/openldap/share/man:/usr/local/opt/curl/share/man:/usr/local/opt/openssl/share/man:/usr/local/opt/libiconv/share/man:/usr/local/opt/sqlite/share/man:/usr/local/share/man:/usr/local/man:/usr/share/man:/Library/Apple/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
    

others

[!NOTE|label:references:]

GitHubDaily/GitHubDaily

Copyright © marslo 2020-2024 all right reserved,powered by GitbookLast Modified: 2025-03-27 00:56:32

results matching ""

    No results matching ""