Skip to content

Instantly share code, notes, and snippets.

[user] name = xxx email = xxx [core] editor = vim [http] [http] noproxy = localhost,127.0.0.1 proxy = http://usr:pwd@proxy:port sslVerify = false

@tdp100
tdp100 / Using-AntConc.md
Last active November 21, 2017 23:06
How to use AntConc on ubuntu
  1. download AntConc linux version for offical website

  2. unzip AntConc

    tar xvf AntConc.tar.gz
  3. move AntConc to /usr/local and add link

@tdp100
tdp100 / lua-programming-meta.md
Created September 21, 2015 09:10
Lua 的metatable以及支持的metamethod

Lua 的metatable以及支持的metamethod


metatable和metamethod能够用来定义Lua的默认操作, 比如默认场景下Lua是不支持两个table的+,-,*,/操作的,但如果给table定义了metatable,并且在metatable中定义了相关操作的method,那么table就可以支持这些操作了. Lua默认只有string 库中给string设置了metatable, 其它类型都没有metatable.

print(getmetatable("aasfas"))  --Table
print(getmetatable({})) --nil
@tdp100
tdp100 / lua-programming-1.md
Created September 19, 2015 04:07
如何使用Lua调用C 动态链接库(dynamic linking facility)

如何使用Lua调用C 动态链接库(dynamic linking facility)


Lua解释器本身使用C语言开发, 它是一种解释型开发语言, 性能很好. 在游戏, nginx, wireshark中都有用到. 以下是学习Lua 调用C 动态链接库的实践

写一个简单的C库 hello.h, hello.c

hello.h文件上的内容

@tdp100
tdp100 / chrome-ssl-errror.md
Created July 20, 2015 11:51
chrome ssl error

添加如下配置:

C:\Users\xxx\AppData\Local\Google\Chrome\Application\chrome.exe --ignore-certificate-errors
@tdp100
tdp100 / wireshark.md
Created June 29, 2015 06:49
wireshark on ubuntu

安装完毕问题现象

在ubuntu上安装完wireshark后,/usr/bin/dumpcap 会属性root:wireshark 组。 但通过系统中并没有创建wireshark group。

如果使用client user运行wireshark后,会出现/usr/bin/dumpcap没有权限的错误。

解决办法:

sudo chown yourname:yourgroup dumpcap
@tdp100
tdp100 / emacs-input-method.md
Created June 17, 2015 04:31
在emacs中支持中文輸入法

1. ubuntu中设置fcitx输入模式

setting->language setting->keyboard input method system: fcitx

2. 添加fcitx中的输入法

安装sougo pingying, wubipingyin

3. 添加如下环境变量:

@tdp100
tdp100 / debug-angular.md
Last active August 29, 2015 14:23
quick debug angular.js

1. 访问angular服务

angular.element('html').injector().get('$location').search({'hello': null}).absUrl()

2. 访问DOM中的scope

angular.element('html').scope()
@tdp100
tdp100 / perfect-test.md
Created June 15, 2015 12:32
perfect test

1. 生成指定大小的文件,用于构造分区段测试数据

#!/bin/bash
filename=4k.txt
filesize=$(( 4*1024 ))
if [ ! -e $filename ];then
   echo -n >$filename
fi
if [ -f $filename ];then
 echo -n >$filename

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname