2017年3月17日

一个可遇不可求的 bug 全局变量初始化顺序问题 哈哈

摘要: 这是今天下午帮同事查的一个客户端 C++ 的 bug,前人留下的谜之代码。。 具体情况是,客户端实现了有一个简单的内存池,每次申请内存的时候会把新申请到的内存信息存到一个 map 里,据说是为了检查内存泄漏。 大致是像下面这段代码 同事把第 7 行注释掉了,结果客户端就开始崩溃。神奇哟~ 报错信息中 阅读全文

posted @ 2017-03-17 18:05 明天有风吹 阅读(701) 评论(0) 推荐(0)

skynet inject address file.lua

摘要: inject d test/inject_fuck.lua -- d 是服务的 handle 拿 simpledb.lua 举例,修改如下 添加了 fuck 函数,并设置 info_func。 设置 info_func 主要用来在 debug console 中方便用 info d 来查看 inje 阅读全文

posted @ 2017-03-17 14:20 明天有风吹 阅读(1602) 评论(0) 推荐(0)

2017年3月13日

杀掉所有 skynet 进程

摘要: ps aux | grep skynet | grep -v grep | awk '/config/{print $2}' | xargs kill 阅读全文

posted @ 2017-03-13 14:30 明天有风吹 阅读(690) 评论(0) 推荐(0)

2017年3月4日

win7 docker 挂载共享目录

摘要: 在 win7 下用 docker 不像 win10 那样方便,安装包都不一样。 在 win7 下共享一个目录的方法如下: 1. 先设置 win7 到 VirtualBox 中 docker 用的那个虚拟机的共享文件夹 填写好共享文件夹路径和名称。如:共享文件夹路径:E:\ 共享文件夹名称: e 然后 阅读全文

posted @ 2017-03-04 20:37 明天有风吹 阅读(9021) 评论(0) 推荐(0)

docker 常用命令

摘要: docker images docker build --tag tagname . docker ps docker ps -a docker rm tagname docker rmi image docker run -i -t -p 80:80 --name hello centos doc 阅读全文

posted @ 2017-03-04 02:48 明天有风吹 阅读(263) 评论(0) 推荐(0)

2017年2月23日

C# byte array 跟 string 互转

