This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo partimage save -bcdz1 /dev/sda5 /media/lubuntu/DOC/CloneDsk/Ghost/lubuntu.ke34.partimg.gz | |
sudo partimage restore -b /dev/sda5 /media/lubuntu/DOC/CloneDsk/Ghost/lubuntu.ke34.partimg.gz | |
sudo dd if=/dev/zero of=/media/lubuntu/lubuntu/zero_file bs=16M count={2M less than that in "df -m"} | |
sudo rm /media/lubuntu/lubuntu/zero_file | |
sudo dd if=/dev/sda5 conv=sync,noerror bs=16M | gzip -c > /media/lubuntu/DOC/CloneDsk/Ghost/lubuntu.ke34.dd.gz | |
gunzip -c /media/lubuntu/DOC/CloneDsk/Ghost/lubuntu.ke34.dd.gz | sudo dd of=/dev/sda5 conv=sync,noerror bs=16M | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yii model rules类型: | |
无:不赋值(即setAttributes不复制), | |
仅safe表:可为空,不限规则,必须赋值, | |
仅required表:不可为空,不限规则,必须赋值, | |
无allowEmpty(默认true)+rule表:可为空,不空时必符合规则,必须赋值, | |
'allowEmpty'=>false+rule表:不可为空,必符合规则,必须赋值. | |
重载每个model的setAttributes, | |
先对top document用EMongoDocument->setAttributes()来验证元素, 并CModel->getErrors, | |
再对sub document用CModel->setAttributes()来验证元素, 并CModel->getErrors, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
$i = 0; | |
chdir(dirname(__FILE__)); | |
$app=function ($request, $response) use (&$i, &$loop) | |
{if ($request->getPath()=='/favicon.ico') | |
{$response->writeHead(200, array('Content-Type' => 'image/x-icon')); | |
$response->end(''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#boot from usb live | |
#edit /media/lubuntu/system/etc/fstab | |
UUID=xxxxxxx /data ext4 default 0 2 | |
/data/var /var none bind 0 0 | |
/data/home /home none bind 0 0 | |
/data/tmp /tmp none bind 0 0 | |
#then execute: | |
sudo cp -ax /media/lubuntu/system/var/* /media/lubuntu/data/var/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('error_reporting', E_ALL); | |
ini_set('display_errors', 'On'); | |
define('THIS_PAGE', 'http://127.0.0.1/test.php'); | |
define('CONSUMER_KEY', 'yT577ApRtZw51q4NPMPPOQ'); //official TweetDeck consumer key | |
define('CONSUMER_SECRET', '3neq3XqN5fO3obqwZoajavGFCUrC42ZfbrLXy5sCv8'); //offical TweetDeck consumer secret | |
define('NGINX_PROXY_TWITTER', 'http://proxy_twitter_api.domain.com'); //if there is proxy, set it 'https://api.twitter.com' | |
session_start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
对于ios safari和android chrome仅需width, 而target-densitydpi被忽略: | |
<meta name="viewport" content="width=380, user-scalable=no"/> #不要加initial-scale因默认不是1.0 | |
<div style="background:yellow;width:380px;height:1000px;">jack3</div> | |
对于android browser需要width和target-densitydpi(注意一个tab设了一次target-densitydpi后即时刷新页面新dpi值也更改不了第一次设的值): | |
<meta name="viewport" content="width=380, user-scalable=no"/> | |
<div style="background:yellow;width:380px;height:1000px;">jack3</div> | |
<script> | |
design_width=380; | |
deviceDpi=160*window.devicePixelRatio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
===========================test.php=========================== | |
<?php | |
$input=array('pass_url'=>'http://www.sqjg.net/Jgcx/', | |
'pass_method'=>'GET', | |
'pass_headers'=>array(), | |
'pass_post'=>'', | |
'pass_inject_js'=>array('jquery-1.11.1.min.mod_for_phantom.js'), | |
'pass_tasks'=>array(0=>array('flag'=>"var rtn=document.getElementById('dyl_708'); | |
return rtn; | |
", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一.积累大量TIME_WAIT连接无法接受新请求: | |
比较安全的设置是/etc/sysctl.conf: | |
net.ipv4.tcp_timestamps=1 | |
net.ipv4.tcp_tw_recycle=0 | |
net.ipv4.tcp_tw_reuse=1 | |
net.ipv4.tcp_max_tw_buckets=10000 #改之后一般本地打开端口数从26000降到6000左右(netstat -tuwanp | awk '{print $4}' | sort | uniq -c | wc -l) | |
执行"sysctl -p"生效 | |
参考: http://nick.txtcc.com/index.php/linux/1162 | |
二.启动iptables一两个小时后出现大量丢包: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/tesseract-ocr/tesseract/wiki/TrainingTesseract | |
http://sunfuze.github.io/2014/07/20/Ubuntu-14.04-%E4%BD%BF%E7%94%A8Tesseract-ocr%E8%AE%AD%E7%BB%83%E6%A0%B7%E6%9C%AC/ | |
http://manpages.ubuntu.com/manpages/trusty/man1/tesseract.1.html | |
ubuntu 14.04直接: | |
sudo apt-get install tesseract-ocr | |
先装这4个, leptonica依赖到(到最后用tesseract -v可以看到三层依赖关系): | |
sudo yum -y install libjpeg-devel libpng-devel libtiff-devel zlib-devel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> | |
<meta> | |
<author>brainwallet</author> | |
<description>POST method for YQL</description> | |
<sampleQuery><![CDATA[ | |
select * from {table} where url='http://example.com' | |
and postdata="foo=foo&bar=bar" and xpath="//p"]]></sampleQuery> | |
<documentationURL></documentationURL> | |
</meta> |
OlderNewer