Skip to content

Instantly share code, notes, and snippets.

@blockspacer
Last active September 10, 2023 17:00
Show Gist options
  • Select an option

  • Save blockspacer/2fa7b66b37d00856aeed341bce708ddb to your computer and use it in GitHub Desktop.

Select an option

Save blockspacer/2fa7b66b37d00856aeed341bce708ddb to your computer and use it in GitHub Desktop.
fresh ubuntu

Fresh ubuntu? Try this!

TODO: to script with select screen. Extend functionality of https://github.com/cesar-rgon/desktop-app-installer

Keyboard layout switch hotkeys

sudo apt install gnome-tweaks -y
gsettings set org.gnome.desktop.input-sources xkb-options "['grp:ctrl_shift_toggle']"
gsettings set org.gnome.desktop.input-sources xkb-options "['grp:alt_shift_toggle']"

Ubuntu version

lsb_release -a

Kernel/architecture

uname -a

Don't use rm

Read:

sudo -E apt-get install -y trash-cli
echo "alias rmt=trash" >> ~/.bashrc
source ~/.bashrc
# test
touch testfile
rmt testfile
# commanlist: 
    trash-put: Delete files and folders.
    trash-list: Pint Deleted files and folders.
    trash-restore: Restore a file or folder from trash.
    trash-rm: Remove individual files from the trashcan.
    trash-empty: Empty the trashcan(s).
    trash-empty 10: Remove older then 10 days file

If Trash-cli is not available on the repositories, you can compile and install it from sources.

# read https://www.ostechnix.com/trash-cli-command-line-trashcan-unix-like-systems/
git clone https://github.com/andreafrancia/trash-cli.git
cd trash-cli
sudo python setup.py install

Other platforms:

wget --no-check-certificate https://github.com/PhrozenByte/rmtrash/archive/v1.12.zip
unzip -d rmtrash
chmod +x rmtrash/rmtrash
chmod +x rmdirtrash/rmdirtrash
sudo mv rmtrash/rmtrash /usr/bin/
sudo mv rmdirtrash/rmdirtrash /usr/bin/
echo "alias rmt=rmtrash" >>/etc/bashrc
source /etc/bashrc
touch testfile
rmt testfile

bash_aliases

TODO

partition

TODO

set timezone

TODO

Proxy

sudo nano /etc/cntlm.conf

# After edit:
# sudo service cntlm restart

Username .........

# Domain corp.yourcompany
Domain corp

Proxy yourcompany.com:port

# NoProxy localhost, 127.0.0.*, 10.*, 192.168.*, 172.16., .yourcompany.com

Listen 8088

# Or any port you want
# Edit ~/.profile:
# nano ~/.profile
# export http_proxy=127.0.0.1:8088
# export ftp_proxy=127.0.0.1:8088
# export https_proxy=127.0.0.1:8088
# Apply changes:
# source ~/.profile

# sudo cntlm -v This runs cntlm in verbose mode and it prints information about every connection it makes.
# sudo service cntlm status

Gateway no
Allow 127.0.0.1
Allow localhost
Allow 192.168.1.10

# after sudo cntlm -c /etc/cntlm.conf -I -M http://google.ro
Auth            NTLMv2
PassNTLMv2      ...........

sudo nano /etc/apt/apt.conf.d/00proxy

Acquire::https { Proxy "https://user:pass@proxydomain:port"; proxydomain DIRECT; };

Acquire::http { Proxy "http://user:pass@proxydomain:port"; proxydomain DIRECT; };

sudo nano /etc/apt/apt.conf

# If your username or password has '@' in it you can replace it with %40 Example:If your password is @123 enter it as %40123. 

Acquire::https::Proxy "https://localhost:8088/";
Acquire::http::Proxy "http://localhost:8088/";
Acquire::ftp::Proxy "ftp://localhost:8088/"; 
Acquire::socks::proxy "socks://localhost:8088/";

Acquire::::Proxy "true";

update

Main - Canonical-supported free and open-source software.
Universe - Community-maintained free and open-source software.
Restricted - Proprietary drivers for devices.
Multiverse - Software restricted by copyright or legal issues. 
sudo add-apt-repository universe

sudo apt update -y
sudo apt upgrade -y
# This software provides an abstraction of the used apt repositories. It allows you to easily manage your distribution and independent software vendor software sources.
sudo apt install software-properties-common -y

Enable Proprietary and Canonical Partners Repositories

Go Settings —> Repositories

Main – Free and open-source software supported by Ubuntu team
Universe – Free and open-source software maintained by the community
Restricted – Proprietary drivers for devices.
Multiverse – Software restricted by copyright or legal issues.
Canonical Partners – Software packaged by Ubuntu for their partners 
sudo apt update -y

# Who's logged on

sudo apt install finger -y
finger

synaptic

sudo apt install synaptic -y

Install Multimedia Codecs

sudo apt install -y ubuntu-restricted-addons mencoder flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview mpeg3-utils mpegdemux liba52-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 icedax lame libmad0 libjpeg-progs libdvdcss2 libdvdread4 libdvdnav4

vlc

sudo add-apt-repository ppa:videolan/stable-daily
sudo apt-get update && sudo apt-get install vlc -y

Install Archive Applications

sudo apt-get install unrar zip unzip p7zip-full p7zip-rar rar sharutils mpack arj cabextract file-roller cabextract -y

Essential packages for running 32-bit applications in 64-bit Ubuntu

sudo apt-get install ia32-libs -y

Skype

sudo apt-get install skype -y

OR latest:
apt install apt-transport-https -y
curl https://repo.skype.com/data/SKYPE-GPG-KEY | apt-key add -
echo "deb https://repo.skype.com/deb stable main" | tee /etc/apt/sources.list.d/skypeforlinux.list
apt update 
apt install skypeforlinux -y

Install Python

sudo apt-get install python-setuptools python-dev python-pip

If you use company index-url:
sudo cat >> /etc/pip.conf << EOF
[global]
timeout = 60
index-url = https://pypi.python.org/simple/
extra-index-url = http://151.101.112.223/root/pypi/+simple/
                  http://pypi.company:port/root/pypi/+simple/
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org
               pypi.corp.company
EOF
sudo chmod 644 /etc/pip.conf

