Vim Paste Turning Off Autoindent

https://stackoverflow.com/questions/2514445/turning-off-auto-indent-when-pasting-text-into-vim

To turn off autoindent when you paste code, there’s a special “paste” mode.

Type

:set paste

Then paste your code. Note that the text in the tooltip now says -- INSERT (paste) --.

After you pasted your code, turn off the paste-mode, so that auto-indenting when you type works correctly again.

:set nopaste

However, I always found that cumbersome. That’s why I map <F3> such that it can switch between paste and nopaste modes while editing the text! I add this to .vimrc

set pastetoggle=<F3> [Read More]

(Solved)Windows Ubuntu Subsystem mv folder disappeared but works with file

Problem

I am using Windows Ubuntu Subsystem 18.04. The command I run is

mv venv ../d/

and the folder can neither be found in current directory nor in d. This command is double checked from .bash_history. And, venv is a folder, d is a link to /mnt/d/ubuntu1804/ of my drive D in windows.

Also, I run command

mv a.txt ../d/ [Read More]

ubuntu ftp server

Reference link:

http://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/

FTP is used to transfer files from one host to another over TCP network. This article explains how to setup FTP server on ubuntu 14.04 .There are 3 popular FTP server packages available PureFTPD, VsFTPD and ProFTPD. Here i’ve used VsFTPD which is lightweight and less Vulnerability.

Setup FTP server on Ubuntu 14.04

Step 1 » Update repositories .
krizna@leela:~$ sudo apt-get update
Step 2 » Install VsFTPD package using the below command.
krizna@leela:~$ sudo apt-get install vsftpd
Step 3 » After installation open /etc/vsftpd.conf file and make changes as follows.
Uncomment the below lines (line no:29 and 33).
write_enable=YES
local_umask=022
» Uncomment the below line (line no: 120 ) to prevent access to the other folders outside the Home directory.
chroot_local_user=YESand add the following line at the end.
allow_writeable_chroot=YES» Add the following lines to enable passive mode.
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100

Step 4 » Restart vsftpd service using the below command.
krizna@leela:~$ sudo service vsftpd restart
Step 5 » Now ftp server will listen on port 21. Create user with the below command.Use /usr/sbin/nologin shell to prevent access to the bash shell for the ftp users .
krizna@leela:~$ sudo useradd -m john -s /usr/sbin/nologin
krizna@leela:~$ sudo passwd john

Step 6 » Allow login access for nologin shell . Open /etc/shells and add the following line at the end.
/usr/sbin/nologin
Now try to connect this ftp server with the username on port 21 using winscp orfilezilla client and make sure that user cannot access the other folders outside the home directory.
setup FTP server ubuntu 14.04
Please note using ftp on port 21 is a big security risk . it’s highly recommended to use SFTP. Please continue for SFTP configuration [Read More]

CentOS定时将路由器的外网IP发送到指定电子邮箱中

出于节约成本费用考虑,平时家用和小型商用的宽带都是ADSL虚拟拔号的。ADSL宽带的下载速度在4M左右时与光纤的差别不是很大,但唯一的问题就是没有固定IP,每次重新拔号都会重新获得动态的IP。这种情况下想进行远程维护服务器和网络就变得十分困难。在局域网内有Linux主机的情况下,我们可以考虑用如下的方法。

一、获得当前路由器的外网IP

curl ifconfig.me

就会获得一个路由器的IP地址。接下来,将这个IP地址通过Email发到指定的邮箱就。用 vim GetIP.sh 写一个角本,执行后,就会将外网IP发送到指定的电子邮箱中,脚本如下

#!/bin/bash
# Program:
# Send Router IP of Internet to certain email# History:
# 2014-03-08 cmzsteven First releasePATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin/:~/binexport PATHcurl ifconfig.me | mail -s "Router IP of Internet" changmingzhi@163.com [Read More]