CentOS 7 一些记录

最小安装完成后无法联网,需要手动开启网络访问

cd /etc/sysconfig/network-scripts/

找到网卡 例如 ifcfg-eno33

vi ifcfg-eno33

将最后一行的 ONBOOT=no 改为 ONBOOT=yes 然后退出 vi

退出重启 network

service network restart

Ubuntu 一些记录

apt 更换阿里源

备份系统自带源

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

修改 /etc/apt/sources.list文件

sudo vim /etc/apt/sources.list  

加入下列内容

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

Memcached Windows 开机启动 指定端口号

安装 memcached 服务,打开 cmd 管理员模式,非管理员无法添加到服务

memcached.exe -d install

打开服务 win+r 输入 services.msc 就可以找到 memcached 服务项了

通过注册表修改端口号 win+r 输入 regedit

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server
其中的ImagePath项的值为:
"c:\memcached\memcached.exe" -d runservice
修改成:
"c:\memcached\memcached.exe" -p 11811 -d runservice

jQuery 监听元素出现

$.fn.wait = function (func, times, interval) {
    var _times = times || -1, //100次
        _interval = interval || 20, //20毫秒每次
        _self = this,
        _selector = this.selector, //选择器
        _iIntervalID; //定时器id
    if( this.length ){ //如果已经获取到了,就直接执行函数
        func && func.call(this);
    } else {
        _iIntervalID = setInterval(function() {
            if(!_times) { //是0就退出
                clearInterval(_iIntervalID);
            }
            _times <= 0 || _times--; //如果是正数就 --

            _self = $(_selector); //再次选择
            if( _self.length ) { //判断是否取到
                func && func.call(_self);
                clearInterval(_iIntervalID);
            }
        }, _interval);
    }
    return this;
};