python -V
pip -V

build-essential

sudo apt-get install build-essential -y

Install Wine

sudo apt-get install wine winetricks -y

Install docker

ubuntu docker https://docs.docker.com/install/linux/docker-ce/ubuntu/

postinstall https://docs.docker.com/install/linux/linux-postinstall/

Change Docker Data Folder Configuration

sudo systemctl daemon-reload
sudo systemctl restart docker
sudo touch /etc/docker/daemon.json
sodo nano  /etc/docker/daemon.json 

Move docker data to another drive:

{
 //...
 "data-root": "/mnt/docker"
 //...
}

https://medium.com/developer-space/how-to-change-docker-data-folder-configuration-33d372669056

Install JAVA

sudo apt install python-software-properties -y
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt update
sudo apt-get install openjdk-8-jdk openjdk-8-jre oracle-java8-installer

Teamviewer

wget http://download.teamviewer.com/download/teamviewer_i386.deb
dpkg -i teamviewer_i386.deb
apt-get install -f -y
rm -rf teamviewer_i386.deb

Install chromium

sudo apt install chromium-browser -y

OR for latest:

if [[ $(getconf LONG_BIT) = "64" ]]
then
	echo "64bit Detected" &&
	echo "Installing Google Chrome" &&
	wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb &&
	sudo dpkg -i google-chrome-stable_current_amd64.deb &&
	rm -f google-chrome-stable_current_amd64.deb
else
	echo "32bit Detected" &&
	echo "Installing Google Chrome" &&
	wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb &&
	sudo dpkg -i google-chrome-stable_current_i386.deb &&
	rm -f google-chrome-stable_current_i386.deb
fi

Install commonly used software

sudo apt-get -y install transmission curl wget

vim

sudo apt-get -y install vim

TODO:


# vim-plugins
- name: Install pathogen
  git: >
    repo="https://github.com/tpope/vim-pathogen.git"
    dest="/home/{{ ansible_ssh_user }}/.vim"
    update=no
  environment:
    GIT_SSL_NO_VERIFY: true

- name: Install vim plugins
  git: >
    repo="{{ item }}.git"
    dest="/home/{{ ansible_ssh_user }}/.vim/bundle/{{ item | basename }}"
    update=no
  environment:
    GIT_SSL_NO_VERIFY: true
  with_items:

  # General-purpose tools
  - https://github.com/xolox/vim-misc
  - https://github.com/ervandew/supertab
  - https://github.com/junegunn/vim-easy-align
  - https://github.com/tpope/vim-surround
  - https://github.com/tpope/vim-sensible
  - https://github.com/christoomey/vim-tmux-navigator
  - https://github.com/kien/ctrlp.vim
  - https://github.com/Lokaltog/vim-easymotion
  - https://github.com/sjl/gundo.vim
  - https://github.com/mileszs/ack.vim    # requires the 'ack-grep' package
  - https://github.com/ciaranm/detectindent
  - https://github.com/tomtom/tcomment_vim

  # Colors
  - https://github.com/flazz/vim-colorschemes
  - https://github.com/vim-scripts/vim-colorscheme-switcher
  - https://github.com/tomasr/molokai

  # Git tools
  - https://github.com/tpope/vim-fugitive

  # Yaml tools
  - https://github.com/stephpy/vim-yaml

  # Puppet tools
  - https://github.com/rodjek/vim-puppet

  # C/C++ tools
  - https://github.com/Rip-Rip/clang_complete

  # Docker tools
  - https://github.com/ekalinin/Dockerfile.vim

#- name: Download YouCompleteMe
#  git:
#    repo: 'https://github.com/Valloric/YouCompleteMe'
#    dest: ~/YouCompleteMe
#    update: no
#  environment:
#    GIT_SSL_NO_VERIFY: true
#
#- name: Getfull YouCompleteMe
#  command: chdir=~/YouCompleteMe git submodule update --init --recursive
#
#- name: Compile YouCompleteMe
#  command: chdir=~/YouCompleteMe ./install.py --clang-completer
#  environment:
#    CC: clang-6.0
#    CXX: clang++-6.0

Install gimp

sudo apt install synaptic gimp gimp-data gimp-plugin-registry gimp-data-extras -y

bleachbit is a powerful cleaning utility.

sudo apt install bleachbit -y

Install KDE plasma

sudo apt install tasksel -y
sudo apt install sddm -y
# The system will then offer you to make a selection for configuring sddm
sudo dpkg-reconfigure sddm
# The sddm display manager is the default one for KDE Plasma desktop. Hit Enter for Ok. 
sudo tasksel install kubuntu-desktop
# The system will then offer you to make a selection for configuring sddm

Restart your system to login to KDE Plasma

Configure KDE https://linuxthebest.net/ukrashaem-rabochee-okruzhenie-kde-plasma/

Install Needed Drivers

sudo -E add-apt-repository ppa:graphics-drivers/ppa
sudo -E apt update -y
sudo -E ubuntu-drivers autoinstall

Check inodes

Worth running df -i to check the you haven't run out of inodes (ifree should be non-zero on writable partitions) - this can happen on some filesystems, especially if a larger number of small files have been created.

Swap size

Get swap and RAM size

sudo -E apt install htop -y
htop

Generally, an amount equal to or double the amount of RAM on your system is a good starting point. Another good rule of thumb is that anything over 4G of swap is probably unnecessary if you are just using it as a RAM fallback.

Only if you dont have swap - create new:

sudo fallocate -l 1G /swapfile
# Make the file only accessible to root by typing:
sudo chmod 600 /swapfile
# Verify
ls -lh /swapfile
# mark the file as swap space
sudo mkswap /swapfile
# enable the swap file, allowing our system to start utilizing it
sudo swapon /swapfile
# verify
sudo swapon --show
# Make the Swap File Permanent
# Back up the /etc/fstab file in case anything goes wrong:
sudo cp /etc/fstab /etc/fstab.bak
# You can add the swap file information to the end of your /etc/fstab file by typing:
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Resize existing swap:

# Turn off all swap processes 
sudo swapoff -a
# Check Available Space on the Hard Drive Partition
df -h
# Resize the swap. Command will append count*bs of zero bytes at the end of your swap file.
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
# Make the file usable as swap
sudo mkswap /swapfile
# Activate the swap file 
sudo swapon /swapfile
# Verify
sudo swapon --show

