2015年2月17日 星期二
DNS 內外網段不同解析內容
References :
BIND 9 Configure Views To Partition External and Internal DNS Information
How To Configure BIND as a Private Network DNS Server on Ubuntu 14.04 | DigitalOcean
DNS 將 Domain 分成內外部不同解析(view) - Tsung's Blog
2015年2月14日 星期六
vim auto zz after search jump
" Center screen on next/previous selection.
nnoremap n nzz
nnoremap N Nzz
References :
command - Auto 'zz' in vim after a jump - Stack Overflow
2015年2月10日 星期二
you must have geoip c library installed!
# apt-get install libgeoip-dev
References :
How do I install the GeoIP Geo location PECL extension? - Analytics Platform - Piwik
sshd 允許特定使用者登入
# vi /etc/ssh/sshd_configAllowUsers user1 user2 testuser# /etc/init.d/ssh restart
References :
ssh - how to use both AllowGroups and AllowUsers in sshd_config - Server Fault
2015年2月8日 星期日
Collcted Plugin Development and Compiling (AREAWELL AW-2111A Plugin)
$ wget https://github.com/collectd/collectd/archive/collectd-5.4.1.tar.gz
$ tar zxf collectd-5.4.1.tar.gz
下載 Collectd AREAWELL AW-2111A plugin
$ git clone https://github.com/a0726h77/cloudPower-collectd-plugin.git
將 AW-2111A plugin 複製到 Collectd 原始碼資料夾
$ cp -r cloudPower-collectd-plugin/* collectd-collectd-5.4.1/src/
修改編譯設定,加入 plugin
$ cd collectd-collectd-5.4.1/
$ vi configure.ac
....$ vi src/Makefile.am
AC_PLUGIN([cloudpower], [yes], [cloudpower statistics])
....
....$ vi src/types.db
if BUILD_PLUGIN_CLOUDPOWER
pkglib_LTLIBRARIES += cloudpower.la
cloudpower_la_SOURCES = cloudpower.c
cloudpower_la_LDFLAGS = -module -avoid-version
cloudpower_la_LIBADD = -L. -lcloudPowerManagerTool
collectd_LDADD += "-dlopen" cloudpower.la
collectd_DEPENDENCIES += cloudpower.la
endif
....
....
electric value:GAUGE:U:U
....
* Makefile.am 裏需指定模組對 libcloudPowerManagerTool.a 使用靜態連結
安裝相依套件
# apt-get install build-essential automake bison flex autoconf pkg-config libtool libgcrypt20-dev libltdl-dev libglib2.0-dev lib32z1-dev gcc-4.9-multilib
編譯 & 安裝
$ ./build.sh
$ ./configure CFLAGS="-m32" --prefix=/opt/collectd
CFLAGS="-m32" 編譯 collectd 成 32 位元執行檔,因爲官方給的$ make
--prefix 指定安裝路徑
libcloudPowerManagerTool.a 只有 32 位元版本
# make all install
載入模組
# vi /opt/etc/collectd.conf
....
LoadPlugin cloudpower
....
<
Plugin cloudpower>
<
Node "1F">
Host "192.168.x.x"
<
/Node>
<
/Plugin>
....
執行
# /opt/collectd-5.4.1/sbin/collectd -C /opt/collectd-5.4.1/etc/collectd.conf -f
References :
First steps - collectd Wiki
Plugin architecture - collectd Wiki
AREAWELL NETWORKS
Compile Collectd plugin with static link library
* 可參考 iptables plugin 的設定
References :
Plugin:IPTables - collectd Wiki
$ cp libfact.a src/
$ vi src/Makefile.am
if BUILD_PLUGIN_MYPLUGIN$ make
....
myplugin_la_LIBADD = -L. -lfact
....
endif
References :
Plugin:IPTables - collectd Wiki
plugin_dispatch_values: Dataset not found check your types.db!
add your custome plugin type define to TypesDB
References :
Question on apple_sensors plugin - Monitoring Collectd
[collectd] Thought about exec and types.db
types.db(5) – collectd – The system statistics collection daemon
# vi /usr/share/collectd/types.db
References :
Question on apple_sensors plugin - Monitoring Collectd
[collectd] Thought about exec and types.db
types.db(5) – collectd – The system statistics collection daemon
2015年2月7日 星期六
WARNING: Neither `libtoolize' nor `glibtoolize' have been found! "apt-get"
# apt-get install libtool
Compile Collectd from source
$ git clone https://github.com/collectd/collectd.git
$ cd collectd
$ ./build.sh
$ ./configure
$ make
# make all install
Error :
$ ./build.shSolution :
WARNING: `lex' not found!
Please make sure that `lex' is installed and is in one of the
directories listed in the PATH environment variable.
WARNING: `yacc' not found!
Please make sure that `yacc' is installed and is in one of the
directories listed in the PATH environment variable.
# apt-get install byacc flex
# apt-get install bison
Error :
$ ./build.shSolution :
configure.ac:1909: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
# apt-get install libgcrypt20-dev
References :
Development Information – collectd – The system statistics collection daemon
First steps - collectd Wiki
how to install Lex and Yacc in Ubuntu? - Stack Overflow
[collectd] Compile git clone
使用collectd与visage收集kvm虚拟机性能实时图形 - - 博客频道 - CSDN.NET
Golang compile 32 bit binary on 64 bit system
$ GOARCH=386 go build
* not support for cgo
References :
windows - Compile 32 bit binary on 64 bit system - Stack Overflow
Golang use C library
- cgo can compile C code
- cgo can not compile C++ code (see Swig for that)
- cgo supports both dynamic and static linking of compiled C code
- by default, cgo will dynamically link (more on this later)
- cgo does not support relative lookups of C files
- #cgo pkg-config
$ vitest.go
package main import "fmt" // #cgo CFLAGS: -I. // #cgo LDFLAGS: -L. -lgb // #include
import "C" func main() { fmt.Printf("Invoking c library...\n") fmt.Println("Done ", C.x(10) ) }
$ go build test.go
References :
How do you statically link a c library in go using cgo? - Stack Overflow
A little trick to statically link C to Golang with cgo
Going Go Programming: Using C Dynamic Libraries In Go Programs
Linux turn off LCD monitor
Turn off
Turn on
References :
Simple command to turn off the monitor ~ Linux and Life
$ DISPLAY=:0 xset dpms force off
Turn on
$ DISPLAY=:0 xset dpms force on
References :
Simple command to turn off the monitor ~ Linux and Life
Converting Markdown to reStructuredText
安裝 pandoc
# apt-get install pandoc
轉換
$ pandoc --from=markdown --to=rst --output=README.rst README.md
References :
Converting Markdown to reStructuredText | Bradley Froehle
2015年2月6日 星期五
X Windows 旋轉
旋轉 180 度
恢復正常
$ xrandr -o inverted
or
$ xrandr --output LVDS1 --rotate inverted
恢復正常
$ xrandr -o normal
or
$ xrandr --output LVDS1 --rotate normal
Sphinx 使用
安裝
安裝樣板
設定引導
執行完 sphinx-quickstart 會產生 Makefile 與 conf.py 檔
產生靜態 html 文件
References :
Documenting Your Project Using Sphinx — an_example_pypi_project v0.0.5 documentation
# pip install sphinx
or
# apt-get install python-sphinx
安裝樣板
# pip install sphinx_rtd_theme
設定引導
$ sphinx-quickstart
執行完 sphinx-quickstart 會產生 Makefile 與 conf.py 檔
產生靜態 html 文件
$ make html
References :
Documenting Your Project Using Sphinx — an_example_pypi_project v0.0.5 documentation
gcc 編譯使用靜態函式庫 (.a)
產生動態函式庫
產生靜態函式庫
使用靜態函式庫
References :
segfault.in » How to create static libraries with gcc?
$ gcc -c fact.c -o fact.o
產生靜態函式庫
$ ar rcs libfact.a fact.o
使用靜態函式庫
$ tree
.
├── fact.h
├── libfact.a
├── main.c
$ gcc -static main.c -L. -lfact -o main
References :
segfault.in » How to create static libraries with gcc?
在 64 位元系統上編譯 32 位元程式
安裝 32 位元函式庫
gcc 模擬 32 位元# apt-get install ia32-libs-dev
# apt-get install lib32z1-dev
$ gcc -m32 -o output32 hello.c
References :
linux - /usr/bin/ld: skipping incompatible foo.so when searching for foo - Stack Overflow
HowTo Compile a 32-bit Application Using gcc On the 64-bit Linux Version - nixCraft
2015年2月5日 星期四
AREAWELL Cloud Wi-Fi Outlet AW-2111A
Library 與 Android & iOS APP下載
AREAWELL NETWORKS
按下遠端/本地切換鈕
R/L 燈亮時爲遠端模式,燈暗時爲本地模式 (可自行開發軟體)
1052/tcp filtered ddt
1107/tcp filtered isoipsigport-2
1455/tcp filtered esl-lm
1721/tcp filtered caicci
2021/tcp filtered servexec
2222/tcp filtered EtherNet/IP-1
5087/tcp filtered unknown
6001/tcp filtered X11:1
7800/tcp filtered asr
8652/tcp filtered unknown
20005/tcp filtered btx
32777/tcp filtered sometimes-rpc17
54328/tcp filtered unknown
AREAWELL NETWORKS
按下遠端/本地切換鈕
R/L 燈亮時爲遠端模式,燈暗時爲本地模式 (可自行開發軟體)
1052/tcp filtered ddt
1107/tcp filtered isoipsigport-2
1455/tcp filtered esl-lm
1721/tcp filtered caicci
2021/tcp filtered servexec
2222/tcp filtered EtherNet/IP-1
5087/tcp filtered unknown
6001/tcp filtered X11:1
7800/tcp filtered asr
8652/tcp filtered unknown
20005/tcp filtered btx
32777/tcp filtered sometimes-rpc17
54328/tcp filtered unknown
2015年2月4日 星期三
[error]: Permission denied - /var/log/httpd/access_log
# vi /etc/init.d/td-agent
DAEMON_ARGS=${DAEMON_ARGS---user td-agent}
TD_AGENT_ARGS="${TD_AGENT_ARGS-/usr/sbin/td-agent --group td-agent --log /var/log/td-agent/td-agent.log}"
改成
DAEMON_ARGS=${DAEMON_ARGS---user root}
TD_AGENT_ARGS="${TD_AGENT_ARGS-/usr/sbin/td-agent --user root --group td-agent --log /var/log/td-agent/td-agent.log}"
References :
職場でよく耳にするfluentdを試してみました - Qiita
Disable IPv6
CentOS
References :
curl force IPv4 – disable IPv6 in curl and PHP - UK Business Directory
# echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
References :
curl force IPv4 – disable IPv6 in curl and PHP - UK Business Directory
Can't find libcurl or curl/curl.h
Debian / Ubuntu :
CentOS :
# apt-get install libcurl4-gnutls-dev
CentOS :
# yum install libcurl-devel.i686
訂閱:
文章 (Atom)