昨天白天申请的TexturePacker免费授权,晚上就收到作者发来的序列号,太赞了!!

TexturePacker主页:http://www.codeandweb.com/

TexturePacker是一款强大的图集打包软件,是制作2D游戏的必备工具,支持大多数流行的游戏引擎,如:

  • Unity - Game Engine
  • Cocos2D-X - Cross-platform open source 2D game engine
  • Cocos2D - SpriteBuilder
  • SpriteKit - Apple’s 2d game engine
  • Starling - Cross-platform game engine
  • Sparrow - Open-source game engine for iOS
  • LibGDX - Java (cross-platform, open-source)
  • Moai - Mobile platform for pro game developers
  • V-Play - Cross-platform 2D game engine
  • Corona(TM) SDK - Cross-platform mobile app development for iOS, Android
  • Gideros Mobile - Cross-platform technology to create amazing games
  • Ogre with CEGUI - 3D gaming framework and GUI
  • CSS sprites
  • JSON / HTML5

如果你有一个开发相关博客可以到 这里 去申请它的免费授权

request在抓取utf8编码网页时中文没有问题,但是抓取gbk编码的网页时返回的中文都是乱码,网上搜索到如下解决方法:

首先安装requesticonv-lite模块

1
npm install request iconv-lite

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var request = require('request');
var iconv = require('iconv-lite');

request.get({
url: 'http://www.xxx.com',//需要抓取的url地址
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36'
},
encoding: null //让body 直接是buffer
}, function(error, response, body) {
var str = iconv.decode(body, 'GBK');
console.log(str);

});

最近在研究爬虫使用的是request模块,在访问被墙网址时需要为它添加代理功能,在npm上找到了socks5-http-client模块可以使用socks5代理,如果需要访问https可以使用socks5-https-client模块

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var agent = require('socks5-http-client/lib/Agent');
var request = require('request');
request.get({
url: 'http://wwww.google.com',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36'
},
agentClass: agent,
agentOptions: {
socksHost: '127.0.0.1', // socks5代理服务器ip
socksPort: 1080 // socks5代理服务器端口
}
}, function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
});

处理csv碰到的问题

office保存的csv文件是gbk格式,直接给nodejs处理会造成中文不能识别

解决方法

通过iconv-lite转码成utf8格式
npm安装iconv-lite

1
npm install iconv-lite

新建convert.js文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var iconv = require('iconv-lite');
var fs = require('fs');
var input = process.argv[2];
if (fs.existsSync(input)) {
var fileStr = fs.readFileSync(input, {
encoding: 'binary'
});
var buf = new Buffer(fileStr, 'binary');
var str = iconv.decode(buf, 'GBK');
fs.writeFile('output.csv', str, function(err) {
if (err) throw err;
console.log('csv file converted!');
});
} else {
console.log('file path invalid')
}

npm安装nodemailer

1
npm i nodemailer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var nodemailer = require('nodemailer');

var config = {
host: 'smtp.exmail.qq.com',
port: 465,
secure: true,
auth: {
user: 'your_email',
pass: 'your_password'
}
};

var transporter = nodemailer.createTransport(config);

var data = {
from: '[email protected]', // sender address
to: '[email protected]', // list of receivers
subject: 'Hello', // Subject line
text: 'Hello world', // plaintext body
html: '<b>Hello world </b>' // html body
};

transporter.sendMail(data, function(error, info) {
if (error) {
console.log(error);
} else {
console.log('Message sent: ' + info.response);
}
});

Blender是一款开源的三维动画软件,功能可以和Maya、3DMax等强大商业软件相媲美但是完全免费,熟练使用快捷键可以极大提高Blender的效率,如图:

Blender 快捷键

最近折腾了下WNDR 3700v4路由器openwrt固件更新,记录下过程备忘:

拨号配置

在WAN口高级设置下调大LCP响应故障阈值和LCP响应间隔的值防止迅雷下载断线

计划任务配置

新建restart.sh文件内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

flag=$(date +%s -r /root/flag)

ctime=$(date +%s)

x=$(($ctime-$flag))

#echo $x

if [ $x -gt 600 ]; then

touch /root/flag

echo "touch & reboot @ $(date +%D" "%T)" > /root/bootlog.txt 2>&1

reboot

fi

保存并赋予执行权限

1
chmod +x restart.sh

编辑计划任务清单加入如下内容:

1
2
3
4
5
30 1 * * 0-4 wifi down

5 6 * * 0-4 wifi on

30 6 * * * /root/restart.sh

无线网络配置

软件包配置

  • 安装ChinaDns

    1
    2
    3
    Opkg update
    Opkg install 文件名
    /etc/init.d/chinadns start

  • 配置Dnsmasq
    修改配置文件\etc\dnsmasq.conf,在文件末尾加入

    1
    2
    3
    4
    5
    no-resolv

    server=127.0.0.1#5353

    conf-dir=/etc/dnsmasq.d
  • 原版系统补充

    1
    2
    Opkg update
    Opkg install luci-app-ddns luci-app-upnp miniupnpd bind-dig

端口映射配置

外网端口号 协议 内网目标IP 内网端口号
8000 TCP 192.168.1.20 80
6800 TCP 192.168.1.20 6800

使用扫描软件将图片转成文字后会发现内容里面夹杂很多空格手工删除的话太累了,下面介绍个方法使用word的替换功能来自动删除

  • 打开word替换对话框,启用使用通配符选项
  • 查找内容填写:([!a-zA-Z0-9\[]) ([!a-zA-Z0-9\[])
  • 替换内容填写:\1\2
  • 最后点击全部替换,大功告成

Step1

备份游戏文件夹,uplay里先下载游戏一小会再暂停

Step2

退出uplay,复制备份游戏文件到安装文件夹里的uplay download编号文件夹里覆盖,再剪切到安装文件夹保证uplay download文件夹为空

Step3

删除uplay安装文件夹里data目录的对应编号文件夹

Step4

重新登录uplay验证游戏文件