The swappiness parameter configures how often your system swaps data out of RAM to the swap space. This is a value between 0 and 100 that represents a percentage.

# verify
cat /proc/sys/vm/swappiness
# For a Desktop, a swappiness setting of 60 is not a bad value. For a server, you might want to move it closer to 0.
sudo sysctl vm.swappiness=60
# Make the swappiness Permanent
sudo nano /etc/sysctl.conf
# At the bottom, you can add:
vm.swappiness=60

vfs_cache_pressure. This setting configures how much the system will choose to cache inode and dentry information over other data.

cat /proc/sys/vm/vfs_cache_pressure
sudo sysctl vm.vfs_cache_pressure=50
sudo nano /etc/sysctl.conf
# At the bottom, add the line that specifies your new value:
vm.vfs_cache_pressure=50

ssh

sudo apt-get install -y --no-install-recommends openssh-server ssh
sudo apt install sshpass -y

filezilla

sudo apt install filezilla -y

Git and differences viewer

sudo apt install git -y
sudo apt install meld -y
sudo apt install smartgit -y

  $ git config --global user.name '...'     # username
  $ git config --global user.email '...@...'  # email
  $ git config --global color.ui true         # pretiffy
  
  $ git config --global credential.helper 'cache --timeout=3600' # cache password for 1 hour
  
  OR
  
  $ git config --global credential.helper store
  
  $ git config --list

Clean Up

echo "Cleaning Up" &&
sudo apt -f install &&
# Remove Orphaned Packages
sudo apt autoremove && 
sudo apt -y autoclean &&
# Clean Package Cache
sudo apt -y clean

VS CODE multiCursorModifier

(settings)

"editor.multiCursorModifier": "ctrlCmd"

USE ctrl+shift

VS CODE USE ctrl+shift+alt

(keybindings)

[
    {
        "key": "ctrl+shift+alt+down",
        "command": "cursorColumnSelectDown",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+alt+left",
        "command": "cursorColumnSelectLeft",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+alt+pagedown",
        "command": "cursorColumnSelectPageDown",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+alt+pageup",
        "command": "cursorColumnSelectPageUp",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+alt+right",
        "command": "cursorColumnSelectRight",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+alt+up",
        "command": "cursorColumnSelectUp",
        "when": "editorTextFocus"
    }
]

QT CREATOR

https://www.qt.io/offline-installers

clang

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key --no-check-certificate | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main"
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main"
sudo -E apt-get update
sudo -E apt-get install build-essential -y
sudo -E apt-get install clang-6.0 python-lldb-6.0 lldb-6.0 lld-6.0 llvm-6.0-dev -y
sudo -E apt-get install clang-tools-6.0 libclang-common-6.0-dev libclang-6.0-dev -y
sudo -E apt-get install libc++-6.0-dev libc++abi-6.0-dev -y
# sudo -E apt-get install libstdc++6 -y

TODO:

#!/bin/bash

# python-setuptools python-pip python-devel must be preinstalled
# cmake must be preinstalled

# see https://llvm.org/docs/GettingStarted.html
# see https://github.com/search?q=DLLVM_ENABLE_PROJECTS&type=Wikis

# se for deps list https://github.com/spack/spack/blob/master/var/spack/repos/builtin/packages/llvm/package.py

# requires curl gcc Make python zlib
# make sure requirements installed
yum -y install make curl tar gcc gcc-c++ m4 autoconf automake libtool zlib-devel libstdc++-devel git rpm-build libxml2-devel libffi-devel

yum -y install ninja-build

yum -y install subversion

yum -y install ncurses-devel ncurses

# see https://lldb.llvm.org/build.html
yum -y install libedit-devel libxml2-devel swig

yum -y install unrar unzip

mkdir -p src/llvm-project

cd src/llvm-project

