欢迎各位兄弟 发布技术文章
这里的技术是共享的
docker运行的镜像无法上网解决办法
无法上网一般是iptables的问题,是启动docker后iptables -F 的结果.
解决方法,shutdown -r now 即可解决/
python:
意外的逗号
>>> def f(x, y,):
... print(x, y)
...
>>> def g(x=4, y=5,):
>>> def h(x, **kwargs,):
File "<stdin>", line 1
def h(x, **kwargs,):
^
SyntaxError: invalid syntax
>>> def h(*args,):
def h(*args,):
使用rsync同步远程服务器上的文件时限制流量
/usr/bin/rsync -avrtH --bwlimit=2048 rsync://rsync.mirrors.ustc.edu.cn/centos/
/data/soft_repos/CentOS/
# --bwlimit=2048 限制同步时的流量 为20Mbps
not key
x = True
y = False
Output:
>>> not x == y
True
>>> x == not y
File "<input>", line 1
x == not y
双击查看原图 说明:
运算符的优先级会影响表达式的求值顺序, 而在 Python 中 == 运算符的优先级要高于 not 运算符.
我们都知道man可以查看命令的帮助手册,但是如果我们想要某个功能却不知道使用哪个命令呢?
可以用man -k command 搜索要执行的命令:
[root@manager ~]# man -k rsync
rsync (1) - a fast, versatile, remote (and local) file-copying tool
rsyncd.conf (5) - configuration file for rsync in daemon mode
wcursyncup (3x) - create curses windows
./redis-cli -h 10.10.10.11 -p 6401
save # 保存当前快照
config get * # 列出所有当前配置
config get maxmemory # 查看指定配置
config set maxmemory 15360000000 # 动态修改最大内存配置参数
更多历史小技巧,技术交流,岗位内推访问【马哥社区 club.magedu.com】
crontab -e # 编辑周期任务
分钟 小时 天 月 星期 命令或脚本
1,30 1-3/2 * * * 命令或脚本 >> file.log 2>&1
echo “40 7 * * 2 /root/sh”>>/var/spool/cron/root # 直接将命令写入周期任务
crontab -l # 查看自动周期性任务
crontab -r # 删除自动周期性任务
cron.deny和cron.allow # 禁止或允许用户使用周期任务
service crond start|stop|restart # 启动自动周期性服务
自定义命令
假如你想创建完文件夹后自动进入该文件夹下面,那么可以自定义一个mkcd命令:
shell> vi ~/.bash_profile
mkcd() {
mkdir -p $1 && cd $1
}
安装以下脚本时,请注意服务器内是否有安装云锁,安装前请先卸载(教程)
ngx_http_addition_module在响应之前或者之后追加文本内容,比如想在站点底部追加一个js或者css,可以使用这个模块来实现,这个模块和淘宝开发的nginx footer模块有点类似,但是还是有不同.
今天,突然研发的同事说需要在公司网站页面底部添加一个流量统计的scripts,但是不打算改代码,所以希望能在代理的层面解决。这里只讨论如果是在nginx来实现,技术如何操作。但是具体是研发改代码,还是写在nginx,这个视情况而定。 这里可以使用 nginx 的 ngx_http_sub_module 模块完成。我这里是使用tengine,所以这个模块已经有了。如果没有的话,自己编译添加以下:方法如下:
nginx -V
(PHP 4, PHP 5, PHP 7)
原来 nginx版本是 nginx-1.0.12 太低版本 ,出现问题,,现在西部数码帮我升级成了 nginx-1.2.9 没有问题了
<?php/*** Implementation of hook_menu().*/
您好,wap.wzfzxx.com 测试加载正常,服务器带宽占用并不高
if (window.DeviceMotionEvent) { var liaotian = 0; var speed = 22; //摇一摇程序,建议值在20-25之间; var x = y = z = lastX = lastY = lastZ = 0; //默认值 window.addEventListener('devicemotion', function() { var acceleration = event.accelerationIncludingGravity; x = acceleration.x; y = acceleration.y; if (Math.abs(x - lastX) > speed || Math.abs(y - lastY) > speed) { //window.location.href = 'http://pkt.zoosnet.net/LR/Chatpre.aspx?id=PKT40658297&lng=cn' //摇动之后的行为,链接可以是报名、咨询、电话支持tel: