Submitted by gouki on 2018, August 9, 11:17 PM
当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临时保存到Swap空间中,等到那些程序要运行时,再从Swap中恢复保存的数据到内存中。这样,系统总是在物理内存不够时,才进行Swap交换。这个是SWAP 交换分区的作用。 实际上,我们更关注的应该是SWAP分区的大小问题。 设置多大才是最优的。
一般来说可以按照如下规则设置swap大小:
- 4G以内的物理内存,SWAP 设置为内存的2倍。
- 4-8G的物理内存,SWAP 等于内存大小。
- 8-64G 的物理内存,SWAP 设置为8G。
- 64-256G物理内存,SWAP 设置为16G。
实际上,系统中交换分区的大小并不取决于物理内存的量,而是取决于系统中内存的负荷,所以在安装系统时要根据具体的业务来设置SWAP的值。
实际上在启动腾讯云的时候,swap是禁用的(没注意是系统原因还是其他)。所以就需要打开Swap,DO的网站上就有现成的教程:https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04,可以参考 一下
我这里不转贴。不过原文里有几个命令可能运行不了,比如使用:dd if=/dev/zero of=/swapfile bs=1G count=4,1G一个块可能不行,换成256的话,就OK了。原文中的:fallocate,debian可能无法执行。
然后一步步的执行到底就OK了。当然,要将分区信息加到fstab中,才会每次启动都会带上。
Linux | 评论:0
| 阅读:9420
Submitted by gouki on 2018, August 9, 1:43 PM
原来的dobdeb对于jessie等都不再支持7.2了,所以新的7.2只能从sury上进行获取
执行:
XML/HTML代码
- #!/bin/bash
- # To add this repository please do:
-
- if [ "$(whoami)" != "root" ]; then
- SUDO=sudo
- fi
-
- ${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates
- ${SUDO} wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
- ${SUDO} sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
- ${SUDO} apt-get update
记不住没关系,打开网址:https://packages.sury.org/php/,就有Readme了。复制粘贴运行一下就行!
Linux | 评论:0
| 阅读:11338
Submitted by gouki on 2018, July 27, 10:53 PM
linux上面,如果替换文件中的内容,其实还是比较方便的。比如:sed -i 's/xxx/yyy/g' xxx.txt
然而同样的命令,如果放到mac下面,就会报:sed: 1: "xxx.txt": invalid command code o
到stackoverflow.com就会发现已经有人回复了:https://stackoverflow.com/questions/19456518/invalid-command-code-despite-escaping-periods-using-sed
XML/HTML代码
- If you are on a OS X, this probably has nothing to do with the sed command. On the OSX version of sed, the -i option expects an extension argument so your command is actually parsed as the extension argument and the file path is interpreted as the command code.
-
- Try adding the -e argument explicitly and giving '' as argument to -i:
-
- find ./ -type f -exec sed -i '' -e "s/192.168.20.1/new.domain.com/" {} \;
- See this.
所以上面的代码就改为:sed -i '' -e 's/xxx/yyy/g' xxx.txt ,搞定
参考:
1、https://stackoverflow.com/questions/19456518/invalid-command-code-despite-escaping-periods-using-sed
2、https://stackoverflow.com/questions/7573368/in-place-edits-with-sed-on-os-x
Tags: sed
苹果相关 | 评论:0
| 阅读:10875
Submitted by gouki on 2018, July 23, 10:18 PM
以下是内容:
XML/HTML代码
- 首次访问时post的数据
- 获取ticket访问时get的数据($encryptMsg)
- {"signature":"bb539c3ecaddf06040912a836cdeb2060f649b1a","timestamp":"1491385757","nonce":"776481090","encrypt_type":"aes","msg_signature":"472008a1054eab89651ae9c484395e4e54abb01e","action":"get_ticket"}
- 消息接入时get的数据($param)
- {"action":"news","amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;b":"/wx570bc396a51b8ff8","signature":"550a39d2ffa8dbe0b0f8f6cfadd8a9b8981b3752","timestamp":"1491385766","nonce":"947166308","openid":"ozy4qt5QUADNXORxCVipKMV9dss0","encrypt_type":"aes","msg_signature":"d67c434cb7e54a0b51b2cdceba38650ea62a35a2"}
- 消息接入时get的数据($param)
- {"action":"news","amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;b":"/wx570bc396a51b8ff8","signature":"595e8376b3587a8d68c68132417931b6fd0b8f9d","timestamp":"1491385775","nonce":"898963343","openid":"ozy4qt5QUADNXORxCVipKMV9dss0","encrypt_type":"aes","msg_signature":"1d6291da6617638c95d4be800d8394547a8d4137"}
- 消息接入时get的数据($param)
- {"action":"news","amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;b":"/wx570bc396a51b8ff8","signature":"72e0b354fd7b6643335d1035471617441e57e945","timestamp":"1491385783","nonce":"1115275135","openid":"ozy4qt5QUADNXORxCVipKMV9dss0","encrypt_type":"aes","msg_signature":"3d16bee6896984fbf2ba333ef2be389739ddd30a"}
- 获取ticket访问时get的数据($encryptMsg)
- {"signature":"fa4b87ee9574913ac68bd1044c35a48a1bb41a40","timestamp":"1491385789","nonce":"429149520","encrypt_type":"aes","msg_signature" :"9626625a665c03f128462ace8a5dff0cf2c5d0f8","action":"get_ticket"}
- 通过$encryptMsg与$param获取 component_verify_ticket
- ticket@@@bYIJwVAxqf75BhEVRNhaaf1KTit5zxiqbZ5KR7xJumzniEEy6DTIWHeic1-L_z7LuhPwwSNLm_V_8hkyRYX-PQ
- 通过$encryptMsg与$param验证微信接入测试请求($data)
- {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385765","MsgType":"text","Content":"QUERY_AUTH_CODE:queryauthcode@@@mFZ_yC83hgDZhf-s6pL6UGloyMYzH8MTCEQddsa8U5ceEze4zflgNNk4sU1kkGUkZn37-Su4t9C5gaR09gjkKQ","MsgId":"6405453086801493549"} {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385774","MsgType":"text","Content":"TESTCOMPONENT_MSG_TYPE_TEXT","MsgId":"6405453125456199215"} {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385783","MsgType":"event","Event":"LOCATION","Latitude":"111.000000","Longitude":"222.000000","Precision":"333.000000"}
- 微信接入测试回复 $data
- {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385765","MsgType":"text","Content":"QUERY_AUTH_CODE:queryauthcode@@@mFZ_yC83hgDZhf-s6pL6UGloyMYzH8MTCEQddsa8U5ceEze4zflgNNk4sU1kkGUkZn37-Su4t9C5gaR09gjkKQ","MsgId":"6405453086801493549"} {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385774","MsgType":"text","Content":"TESTCOMPONENT_MSG_TYPE_TEXT","MsgId":"6405453125456199215"} {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385783","MsgType":"event","Event":"LOCATION","Latitude":"111.000000","Longitude":"222.000000","Precision":"333.000000"}
- 1、通过$data获取$query_auth_code
- queryauthcode@@@mFZ_yC83hgDZhf-s6pL6UGloyMYzH8MTCEQddsa8U5ceEze4zflgNNk4sU1kkGUkZn37-Su4t9C5gaR09gjkKQ
-
- 2、通过$data获取$access_token
- dZiS58MkUvLOkSBvX2SDu6-P6hGqN5GJj8T8jOlhszo80KuwMgytZb2GIoNlsUMeSpM_WLBMc65KDG80h2-zjh-8PWdE2br8Pchdk6MFJjg13vCjhDVyPyZ3_1XbTmg2GSWgADDLXB
-
- 微信接入测试回应 回应数据
- 1、{"ToUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","FromUserName":"gh_3c884a361561","CreateTime":1491385775,"MsgType":"text","Content":"TESTCOMPONENT_MSG_TYPE_TEXT_callback","FuncFlag":0}
- 2、{"ToUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","FromUserName":"gh_3c884a361561","CreateTime":1491385783,"MsgType":"text","Content":"LOCATIONfrom_callback","FuncFlag":0}
-
- 解密回应数据
- 1、\n\n\n1491385775\n\n
- 2、\n\n\n1491385783\n\n
-
- 微信接入测试请求
- {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385765","MsgType":"text","Content":"QUERY_AUTH_CODE:queryauthcode@@@mFZ_yC83hgDZhf-s6pL6UGloyMYzH8MTCEQddsa8U5ceEze4zflgNNk4sU1kkGUkZn37-Su4t9C5gaR09gjkKQ","MsgId":"6405453086801493549"}
- {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385774","MsgType":"text","Content":"TESTCOMPONENT_MSG_TYPE_TEXT","MsgId":"6405453125456199215"}
- {"ToUserName":"gh_3c884a361561","FromUserName":"ozy4qt5QUADNXORxCVipKMV9dss0","CreateTime":"1491385783","MsgType":"event","Event":"LOCATION","Latitude":"111.000000","Longitude":"222.000000","Precision":"333.000000"}
-
- 获取微信开放平台授权信息
- {"authorization_info":{"authorizer_appid":"wx570bc396a51b8ff8","authorizer_access_token":"dZiS58MkUvLOkSBvX2SDu6-P6hGqN5GJj8T8jOlhszo80KuwMgytZb2GIoNlsUMeSpM_WLBMc65KDG80h2-zjh-8PWdE2br8Pchdk6MFJjg13vCjhDVyPyZ3_1XbTmg2GSWgADDLXB","expires_in":7200,"authorizer_refresh_token":"refreshtoken@@@5lb5Jq2giPuJ0gjjyD9J_3y7VhyVgVt6kIuYlGkATFg","func_info":[{"funcscope_category":{"id":1}},{"funcscope_category":{"id":15}},{"funcscope_category":{"id":4}},{"funcscope_category":{"id":7}},{"funcscope_category":{"id":2}},{"funcscope_category":{"id":3}},{"funcscope_category":{"id":11}},{"funcscope_category":{"id":6}},{"funcscope_category":{"id":5}},{"funcscope_category":{"id":8}},{"funcscope_category":{"id":13}},{"funcscope_category":{"id":9}},{"funcscope_category":{"id":10}},{"funcscope_category":{"id":12}}]}}
-
- ComponentAccessToken
- ticket:PrJUyVJYEAlQ75bCbBLk4DkdHefqRM4r_ZV7ivJuahmG1Hap41QHJQ9MVsY4JOdlp21dR7gmUxuUa4eeTM8D1az4fhY8yYjBBGkC7KLyvSEGclB0vgza1xzk65m0GNAQVGMfABAFQW
COPY自:http://blog.lwp8800.com/news/detail.html?id=22
PHP | 评论:0
| 阅读:10946
Submitted by gouki on 2018, July 11, 11:48 PM
mac下面安装过docker,但后来删除过。然后系统又重做过。结果再次安装docker的时候报错,如题(详细 路径不贴了)
找了一下资料,各种各样的都有,最后还是选择了:
XML/HTML代码
- sudo rm -r /var/tmp/com.docker.vmnetd.socket
- sudo rm -r ~/Library/Application\ Scripts/com.docker.helper/
- sudo rm -r ~/Library/Containers/com.docker.*
- sudo rm -r ~/Library/Preferences/com.docker.docker.plist
- sudo rm -r ~/Library/Group\ Containers/group.com.docker/
然后再次运行Docker,一切都解决了
Tags: docker
苹果相关 | 评论:0
| 阅读:12320