#if [ ! -d llvm ] ; then
    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/llvm.git
    wget https://github.com/llvm-mirror/llvm/archive/release_60.zip --no-check-certificate
    # TODO https://github.com/llvm/llvm-project/archive/llvmorg-6.0.1.zip
    unzip release_60.zip -d llvm
    mv llvm/llvm-release_60/* llvm/
    rm release_60.zip
    cd llvm
    #git checkout release_60
#    git checkout release_70
#    git checkout d42d9e83aeb0e752cec99b1a1f2b17a9246bff27
    cd ..
#fi

#if [ ! -d clang ] ; then
    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/clang.git
    wget https://github.com/llvm-mirror/clang/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d clang
    #mv clang/llmv-release_60/* clang/
    mv clang/clang-release_60/* clang/
    rm release_60.zip
    cd clang
    #git checkout release_60
#    git checkout release_70
#    git checkout 23b713ddc4e7f70cd6e96ea93eab3f06ca3a72d7
    cd ..
#fi

#if [ ! -d libcxx ] ; then
    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/libcxx.git
    wget https://github.com/llvm-mirror/libcxx/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d libcxx
    #mv libcxx/llmv-release_60/* libcxx/
    mv libcxx/libcxx-release_60/* libcxx/
    rm release_60.zip
    cd libcxx
    #git checkout release_60
#    git checkout release_70
#    git checkout 0b261846c90cdcfa6e584a5048665a999900618f
    cd ..
#fi

#if [ ! -d libcxxabi ] ; then
    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/libcxxabi.git
    wget https://github.com/llvm-mirror/libcxxabi/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d libcxxabi
    mv libcxxabi/libcxxabi-release_60/* libcxxabi/
    rm release_60.zip
    cd libcxxabi
    #git checkout release_60
#    git checkout release_70
#    git checkout 565ba0415b6b17bbca46820a0fcfe4b6ab5abce2
    cd ..
#fi

    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/lld.git
    wget https://github.com/llvm-mirror/lld/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d lld
    mv lld/lld-release_60/* lld/
    rm release_60.zip
    cd lld
    #git checkout release_60
#    git checkout release_70
#    git checkout 565ba0415b6b17bbca46820a0fcfe4b6ab5abce2
    cd ..

    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/compiler-rt.git
    wget https://github.com/llvm-mirror/compiler-rt/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d compiler-rt
    mv compiler-rt/compiler-rt-release_60/* compiler-rt/
    rm release_60.zip
    cd compiler-rt
    #git checkout release_60
#    git checkout release_70
#    git checkout 565ba0415b6b17bbca46820a0fcfe4b6ab5abce2
    cd ..

    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/lldb.git
    wget https://github.com/llvm-mirror/lldb/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d lldb
    mv lldb/lldb-release_60/* lldb/
    rm release_60.zip
    cd lldb
    #git checkout release_60
#    git checkout release_70
#    git checkout 565ba0415b6b17bbca46820a0fcfe4b6ab5abce2
    cd ..

    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/libunwind.git
    wget https://github.com/llvm-mirror/libunwind/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d libunwind
    mv libunwind/libunwind-release_60/* libunwind/
    #mv libunwind/llmv-release_60/* libunwind/
    rm release_60.zip
    cd libunwind
    #git checkout release_60
#    git checkout release_70
#    git checkout 565ba0415b6b17bbca46820a0fcfe4b6ab5abce2
    cd ..

    # git clone too slow, replaced with wget
    #GIT_SSL_NO_VERIFY=true git clone https://llvm.org/git/clang-tools-extra.git
    wget https://github.com/llvm-mirror/clang-tools-extra/archive/release_60.zip --no-check-certificate
    unzip release_60.zip -d clang-tools-extra
    mv clang-tools-extra/clang-tools-extra-release_60/* clang-tools-extra/
    rm release_60.zip
    cd clang-tools-extra
    #git checkout release_60
#    git checkout release_70
#    git checkout 565ba0415b6b17bbca46820a0fcfe4b6ab5abce2
    cd ..

export PATH=/usr/local/bin:/usr/bin:$PATH:$HOME/bin

which cmake

file /usr/local/bin/cmake

file /usr/bin/cmake

cmake --version

pwd

ls -artl

cd llvm

mkdir -p llvm-build
cd llvm-build

# see http://www.linuxfromscratch.org/blfs/view/cvs/general/llvm.html
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_DOCS=OFF -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLLVM_ENABLE_DOXYGEN=OFF -DLLVM_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/clang_6.0.1 -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libunwind;libcxx;libcxxabi;lldb;lld;compiler-rt" -G "Unix Makefiles" -DLLVM_ENABLE_EH=On -DLLVM_ENABLE_RTTI=On ..

cmake --build . -- -j2

# make install
# see https://solarianprogrammer.com/2013/01/17/building-clang-libcpp-ubuntu-linux/
make install/strip

# /home/vagrant/src/llvm-project/*
ls -artl ../../*

cd ..

# NOTE: To append text to a file you use >>. To overwrite the data currently in that file, you use >
# create new .conf files
echo "/usr/local/clang_6.0.1/lib" > /etc/ld.so.conf.d/clang.conf
echo "/usr/local/clang_6.0.1/libexec" > /etc/ld.so.conf.d/clanglibexec.conf
/sbin/ldconfig
# append to ~/.bashrc
echo 'export PATH=/usr/local/clang_6.0.1/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/clang_6.0.1/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

clang --version
clang++ --version
clang-6.0 --version
clang-6.0.1 --version

# TODO update-alternatives
# https://gist.github.com/sergey-shambir/a075161d774e211e1a423826764c7d33

## too slow git clone -> use wget or ssh-clone
## GIT_SSL_NO_VERIFY=true git clone https://github.com/llvm/llvm-project.git
#wget https://github.com/llvm/llvm-project/archive/llvmorg-6.0.1.zip #--no-check-certificate
#unzip llvmorg-6.0.1.zip -d llvm-project
#cd llvm-project
## too slow git clone -> use wget or ssh-clone
## git checkout release/6.x
## (in-tree build is not supported)
#mkdir build
#cd build
#cmake -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld" -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_LIBCXX=On -DLLVM_ENABLE_EH=On -DLLVM_ENABLE_RTTI=On ../llvm-project-llvmorg-6.0.1
#cmake --build . -- -j2
#make install
#cd ..
#rm -rf llvm-project

# https://bobsteagall.com/2018/01/15/clang-builder/
# https://github.com/BobSteagall/clang-builder/tree/clang60
# export CLANG_VERSION=6.0.X
#GIT_SSL_NO_VERIFY=true git clone https://github.com/BobSteagall/#clang-builder.git
#cd clang-builder
#git checkout clang60
#cd clang-builder
## CLANG_VERSION=6.0.1 ./clang-build-vars.sh
##./build-clang.sh -T | tee build.log
###- Get the CLANG-related variables and command-line options for this build.
###
## source ./clang-build-vars.sh
###- Fetch the various pieces required to build LLVM, CLANG, and LIBCXX.
###
#export CLANG_VERSION=6.0.1
#
#
###- Customize variable this to name the installation; the custom name
###  is displayed when a user invokes clang or clang++ with the -v flag
###  ("clang -v").
###
#export CLANG_VENDOR="(KEWB Computing Build)"
#
###- Customize this variable to define the middle substring in the Clang
###  build triple.
###
#export CLANG_CUSTOM_BUILD_TAG=kewb
#
###- Customize these variables to specify where this version of Clang will
###  be installed.
###
#export CLANG_INSTALL_ROOT=/usr/local
#export CLANG_INSTALL_PREFIX=$CLANG_INSTALL_ROOT/clang/$CLANG_VERSION
#
###- Customize this variable to specify the installation's time stamp.
###
#export CLANG_TIME_STAMP=201807131000
#
###- Customize this variable if you want to change the arguments passed
###  to "make" that specify the number of threads used to build Clang.
###
#export CLANG_BUILD_THREADS_ARG='-j2'
#
###- If building on Linux, customize these variables to specify the location
###  of the preferred GCC toolchain partner on this platform.  The most
###  important thing is that the variable GCC_INSTALL_PREFIX be defined;
###  it should have the same value as the --prefix flag used to configure
###  the GCC installation.
###
#if [ `uname` == "Linux" ]
#then
#    export GCC_VERSION=8.1.0
#    export GCC_INSTALL_PREFIX=/usr/local/gcc/$GCC_VERSION
#fi
#
###- If building on Linux, customize this variable to specify the desired ABI
###  that libc++ will be linked against.  The choices currently supported by
###  these scripts are libstdc++ and libsupc++.
###
###  If you think that you'll be building executables that link to shared
###  objects that are themselves linked to libstdc++, then you should specify
###  "GCC_CXX_ABI=libstdc++" below.
###
###  On the other hand, if you'll be building everything using a single #version
###  of Clang (this one), then it's OK to specify "GCC_CXX_ABI=libsupc++" #below.
###
#if [ `uname` == "Linux" ]
#then
#    export GCC_CXX_ABI=libsupc++
#fi
#
###--------------------------------------------------------------------------#----
###      Do not change below this line!
###--------------------------------------------------------------------------#----
###
#export CLANG_PLATFORM=`uname`
#
#export LLVM_TARBALL=llvm-$CLANG_VERSION.src.tar.xz
#export CFE_TARBALL=cfe-$CLANG_VERSION.src.tar.xz
#export CRT_TARBALL=compiler-rt-$CLANG_VERSION.src.tar.xz
#export CTX_TARBALL=clang-tools-extra-$CLANG_VERSION.src.tar.xz
#export LIB_TARBALL=libcxx-$CLANG_VERSION.src.tar.xz
#export ALL_TARBALLS="$LLVM_TARBALL $CFE_TARBALL $CRT_TARBALL $CTX_TARBALL #$LIB_TARBALL"
#
#export CLANG_TAG="${CLANG_VERSION//.}"
#export CLANG_SRC_DIR=$TOP_DIR/llvm-$CLANG_VERSION
#export CLANG_BLD_DIR=$TOP_DIR/llvm-$CLANG_VERSION-build
#export CLANG_INSTALL_RELDIR=`echo $CLANG_INSTALL_PREFIX | sed 's:^/::'`
#
#export LIBCXX_SRC_DIR=$TOP_DIR/libcxx-$CLANG_VERSION
#export LIBCXX_BLD_DIR=$TOP_DIR/libcxx-$CLANG_VERSION-build
#
#export CLANG_STAGEDIR=$TOP_DIR/dist
#
#if [ "$CLANG_PLATFORM" == "FreeBSD" ]
#then
#    export CLANG_MAKE=gmake
#
#elif [ "$CLANG_PLATFORM" == "Linux" ]
#then
#    export GCC_BIN=$GCC_INSTALL_PREFIX/bin/gcc
#    export CLANG_MAKE=make
#else
#    echo "Unknown build platform!"
#    exit 1
#fi
#
#if [ -z "$NO_PARSE_OPTS" ]
#then
#    if [ $# == "0" ]
#    then
#        DO_CLANG=YES
#        DO_CXXLIB=YES
#        DO_TEST=YES
#    else
#        while getopts ":clhtT" opt
#        do
#            case $opt in
#                c ) DO_CLANG=YES ;;
#                l ) DO_CXXLIB=YES ;;
#                h ) echo "usage: $0 [-c] [-l] [-h] [-t|-T]"
#                    exit 1 ;;
#                t ) DO_TEST=YES ;;
#                T ) DO_TEST= ;;
#                * ) echo "usage: $0 [-c] [-l] [-h] [-t|-T]"
#                    exit 1 ;;
#            esac
#        done
#    fi
#fi
#
##./fetch-clang.sh
#
#mkdir -p ./tarballs
#cd ./tarballs
#
#echo "Checking for required tarballs... "
#
#if [ ! -e $LLVM_TARBALL ]
#then
#    echo "Downloading $LLVM_TARBALL... "
#    wget http://llvm.org/releases/$CLANG_VERSION/$LLVM_TARBALL
#fi
#
#if [ ! -e $CFE_TARBALL ]
#then
#    echo "Downloading $CFE_TARBALL... "
#    wget http://llvm.org/releases/$CLANG_VERSION/$CFE_TARBALL
#fi
#
#if [ ! -e $CRT_TARBALL ]
#then
#    echo "Downloading $CRT_TARBALL... "
#    wget http://llvm.org/releases/$CLANG_VERSION/$CRT_TARBALL
#fi
#
#if [ ! -e $CTX_TARBALL ]
#then
#    echo "Downloading $CTX_TARBALL... "
#    wget http://llvm.org/releases/$CLANG_VERSION/$CTX_TARBALL
#fi
#
#if [ ! -e $LIB_TARBALL ]
#then
#    echo "Downloading $LIB_TARBALL... "
#    wget http://llvm.org/releases/$CLANG_VERSION/$LIB_TARBALL
#fi
#
#cd ..
#
###- Unpack, configure, and build LLVM and CLANG.
###
#./unpack-clang.sh -c
#./configure-clang.sh -c
#./make-clang.sh -c
#
###- Unpack, configure, and build LIBCXX
###
#./unpack-clang.sh -l
#./configure-clang.sh -l
#./make-clang.sh -l
#
#./stage-clang.sh
#./pack-clang.sh
#sudo tar -zxvf ./packages/kewb-clang60X*.tgz
## ./make-clang-rpm.sh -v
#
#clang --version

vagrant

sudo -E wget https://releases.hashicorp.com/vagrant/2.2.3/vagrant_2.2.3_x86_64.deb --no-check-certificate
sudo -E dpkg -i vagrant_2.2.3_x86_64.deb
sudo -E apt-get install -f
sudo -E rm vagrant_2.2.3_x86_64.deb
sudo -E apt-get -y install software-properties-common
sudo -E apt-get -y install gcc make linux-headers-$(uname -r) dkms
sudo -E wget https://download.virtualbox.org/virtualbox/6.0.4/virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb --no-check-certificate
sudo -E dpkg -i virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb
sudo -E apt-get install -f
sudo -E rm virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb
sudo -E modprobe vboxdrv
sudo -E modprobe vboxnetflt
sudo -E modprobe vboxpci
sudo -E modprobe vboxnetadp
lsmod | grep vbox

nfs

sudo -E apt-get install nfs-kernel-server -y
sudo -E apt-get install nfs-common -y

openssl

SEE https://askubuntu.com/a/973540 and https://stackoverflow.com/a/51565653/1373413

sudo -E wget https://www.openssl.org/source/old/1.1.0/openssl-1.1.0g.tar.gz
tar xzvf openssl-1.1.0g.tar.gz
cd openssl-1.1.0g
./config
make
sudo make install

/usr/local/bin/openssl version -a

packer

cd /usr/local/src/
sudo -E wget https://releases.hashicorp.com/packer/1.3.4/packer_1.3.4_linux_amd64.zip --no-check-certificate
sudo -E unzip packer_*.zip
sudo -E rm -rf /usr/local/src/packer_*.zip
yes | sudo -E mv -f /usr/local/src/packer /usr/local/bin/packer
sudo -E chmod +x /usr/local/bin/packer
packer version

ansible

sudo -E apt-get update
sudo -E apt-get install git -y
sudo -E apt-get install python-paramiko -y
sudo -E apt-get install python-jinja2 -y
sudo -E apt-get install python-yaml -y
sudo -E apt-get install python-crypto -y
sudo -E apt-get install python-pip -y

cat << EOT > ~/install_ansible.sh
#!/bin/bash
sudo -E apt-get install -y build-essential python-dev python-setuptools
cd /tmp && wget https://github.com/ansible/ansible/archive/v2.7.8.tar.gz --no-check-certificate
tar xzf v2.7.8.tar.gz
cd ansible-2.7.8* && sudo -E python setup.py install
EOT

bash ~/install_ansible.sh

sudo echo 'export PATH=$PATH:/usr/local/bin' >> /etc/profile
source /etc/profile
ansible --version

cppcheck

sudo -E apt-get install cppcheck -y

cmake

cmake-3.13.4.tar.gz --no-check-certificate
tar -zxvf cmake-3.13.4.tar.gz
pwd
ls -artl
cd cmake-3.13.4
./bootstrap --prefix=/usr/local
cmake --build . -- -j4
make install
export PATH=/usr/local/bin:/usr/bin:$PATH:$HOME/bin
echo "PATH=$PATH" >> ~/.bash_profile
source ~/.bash_profile
cmake --version

check MD5SUM

# This will create a checksum of "myFile" while downloading and save it to the file MD5SUM, possibly saving you some time.
wget -O - https://cmake.org/files/v3.13/cmake-3.13.4.tar.gz --no-check-certificate | tee myFile | md5sum | awk '{print $1}' > ~/md5.txt
echo "b5a544ffc73f6922a6cf371fcb6bae22" >> ~/md5check.txt
cat >> ~/mdcheck.sh << EOF
#!/bin/bash
echo "md5 = `cat ~/md5.txt`"
echo "md5check = `cat ~/md5check.txt`"
if [ "`cat ~/md5.txt`" != "`cat ~/md5check.txt`" ]; then
  echo "md5sum failed. Please check the md5sum. File may possibly be corrupted."
else
  echo "md5sum passed ;)"
fi
EOF
sh ~/mdcheck.sh

docker

TODO

- name: Install docker
  yum: name={{ item }} state=present
  with_items:
    - docker-io
  notify:
    - start docker daemon
    - start docker on boot

# Same as sudo groupadd docker
- name: Ensure group "docker" exists
  group:
    name: docker
    state: present

# Same as sudo usermod -aG docker vagrant
# groups: you can use a comma separated list: admin,sudo.
# if you omit append: yes, user will be removed from all other groups
- name: Add user to docker group
  user: name={{ ansible_ssh_user }} groups=docker append=yes

TODO

- vim-enhanced
- htop
- socat
- ack
- libnotify
- rsync
- nasm
- ltrace
- ctags
- cscope
- xz
- elinks
- pam-devel
- openssl-devel
- libpcap-devel

- colorgcc

- tig
- gdb
- graphviz
- valgrind
- automake
- kcachegrind
- ccache
- doxygen
- bison
- flex
- cppcheck

- rats

- sudo
- tmux
- wget
- xz-libs
- zlib
- openssl
- curl
- expat
- libuuid
- libuuid-devel
- mlocate
- iftop
- htop
- yum-plugin-fastestmirror
- ncurses
- ncurses-devel
- unzip
- iperf
- screen
- yum-utils

TODO: emscripten

yum -y install SDL2-devel # https://apps.fedoraproject.org/packages/SDL2-devel/
yum -y groupinstall "X Software Development"

# yum search SDL2 # look for libraries and development headers should something like sdl2.0 and sdl2.0.0-dev

# emscripten
# see https://blog.cles.jp/item/9428
# see https://blog.csdn.net/martinking1997/article/details/82460849
# Python preinstalled!
# Install Python
# yum -y install python2.7
# Install node.js
echo "strict-ssl=false" >> ~/.npmrc
echo "registry=http://registry.npmjs.org/" >> ~/.npmrc
yum -y install nodejs
export NODE_TLS_REJECT_UNAUTHORIZED=0
#export NODE_EXTRA_CA_CERTS=/etc/pki/ca-trust/source/anchors/yourCer‌​ts.pem
echo 'NODE_TLS_REJECT_UNAUTHORIZED=0' >> ~/.bashrc
node --version
yum -y install npm

# see https://stackoverflow.com/a/18346387
npm config set strict-ssl false
# Then set npm to run with http, instead of https:
npm config set registry "http://registry.npmjs.org/"
npm --version
npm config list
# you may get NPM to work behind a proxy by setting BOTH HTTP_PROXY and HTTPS_PROXY environment variables, 
# npm config set proxy http://proxy_host:port
# npm --without-ssl --insecure --proxy http://username:password@cacheaddress.com.br:80\ install packagename
npm install -g pm2
# CMake preinstalled!
# Install CMake (optional, only needed for tests and building Binaryen)
# sudo apt-get install cmake
# Install Java (optional, only needed for Closure Compiler minification)
# jre
yum -y install java-1.8.0-openjdk
# jdk
yum -y install java-1.8.0-openjdk-devel
# clone emsdk
GIT_SSL_NO_VERIFY=true git clone https://github.com/emscripten-core/emsdk.git
# Enter that directory
cd emsdk
# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull
# Download and install the latest SDK tools.
# see https://hub.docker.com/r/minextu/sdl2-cross-platform/dockerfile/
./emsdk install -j2 --build=MinSizeRel latest
# Make the "latest" SDK "active" for the current user. (writes ~/.emscripten file)
./emsdk activate latest
# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

cat ./emsdk_env.sh

#export PATH="/home/wes/.emscripten-install:$PATH"
#export PATH="/home/wes/.emscripten-install/clang/e1.37.21_64bit:$PATH"
#export PATH="/home/wes/.emscripten-install/node/4.1.1_64bit/bin:$PATH"
#export PATH="/home/wes/.emscripten-install/emscripten/1.37.21:$PATH"
echo $PATH

# see https://hub.docker.com/r/minextu/sdl2-cross-platform/dockerfile/
# see https://stackoverflow.com/a/38227522
echo "source $(pwd)/emsdk_env.sh" >> ~/.bashrc

emcc -v

cd ..

pwd

ls -artl

#echo " IMPORTANT TO DO !!!! #-----------------------------------------------------------------------------#---------"
#echo " Open the file ./emsdk/emsdk_set_env.sh and copy its content into your #.bashrc file in your home folder"
#echo " This is used to supply the proper path to EMSCRIPTEN"
#echo " #-----------------------------------------------------------------------------#------------------------------"
# PATH="/opt/emsdk_portable:/opt/emsdk_portable/clang/fastcomp/build_master_64/bin:/opt/emsdk_portable/node/4.1.1_64bit/bin:/opt/emsdk_portable/emscripten/master:${PATH}"
@derofim
Copy link

derofim commented Mar 3, 2019

ebook utils

apt-get install file less bash coreutils gawk sed grep calibre p7zip-full tesseract-ocr tesseract-ocr-osd tesseract-ocr-eng python-lxml poppler-utils catdoc djvulibre-bin

docker container to convert ebooks with calibre.

https://github.com/gaborsomogyi/ebook-convert

epub to pdf

# same as sudo apt-get install calibre
sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"
ebook-convert file.pdf file.epub --enable-heuristics
# or
for i in *.epub; do ebook-convert --enable-heuristics "$i" "${i/%.epub/}.pdf";done

djvu to pdf

for i in *.djvu; do ddjvu -format=pdf -scale=100 "$i" "${i/%.djvu/}.pdf";done

create ebooks with css

The Blitz’ introductory tutorial
1 Document 2 Rule them All 3: Kindle eBook, PDF and Web Page
Blitz tips

@derofim
Copy link

derofim commented Mar 3, 2019

Scan Ubuntu 18.04 For Viruses With ClamAV

see https://linuxconfig.org/scan-ubuntu-18-04-for-viruses-with-clamav

@derofim
Copy link

derofim commented Mar 3, 2019

@blockspacer
Copy link
Author

@blockspacer
Copy link
Author

blockspacer commented Jul 23, 2019

non interactive gdb to run & backtrace

gdb EXE_HERE -ex "run" -ex "set pagination off" -ex "bt" -ex "set confirm off" -ex "quit"

see

http://matetelki.com/blog/?p=456

@blockspacer
Copy link
Author

Speed Up your Ubuntu!

https://easylinuxtipsproject.blogspot.com/p/speed-ubuntu.html

sudo ufw logging off

@blockspacer
Copy link
Author

tlp = no overheat

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo systemctl enable tlp
sudo tlp start
sudo tlp-stat -c

@blockspacer
Copy link
Author


# 1 for hard disks and 0 for a SSD.
lsblk -d -o name,rota
# test disk speed / get info
sudo hdparm -I /dev/sda
sudo smartctl /dev/sda -a
sudo hdparm -Tt /dev/sda
# SSDOptimization
# https://freedompenguin.com/articles/how-to/how-to-optimize-ubuntu-for-speed/
# https://blog.100tb.com/how-to-keep-your-ssds-fast-with-trim-on-linux
# https://wiki.debian.org/SSDOptimization
# Improve hard drive write speed with write-back caching
# https://linuxconfig.org/improve-hard-drive-write-speed-with-write-back-caching
sudo hdparm -W /dev/sda

#
# check LOGS
journalctl
journalctl --disk-usage
# limit on the available disk space for saving logs
# https://blog.selectel.com/managing-logging-systemd/
sudo journalctl --vacuum-size=1G
sudo journalctl --vacuum-time=1month
# reduce LOGS
# https://haydenjames.io/increase-performance-lifespan-ssds-sd-cards/

# mount tmpfs to RAM
# Note: Be careful not too increase it too much! Your system will deadlock since the Out-Of-Memory handler can not free up that space if needed
# https://www.marcobehler.com/2014/05/19/speed-up-that-build-now-part-1-ramdisk-and-filesystem-2
sudo mkdir /build
tmpfs    /build    tmpfs    noatime,nodev,nosuid,size=2G    0    0
#
sudo mount -a
reboot
# NOTE: also put the compiler there!
# build output to RAM disk (most important - because of the link step)

@blockspacer
Copy link
Author

@blockspacer
Copy link
Author

How to prevent the .xsession-errors file from growing to a huge size http://www.daniloaz.com/en/how-to-prevent-the-xsession-errors-file-from-growing-to-huge-size/
edit /etc/logrotate.conf

/home/**<dir_HERE>**/.xsession-errors { 
    daily
    size 100k
    rotate 0
}

