Заметки по настройке Linux Debian

Discussion in 'Linux, Freebsd, *nix' started by randomword0x3f52, 14 Jun 2018.

  1. randomword0x3f52

    Joined:
    15 Oct 2016
    Messages:
    30
    Likes Received:
    25
    Reputations:
    9
    Как сделать в vim сохранение на Ctrl-S ведь пальцы сами жмут данную комбу.

    В начале следует отключить управлющий символ stop повешенный на Ctrl-S, а заодно и start на Ctrl-Q
    В конец /etc/bash.bashrc добавляем
    Code:
    /bin/stty start ^- ; /bin/stty stop ^-
    
    А в /etc/vim/vimrc добавим
    Code:
    imap <C-s> <Esc>:w<CR>a
    nmap <C-s> <Esc>:w<CR>
    
    Жаль только что курсор при переходе из режима в режим не стоит на месте.
     
    Turanchocks_ likes this.
  2. DmitryU

    DmitryU Member

    Joined:
    20 Jan 2012
    Messages:
    68
    Likes Received:
    58
    Reputations:
    1
    Отвыкай. Зачем пользоваться vim если не можешь :w набрать? не мучай себя
     
    b3 likes this.
  3. randomword0x3f52

    Joined:
    15 Oct 2016
    Messages:
    30
    Likes Received:
    25
    Reputations:
    9
    Как уменьшить табы в xfce4-terminal
    ~/.config/gtk-3.0/gtk.css
    Code:
    notebook tab {
      min-height: 0;
      padding-top: 0px;
      padding-bottom: 0px;
    }
    Как изменить клавиши копировать вставить в xfce4-terminal
    ~/.config/xfce4/terminal/accels.scm
    Code:
    (gtk_accel_path "<Actions>/terminal-window/paste" "<Shift>Insert")
    (gtk_accel_path "<Actions>/terminal-window/copy" "<Primary>Insert")
     
  4. randomword0x3f52

    Joined:
    15 Oct 2016
    Messages:
    30
    Likes Received:
    25
    Reputations:
    9
    Как изолировать сеть для mysql и apache2
    Code:
    #!/bin/bash
    
    if (test -z "$1") then
    	exit
    fi
    
    if (test $1 = 'start') then
    	ip netns add isolator
    	echo [$?] ip netns add isolator
    
    	ip link add name ve0a type veth peer name ve0b
    	echo [$?] ip link add name ve0a type veth peer name ve0b
    
    	ip link set dev ve0b netns isolator
    	echo [$?] ip link set dev ve0b netns isolator
    
    	ip netns exec isolator ifconfig lo up 127.0.0.1/8
    	echo [$?] ip netns exec isolator ifconfig lo up 127.0.0.1/8
    
    	ip netns exec isolator ifconfig ve0b up 192.168.0.2/24
    	echo [$?] ip netns exec isolator ifconfig ve0b up 192.168.0.2/24
    
    	ifconfig ve0a up 192.168.0.1/24
    	echo [$?] ifconfig ve0a up 192.168.0.1/24
    
    	. /etc/apache2/envvars
    	echo [$?] . /etc/apache2/envvars
    
    	export APACHE_STARTED_BY_SYSTEMD=false
    
    	ip netns exec isolator /usr/sbin/apachectl start
    	echo [$?] ip netns exec isolator /usr/sbin/apachectl start
    
    	echo ip netns exec isolator mysqld --user=mysql --pid-file=/var/run/mysqld/mysql.pid	
    	ip netns exec isolator mysqld --user=mysql --pid-file=/var/run/mysqld/mysql.pid &
    
    	exit
    fi
    
    if (test $1 = 'stop') then
    	ip netns exec isolator /usr/sbin/apachectl stop
    	echo [$?] ip netns exec isolator /usr/sbin/apachectl stop
    
    	echo kill -SIGTERM `cat /var/run/mysqld/mysql.pid`
    	kill -SIGTERM `cat /var/run/mysqld/mysql.pid`
    
    	ip netns exec isolator ifconfig ve0b down
    	echo [$?] ip netns exec isolator ifconfig ve0b down
    
    	ifconfig ve0a down
    	echo [$?] ifconfig ve0a down
    
    	ip link delete ve0a
    	echo [$?] ip link delete ve0a
    
    	ip netns delete isolator
    	echo [$?] ip netns delete isolator
    
    	exit	
    fi
    
     
  5. b3

    b3 Banned

    Joined:
    5 Dec 2004
    Messages:
    2,174
    Likes Received:
    1,157
    Reputations:
    202
    в копилку к .vimrc
    Code:
    syntax on
    
    set encoding=utf-8
    set termencoding=utf-8
    set fileencoding=utf-8
    set fileencodings=utf8,koi8r,cp1251,cp866,ucs-2le
    
    
    set wildmenu
    set wcm=<Tab>
    menu Encoding.koi8-r  :e ++enc=koi8-r<CR>
    menu Encoding.cp1251  :e ++enc=cp1251<CR>
    menu Encoding.cp866   :e ++enc=cp866<CR>
    menu Encoding.ucs-2le :e ++enc=ucs-2le<CR>
    menu Encoding.utf-8   :e ++enc=utf-8<CR>
    map <F12> :emenu Encoding.<Tab>
     
  6. randomword0x3f52

    Joined:
    15 Oct 2016
    Messages:
    30
    Likes Received:
    25
    Reputations:
    9
    Вешается на хоткей для очистки clipboard.
    Code:
    xsel -c -b
    
    Синхронизация времени
    Code:
    ntpdate -v -s us.pool.ntp.org
    
     
    #6 randomword0x3f52, 30 Jul 2018
    Last edited by a moderator: 7 Dec 2018