vim/vi卡死原因

使用vim时,如果你不小心按了Ctrl + s后,你会发现不能输入任何东西了,像死掉了一般,其实vim并没有死掉,这时vim只是停止向终端输出而已,要想退出这种状态,只需按Ctrl + q即可恢复正常。……

阅读全文

shell 判断文件夹或文件是否存在

文件夹不存在则创建 if [ ! -d "/data/" ];then mkdir /data else echo "文件夹已经存在" fi 文件存在则删除 if [ ! -f "/data/filename" ];then echo "文件不存在" else rm -rf /data/filename fi 判断文件夹是否存在 if [ -d "/data/" ];then echo "文件夹存在" else echo "文件夹不存在" fi 判断文件是否存在 if [ -d "/data/test" ];then echo "文……

阅读全文

golang 环境变量设置

cnbattle@coding:~$ vim .profile export GOROOT=/usr/local/go export GOBIN=$GOROOT/bin export GOPATH=$HOME/go-path export GOPATHBIN=$GOPATH/bin export PATH=$PATH:$GOBIN:$GOPATHBIN……

阅读全文

Linux下 ln 命令详解

这是linux中一个非常重要命令,请大家一定要熟悉。它的功能是为某一个文件或目录在另外一个位置建立一个同步的链接,类似Windows下的超级链接。 这个命令最常用的参数是-s,具体用法是: sudo ln -s 源文件 目标文件 举例: 当前目录是/local,而我经常要访问/usr/local/linu……

阅读全文

php7高效生成二维码:composer和荷兰PHP开发者的QrCode

QR Code By endroid This library helps you generate QR codes in a jiffy. Makes use of bacon/bacon-qr-code to generate the matrix and khanamiryan/qrcode-detector-decoder for validating generated QR codes. Further extended with Twig extensions, generation routes, a factory and a Symfony bundle for easy installation and configuration. Installation Use Composer to install the library. $ composer require endroid/qr-code Basic usage use Endroid\QrCode\QrCode; $qrCode = new QrCode('Life is too short to be generating QR codes'); header('Content-Type: '.$qrCode->getContentType()); echo $qrCode->writeString(); Advanced usage use Endroid\QrCode\ErrorCorrectionLevel; use Endroid\QrCode\LabelAlignment; use Endroid\QrCode\QrCode; use Endroid\QrCode\Response\QrCodeResponse; // Create a basic QR code $qrCode = new QrCode('Life is too short to be generating QR codes'); $qrCode->setSize(300); // Set advanced options $qrCode->setWriterByName('png'); $qrCode->setMargin(10); $qrCode->setEncoding('UTF-8'); $qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH); $qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]); $qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]); $qrCode->setLabel('Scan……

阅读全文

FreeBSD pkg 更换为国内ustc源

创建用户级 pkg 源目录 /usr/local/etc/pkg/repos 新建源文件 /usr/local/etc/pkg/repos/1.ustc.conf 在 1.ustc.conf 中添加以下内容: ustc: { url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/latest", mirror_type: "srv", signature_type: "none", fingerprints: "/usr/share/keys/pkg", enabled: yes } 禁用系统级 pkg 源(推荐) mv /etc/pkg/FreeBSD.conf /etc/pkg/FreeBSD.conf.back 然后运行 pkg update -f 更新索引以生效。……

阅读全文

Ubuntu 18.04 apt-get更换为国内阿里云源

1、进入root模式 su root 2、备份sources.list cp /etc/apt/sources.list /etc/apt/sources.list_backup 3、更改源为国内阿里云源 vi /etc/apt/sources.list # Aliyun deb-src http://archive.ubuntu.com/ubuntu bionic main restricted #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ bionic universe deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse #Added by software-properties deb http://archive.canonical.com/ubuntu bionic partner deb-src http://archive.canonical.com/ubuntu bionic partner deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted multiverse universe #Added by……

阅读全文

golang字符串去除空格和换行符

package main import ( "fmt" "strings" ) func main() { str := "welcome to cn\nbattle\n.com" // 去除空格 str = strings.Replace(str, " ", "", -1) // 去除换行符 str = strings.Replace(str, "\n", "", -1) fmt.Println(str) }……

阅读全文

vagrant 本地添加box 支持带版本号

一般处理方案 vagrant box add boxName ./downloadBoxName.box boxName 添加之后的box 名称 ./downloadBoxName.box 下载到本地的box 正常这样基本上就可以将box添加上去了。不过,这样添加的box版本号是0,大部分场景版本号影响也不大。但我在使用Laravel Homestead的时候,这边会有版本等一些限制。所以,我们如果能加上版本号是不是会更好一……

阅读全文

最近文章

分类

标签

友情链接

其它