And add logrotate to /etc/cron.daily

@blockspacer
Copy link
Author

@blockspacer
Copy link
Author

blockspacer commented Oct 17, 2019

Disk usage on Ubuntu - Find the largest Sized Directory or File

sudo -E apt-get install ncdu
sudo -E ncdu -x /
# sudo -H to avoid damaging your home directory.
sudo -E -H baobab

@blockspacer
Copy link
Author

docker rm $(docker ps -a | grep someservice | awk '{print $1}')

@blockspacer
Copy link
Author

blockspacer commented Jul 22, 2020

Sort docker images by size desc

# see https://gist.github.com/andyrbell/f30ae74c0eff82ae52238f4a7df9a313
#!/bin/sh
docker images | LC_COLLATE=C.UTF-8 sort -k7 -hr
# OR
# docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t

@blockspacer
Copy link
Author

# remove docker images which created X days ago 
docker image prune -a --filter "until=$(date +'%Y-%m-%dT%H:%M:%S' --date='-365 days')"

# OR
# delete images older than 6 months ago; 4320h = 24 hour/day * 30 days/month * 6 months
# docker image prune --all --filter "until=4320h" 

# will delete ALL dangling data (i.e. In order: containers stopped, volumes without containers and images with no containers). Even unused data, with -a option.
docker system prune

