🚙

💨 💨 💨

×

  • Categories

  • Archives

  • Tags

  • About

C++与Lua本质原始交互API

Posted on 11-11-2015 | In Misc

我们用一个例子来说明.

. . .

tolua++安装

Posted on 11-11-2015 | In Misc

我们用一个例子来说明.

本文环境为 :

  • ubuntu1404
  • g++ 4.8.4
  • python
  • git
  • lua5.1( 因为tolua++只支持到5.1, 安装5.1教程看 Lua的win和linux环境简单安装 )

. . .

Lua中ipairs和pairs的区别与使用

Posted on 11-11-2015 | In Misc

关于ipairs()和pairs(),Lua官方手册是这样说明的:

pairs (t)

If t has a metamethod __pairs, calls it with t as argument and returns the first three results from the call.

Otherwise, returns three values: the next function, the table t, and nil, so that the construction

` for k,v in pairs(t) do body end`

will iterate over all key–value pairs of table t.

See function next for the caveats of modifying the table during its traversal.

ipairs (t)

If t has a metamethod __ipairs, calls it with t as argument and returns the first three results from the call.

Otherwise, returns three values: an iterator function, the table t, and 0, so that the construction

` for i,v in ipairs(t) do body end`

will iterate over the pairs (1,t[1]), (2,t[2]), …, up to the first integer key absent from the table.

根据官方手册的描述,pairs会遍历表中所有的key-value值,而pairs会根据key的数值从1开始加1递增遍历对应的table[i]值,直到出现第一个不是按1递增的数值时候退出。

. . .

Lua的win和linux环境搭建

Posted on 11-08-2015 | In Misc

ubuntu环境

. . .

Linux常用命令笔记整理之tcpdump

Posted on 11-03-2015 | In Linux

强大的抓包工具, 博大精深内容太多, 所以这篇博客整理得只说常用, 具体的参考tcpdump用户手册,
tcpdump需要root权限, 所以记得加上sudo

常用参数

  • -nn选项:
    意思是说当tcpdump遇到协议号或端口号时,不要将这些号码转换成对应的协议名称或端口名称。比如,大家都知道80是http端口,tcpdump就不会将它显示成http了

  • -c选项:
    是Count的含义,这设置了我们希望tcpdump帮我们抓几个包。

  • -i : 指定哪一张网卡

  • -l : 使得输出变为行缓冲

  • -t : 输出时不打印时间戳

  • -v : 输出更详细的信息

  • -F : 指定过滤表达式所在的文件, 可以建立了一个filter.txt文本文件来存储过滤表达式,然后通过-F来指定filter.txt

  • -w : 将流量保存到文件中

  • -r : 读取raw packets文件

. . .

linux常用文本处理命令笔记整理之sed

Posted on 10-23-2015 | In Linux

sed是一种流编辑器,它是文本处理中非常中的工具,能够完美的配合正则表达式使用,功能不同凡响。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。接着处理下一行,这样不断重复,直到文件末尾。文件内容并没有 改变,除非你使用重定向存储输出。Sed主要用来自动编辑一个或多个文件;简化对文件的反复操作;编写转换程序等。

. . .

linux常用文本处理命令笔记整理之grep和awk

Posted on 10-21-2015 | In Linux

linux常用文本处理的命令的使用率很高, 所以整理了一些之前的笔记,用markdown来记录备忘。
首先抛出问题, 带着问题来学记忆知识更有动力:

  • 如何通过一条命令取得eth0的IP4地址 :

    ifconfig eth0 | grep -w 'inet' | awk '{print $2}' | awk -F: '{print $2}'
  • 如何通过一条命令替换当前路径下所有文件中的所有“xxx”为“yyy“ :

    ls -alF | grep '^-' | awk '{print $NF}' |  xargs sed -i 's/xxx/yyy/g'
  • 如何通过一条命令杀掉占用端口34600的进程 :

    sudo lsof -i:34600 | grep -v 'PID' | awk '{print $2}' | xargs kill -9

这些命令它们分别具体是什么意思呢?为何能达到上述效果?

. . .

安装AndroidSDK的一些坑与注意点

Posted on 09-13-2015 | In Misc

近来要用Unity打包到安卓上玩, 需要安装AndroidSDK.

安装教程基本上按照这篇文章A就可以, 遇到不明白的可以拿这篇B对照着看, 以A为准, 但是有几个点要注意 :

  • jdk别装太高版本, 装个jdk-8u161的32位的即可, 别装64位, 也别装高版本的jdk10的64位, 不然 android sdk set up tool 不认识, sdk manager 也会闪退

  • jdk的环境变量很容易设置错, 比如环境变量JAVA_HOME应该填jdk的安装路径即 : JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11而不是JAVA_HOME=C:/Program Files/Java, 填后者的话, sdk manager 会闪退

  • 为了确保不必要的麻烦最好这样环境变量设置成类似如下 :

    JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11
    JRE_HOME=C:/Program Files/Java/jre8
    Path=%JAVA_HOME%;C:...
  • 打安卓包的时候, 如果报file not found debug.keystore 或 Unable to get debug signature key的错, 用管理员权限重新打开Unity即可.

1…18192021222324252627282930313233343536
Mike

Mike

🚙 🚗 💨 💨 If you want to create a blog like this, just follow my open-source project, "hexo-theme-neo", click the GitHub button below and check it out ^_^ . It is recommended to use Chrome, Safari, or Edge to read this blog since this blog was developed on Edge (Chromium kernel version) and tested on Safari.

11 categories
287 posts
110 tags
about
GitHub Spotify
© 2013 - 2025 Mike