摘要: 用 System.Text.Encoding.Default.GetString() 转换时,byte array 中大于 127 的数据转 string 时会出问题。 把这里的 Default 换成 ASCII,UTF8,Unicode 都会有问题(转成的 string 再转回 byte arra 阅读全文

posted @ 2017-02-23 22:37 明天有风吹 阅读(1521) 评论(0) 推荐(0)

2017年2月20日

C# MemoryStream BinaryReader

摘要: 不清楚这类东西内部搞什么鬼,直接看代码才舒爽 https://referencesource.microsoft.com/#mscorlib 然后可以在线测试 https://www.tutorialspoint.com/compile_csharp_online.php 阅读全文

posted @ 2017-02-20 22:36 明天有风吹 阅读(842) 评论(0) 推荐(0)

2017年2月14日

sublime text syntaxdef

摘要: http://sublimetext.info/docs/en/extensibility/syntaxdefs.html 阅读全文

posted @ 2017-02-14 22:46 明天有风吹 阅读(233) 评论(0) 推荐(0)

2017年2月11日

time clock getrusage clock_gettime gettimeofday timespec_get 对比

摘要: http://stackoverflow.com/questions/12392278/measure-time-in-linux-time-vs-clock-vs-getrusage-vs-clock-gettime-vs-gettimeof 阅读全文

posted @ 2017-02-11 20:39 明天有风吹 阅读(315) 评论(0) 推荐(0)

atomic write pipe

摘要: 阅读 skynet 代码 socket_server 部分,发现对 socket 的写操作流程是这样的: 1. 各个服务(各线程)将数据写到 sendctrl_fd,这是一个 pipe 的 写端 2. ctrl_cmd 函数从 recvctrl_fd 读出数据,然后写到真正的 socketfd 在第 阅读全文

posted @ 2017-02-11 10:18 明天有风吹 阅读(310) 评论(0) 推荐(0)

2017年2月7日

Free Online IDE and Terminal

摘要: Free Online IDE and Terminal 阅读全文

posted @ 2017-02-07 23:48 明天有风吹 阅读(219) 评论(0) 推荐(0)

2017年2月6日

nginx

摘要: http://tengine.taobao.org/book/chapter_02.html http://tengine.taobao.org/book/module_development.html 阅读全文

posted @ 2017-02-06 00:22 明天有风吹 阅读(110) 评论(0) 推荐(0)

cpu 亲和性 affinity

摘要: http://www.ibm.com/developerworks/cn/linux/l-affinity.html 阅读全文

posted @ 2017-02-06 00:05 明天有风吹 阅读(164) 评论(0) 推荐(0)

2017年2月2日

lua breakpoint

摘要: http://blog.codingnow.com/2016/11/lua_debugger.html It aims to separate debug code from host code. All you need to do is require 'remotedebug'. Remote 阅读全文

posted @ 2017-02-02 11:07 明天有风吹 阅读(303) 评论(0) 推荐(0)

2017年1月19日

skynet 源码阅读笔记 bootstrap.lua

摘要: 最近几周粗略看了 skynet 代码的 C 部分。遇到很多知识点以前只是知道,但并不十分了解,所以这是一个学习的过程。 从 main 函数开始,闷头一阵看下来,着实蛋疼。 当看了 skynet_mq.c 和 skynet_module.c 之后才终于有了头绪。 C 代码通篇下来并没有什么特别的难点。 阅读全文

posted @ 2017-01-19 00:00 明天有风吹 阅读(1734) 评论(0) 推荐(0)

2017年1月8日

tcp server

摘要: 写 tcp server 要注意的几个设置参数 SO_REUSEADDR Ignore SIGPIPE 客户端意外挂掉时, 服务器继续往 socket 写数据, 可能会生成 SIGPIPE 信号, 默认导致进程终止 O_NONBLOCK 设置非阻塞 IO TCP_KEEPALIVE TCP_NODE 阅读全文

posted @ 2017-01-08 23:51 明天有风吹 阅读(246) 评论(0) 推荐(0)

SO_REUSEADDR SO_REUSEPORT

摘要: http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t SO_REUSEADDR socketA socket 阅读全文

posted @ 2017-01-08 22:58 明天有风吹 阅读(189) 评论(0) 推荐(0)

safe close tcp connection

摘要: https://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable http://stackoverflow.com/questions/8874021/cl 阅读全文

posted @ 2017-01-08 22:44 明天有风吹 阅读(370) 评论(0) 推荐(0)

2016年12月30日

关于 IPv6

摘要: http://test-ipv6.com/ http://bbs.chinaunix.net/thread-1799798-1-1.html 阅读全文

posted @ 2016-12-30 01:03 明天有风吹 阅读(255) 评论(0) 推荐(0)

2016年12月28日

IPv6 Can't assign requested address

摘要: 今天试了下 bind IPv6 的地址,报错 Can't assign requested address http://stackoverflow.com/questions/24780404/python-tcp-socket-with-ipv6-address-failed http://bl 阅读全文

posted @ 2016-12-28 17:33 明天有风吹 阅读(2130) 评论(0) 推荐(0)

Mac 下查看端口是否被占用

摘要: 1. Mac lsof -i :8080 2. Linux netstat -anp tcp | grep 8080 3. nc -w 10 -n -z 127.0.0.1 8070-8090 阅读全文

posted @ 2016-12-28 12:50 明天有风吹 阅读(7634) 评论(0) 推荐(0)

python 启动一个 http server

摘要: 启动一个简单的 web 服务器 python2 python -m SimpleHTTPServer 8080 python3 python3 -m http.server 8080 --bind 127.0.0.1 3.8 以上可以 bind IPv6 python3 -m http.server 阅读全文

posted @ 2016-12-28 12:40 明天有风吹 阅读(3364) 评论(0) 推荐(0)

2016年12月22日

svn 设置 excel 比对工具为 SPREADSHEETCOMPARE.EXE

摘要: http://blog.csdn.net/ccpat/article/details/50725774 阅读全文

posted @ 2016-12-22 20:28 明天有风吹 阅读(1820) 评论(0) 推荐(0)

2016年12月20日

share your beautiful code

摘要: http://climbi.com/create 阅读全文

posted @ 2016-12-20 16:13 明天有风吹 阅读(130) 评论(0) 推荐(0)

2016年12月16日

nsurlsessiond - taking up all bandwidth!! Help ?

摘要: https://discussions.apple.com/thread/6605949?start=0&tstart=0 #!/bin/sh launchctl unload /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist l 阅读全文

posted @ 2016-12-16 20:39 明天有风吹 阅读(376) 评论(0) 推荐(0)

2016年12月14日

Unity LuaFramework LuaBundleMode

摘要: 设置 AppConst.cs 中的 LuaBundleMode 为 true,开启 Lua 代码 AssetBundle 模式。 启动程序报错,Moudle XXX not found. 我在 Assets/LuaFramework/Lua/ 下新建了一个 excel 目录,这个目录中的文件都无法加 阅读全文

posted @ 2016-12-14 14:17 明天有风吹 阅读(793) 评论(0) 推荐(0)

2016年7月15日

sublime text 文件打开时回调一些函数

摘要: 需求:公司服务端脚本以 .s 结尾的文件,也按 js 语法识别,方便查看函数定义。 每次都 ss:js 比较麻烦,所以写个插件。 1 import sublime, sublime_plugin 2 3 class DotSAwarenessCommand(sublime_plugin.EventL 阅读全文

posted @ 2016-07-15 17:59 明天有风吹 阅读(323) 评论(0) 推荐(0)

2016年5月26日

lua 源码阅读顺序

摘要: https://www.reddit.com/comments/63hth/ask_reddit_which_oss_codebases_out_there_are_so/c02pxbp Online Lua 5.3 source code browser Recommended reading o 阅读全文

posted @ 2016-05-26 20:53 明天有风吹 阅读(1569) 评论(0) 推荐(0)

2016年5月24日

raspberry pi wifi

摘要: vim /etc/network/interfaces 修改 wpa-ssid 和 wpa-psk 参考:http://fanzhenyu.cn/2016/05/22/%E6%A0%91%E8%8E%93%E6%B4%BE%E9%85%8D%E7%BD%AE%E6%97%A0%E7%BA%BF%E7 阅读全文

posted @ 2016-05-24 23:56 明天有风吹 阅读(167) 评论(0) 推荐(0)

2016年4月15日

转 必看:手游PVP同步体验总结及实际方案剖析

摘要: 必看:手游PVP同步体验总结及实际方案剖析 帧同步在竞技类网络游戏中的应用 阅读全文

posted @ 2016-04-15 21:28 明天有风吹 阅读(275) 评论(0) 推荐(0)

flex

摘要: flex 词法分析 fb.l $ flex fb.l $ cc lex.yy.c $ cat fb.l | ./a.out %option noyywrap http://stackoverflow.com/questions/1811125/undefined-reference-to-yywra 阅读全文

posted @ 2016-04-15 00:27 明天有风吹 阅读(180) 评论(0) 推荐(0)

2016年3月4日

当前不会命中断点 源代码与原始版本不一致

摘要: http://www.cnblogs.com/yuetianhewu/articles/2862845.html 阅读全文

posted @ 2016-03-04 10:49 明天有风吹 阅读(257) 评论(0) 推荐(0)

2016年3月3日

c setjmp longjmp

摘要: http://coolshell.cn/?s=setjmp http://www.cnblogs.com/hazir/p/c_setjmp_longjmp.html 1 double divide(double to, double by, jmp_buf env) 2 { 3 if(by == 0 阅读全文

posted @ 2016-03-03 01:46 明天有风吹 阅读(166) 评论(0) 推荐(0)

2016年2月26日

VS 快捷键设置

摘要: 工具 --> 选项 --> 环境 --> 键盘 阅读全文

posted @ 2016-02-26 10:20 明天有风吹 阅读(189) 评论(0) 推荐(0)

2016年2月16日

Lua C API 遍历 table

摘要: http://timothyqiu.com/archives/lua-note-table-traversal-using-c-api/ C API 遍历 Table 1 lua_getglobal(L, t); 2 int index = lua_gettop(L); 3 lua_pushnil( 阅读全文

posted @ 2016-02-16 14:12 明天有风吹 阅读(1398) 评论(0) 推荐(0)

2016年2月2日

lua class

摘要: 1 _class = {} 2 3 function BaseClass(super) 4 local class_type = {} 5 local vtbl = {} 6 _class[class_type] = vtbl 7 8 setmetatable(class_type, { 9 __n 阅读全文

posted @ 2016-02-02 01:17 明天有风吹 阅读(583) 评论(0) 推荐(0)

2016年1月16日

复习 C++ 中类的函数指针

摘要: 函数指针这种东西,平时工作中基本上不会用到。 那函数指针会用在哪里? 下面是一些基本的用法,根据消息号调到对应的函数: 1 #include <iostream> 2 #include <map> 3 4 enum MsgCode 5 { 6 MSGCODE1 = 1, 7 MSGCODE2 = 2 阅读全文

posted @ 2016-01-16 00:52 明天有风吹 阅读(368) 评论(0) 推荐(0)

2015年12月29日

apache ab

摘要: ab -p postfile.json -T 'application/json' -n 100 -c 10 -v 2 http://192.168.1.103:3002/checkStashSlotCount 阅读全文

posted @ 2015-12-29 11:39 明天有风吹 阅读(167) 评论(0) 推荐(0)

2015年12月21日

rabbitmq

摘要: http://www.rabbitmq.com/getstarted.html 阅读全文

posted @ 2015-12-21 02:36 明天有风吹 阅读(110) 评论(0) 推荐(0)

2015年12月17日

协程 coroutine

摘要: 参考链接:http://manual.luaer.cn/2.11.htmlhttp://www.cnblogs.com/riceball/archive/2008/01/03/1025158.htmlhttp://blog.codingnow.com/2012/07/c_coroutine.html... 阅读全文

posted @ 2015-12-17 11:49 明天有风吹 阅读(192) 评论(0) 推荐(0)

导航

+V atob('d2h5X251bGw=')

请备注:from博客园