@blockspacer
Copy link
Author

for pm-suspend

sudo apt install pm-utils

@blockspacer
Copy link
Author

blockspacer commented Feb 18, 2021

https://redos.red-soft.ru/base/arm/arm-other/ssd/
Перенос /tmp в оперативную память — отличная идея продления срока жизни диска. Добавьте строку в файл /etc/fstab. Если объем операвтиной памяти больше 4ГБ, с помощью параметра size=установите размер раздела равный половине доступной памяти.

sudo nano /etc/fstab

Пример для машины с 8ГБ оперативной памяти:
tmpfs /tmp tmpfs nodev,nosuid,size=4G 0 0
sudo mount -a

@blockspacer
Copy link
Author

Speed Up That Build, now! - Part 1: Ramdisk and Filesystem
https://www.marcobehler.com/2014/05/19/speed-up-that-build-now-part-1-ramdisk-and-filesystem-2

sudo nano /etc/fstab
tmpfs /build tmpfs noatime,nodev,nosuid,size=4G 0 0
sudo mount -a

@blockspacer
Copy link
Author

will cause the mouse to work every time you open nano

echo "set mouse" >> ~/.nanorc

@blockspacer
Copy link
Author

To enable mouse in Vim, add this to your ~/.vimrc

echo "set mouse=a" >> ~/.vimrc
echo "set ttymouse=xterm2" >> ~/.vimrc

