如何新建自签名SSL证书

  1. 准备工作:
mkdir ca
cd ca
mkdir demoCA
mkdir demoCA/newcerts
touch demoCA/index.txt
echo "01" > demoCA/serial

2. 生成CA证书

openssl genrsa -des3 -out ca.key 2048

3. 生成CA公钥

openssl req -new -x509 -days 7305 -key ca.key -out ca.crt

4. 生成域名证书私钥

openssl genrsa -des3 -out *.njduck.com.pem 1024

5. 将域名私钥解密生成key

openssl rsa -in *.njduck.com.pem -out *.njduck.com.key

6. 生成证书请求

openssl req -new -key *.njduck.com.pem -out *.njduck.com.csr

7. 证书签名

openssl ca -policy policy_anything -days 1460 -cert ca.crt -keyfile ca.key\
    -in *.njduck.com.csr -out *.njduck.com.crt

CA证书生成后可以直接从第4步开始给其他域名生成证书

Excel小技巧

=IF(EXACT(WEEKDAY(A10,2),"1"),"一",IF(EXACT(WEEKDAY(A10,2),"2"),"二",IF(EXACT(WEEKDAY(A10,2),"3"),"三",IF(EXACT(WEEKDAY(A10,2),"4"),"四",IF(EXACT(WEEKDAY(A10,2),"5"),"五",IF(EXACT(WEEKDAY(A10,2),"6"),"六",IF(EXACT(WEEKDAY(A10,2),"7"),"日","")))))))

配置HBase单机版

  • 配置JAVA_HOME

编辑conf/hbase-env.sh,指定包含/bin/java的路径为JAVA_HOME

export JAVA_HOME=/usr
  • 编辑HBase主配置文件

conf/hbase-site.xml

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/ubuntu/hbase/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/ubuntu/hbase/zookeeper</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      Controls whether HBase will check for stream capabilities (hflush/hsync).

      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.

      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
  </property>
</configuration>
  • 启动HBase

执行bin/start-hbase.sh

启用ssh的公钥连接,禁用密码连接

系统

ubuntu 16.04 64bit

步骤
  1. 服务器的~/目录新建文件夹.ssh,权限0700
  2. 上传公钥到服务器的~/.ssh/目录,重命名为authorized_keys,权限为0644
  3. 编辑/etc/ssh/sshd_config
  4. PubkeyAuthentication yes
    PasswordAuthentication no
  5. 重启服务器
  6. reboot
  7. 愉快的玩耍吧~
  8. ssh -i [PrivateKey] [root@]server

[LUA]做配置文件的一个简单例子

准备lua

新建一个config.lua文件,内容如下

--my config
MyConfigValue = 1234

准备C++

新建一个main.cpp文件,内容如下

#include<stdio.h>

extern "C"
{    
#include "lua.h"    
#include "lauxlib.h"    
#include "lualib.h"    
}    
   
void
ReadVariable(lua_State *L,int *myConfigValue)
{
    lua_getglobal(L,"MyConfigValue");
    
    if (!lua_isnumber(L,-1)) {
        luaL_error(L,"`MyConfigValue' should be a number\n");
    }
    
    *myConfigValue = (int)lua_tonumber(L,-1);
    printf("MyConfigValue is %d\n",*myConfigValue);
}
int main(int argc, char* argv[])    
{    
    if (argc != 2) {
        printf("param error!\n");    
        return 0;    
    }    
    
    char *filename = argv[1];    
    
    lua_State *L = luaL_newstate();    
    luaL_openlibs(L);  //新版本库添加的方法    
    if (luaL_loadfile(L,filename) || lua_pcall(L,0,0,0)) {
        luaL_error(L,"loadfile error! %s \n",lua_tostring(L,-1));    
    }    
    
    int myConfigValue=1;
    ReadVariable(L,&myConfigValue);
    return 0;  
}  

编译执行吧

$g++ main.cpp -llua -ldl
$./a.out config.lua

[LUA] Hello World!

Lua官方网站

http://www.lua.org/

环境配置

从lua的官方网站(http://www.lua.org/download.html)下载最新的lua代码,在本地编译

$make linux test
$sudo make install

新建一个hello.lua文件,内容如下

print("Hello World")

看看你的第一个lua程序吧

$lua hello.lua

Ubuntu 14.04/14.04.1 Eclipse文字没有等宽显示怎么办

编辑字体配置文件

$sudo gedit /etc/fonts/conf.avail/69-language-selector-zh-cn.conf

在配置文件的monospace段添加 <string>Droid Sans Mono</string> 并放在第一个位置

例:

	<match target="pattern">
		<test qual="any" name="family">
			<string>monospace</string>
		</test>
        <test name="lang">
            <string>zh-cn</string>
        </test>
		<edit name="family" mode="prepend" binding="strong">
			<string>Droid Sans Mono</string>
			<string>WenQuanYi Zen Hei Mono</string>
			<string>HYSong</string>
			<string>AR PL UMing CN</string>
			<string>AR PL UMing HK</string>
			<string>AR PL New Sung</string>
			<string>AR PL UKai CN</string>
			<string>AR PL ZenKai Uni</string>
		</edit>
	</match>