@blockspacer
Copy link
Author

blockspacer commented Feb 20, 2021

To enable mouse in emacs

echo "xterm-mouse-mode t" >> ~/.emacs

@blockspacer
Copy link
Author

blockspacer commented Feb 20, 2021

sudo apt install screen
echo "mousetrack on" >> ~/.screenrc
echo "defmousetrack on" >> ~/.screenrc

sudo apt install tmux
echo "set -g mouse on" >> ~/.tmux.conf
wget https://gist.githubusercontent.com/brucechou1983/04a37fdb8f6e8f70c56eeb951b268cff/raw/cae154430f3ea62e3c4b3255d07457336c706dcc/tmux.conf --no-check-certificate -O ~/.tmux.conf
echo "set -g @plugin 'tmux-plugins/tmux-sensible'" >> ~/.tmux.conf
echo "set -g @plugin 'tmux-plugins/tpm'" >> ~/.tmux.conf
echo "set -g @plugin 'tmux-plugins/tmux-resurrect'" >> /.tmux.conf
echo "run -b '
/.tmux/plugins/tpm/tpm'" >> ~/.tmux.conf
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
tmux source ~/.tmux.conf
~/.tmux/plugins/tpm/bin/install_plugins
tmux
tmux split-window -h
tmux split-window -v

To save the Tmux environment, we hit Ctrl + b + Ctrl + s in the Tmux Terminal.

To restore the Tmux environment, we hit Ctrl + b + Ctrl + r

tmux kill-server

@blockspacer
Copy link
Author

blockspacer commented Feb 20, 2021

tmux cheat sheet
tmux
c - create new session or tmux new -s geek-1
v - split vert.
v - split hor.
w - select session

@blockspacer
Copy link
Author

blockspacer commented Feb 20, 2021

Rapidly invoke an editor to write a long, complex, or tricky command

Or use Ctrl-x, e # Edit previous command in Editor

export EDITOR='nano -m'
fc

Or
export EDITOR="code --proxy-server=localhost:8088 --ignore-certificate-errors --wait --new-window"

@blockspacer
Copy link
Author

blockspacer commented Feb 20, 2021

echo "export EDITOR=\"code --proxy-server=localhost:8088 --ignore-certificate-errors --wait --new-window\"" >> ~/.bashrc
echo "export VISUAL=\"code --proxy-server=localhost:8088 --ignore-certificate-errors --wait --new-window\"" >> ~/.bashrc
source ~/.bashrc

@blockspacer
Copy link
Author

https://unix.stackexchange.com/a/90529

cat >> ~/.zshrc << EOF
export VISUAL=vim
autoload edit-command-line; zle -N edit-command-line
bindkey -M vicmd v edit-command-line
EOF

@blockspacer
Copy link
Author

blockspacer commented Feb 28, 2021

Выявляем процессы с дисковой активностью в Linux
https://habr.com/ru/post/476414/

@blockspacer
Copy link
Author

blockspacer commented Mar 3, 2021

(опционально) Установка git из кода при ошибках "GnuTLS recv error (-110): The TLS connection was non-properly terminated."
Раскомментируем строки с deb-src для получения исходников git:
sudo sed -i -- 's/#deb-src/deb-src/g' /etc/apt/sources.list    
sudo sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list
sudo apt update
sudo apt build-dep git -y
cd ~
mkdir source-git
cd source-git/
sudo apt source git 
cd git-*.*.*/
Соберем git с libcurl4-openssl-dev вместо libcurl4-gnutls-dev:
sudo sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control
sudo sed -i -- '/TEST\s*=\s*test/d' ./debian/rules
sudo dpkg-buildpackage -rfakeroot -b -uc -us
sudo dpkg -i ../git_*ubuntu*.deb

@blockspacer
Copy link
Author

blockspacer commented May 13, 2021

# The command du "summarizes disk usage of each FILE, recursively for directories
# -h is to get the numbers "human readable"
# -s is for summary
# --max-depth parameter to limit how many items are displayed
# The -h flag on sort will consider "Human Readable" size values.
# target_dir - Optional parameter with default value 
# USAGE
# duh 
# duh /tmp
# duh /tmp 2
function duh() {
    target_dir=${1:-$PWD} 
    target_depth=${2:-1} 
    (du -h --max-depth=$target_depth $target_dir | sort -h)
}

@blockspacer
Copy link
Author

https://stackoverflow.com/a/38486048

sudo nano /etc/sysctl.conf

fs.inotify.max_user_instances = 256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment