摘要: 1. 主要包括:
架构总览、核心概念关系、场景例子、源码分析
2. 建议阅读顺序
2.1 从架构总览,了解整体camunda概念,包括DB表结构,内心有概念和底层存储的关系映射
2.2 再解核心概念关系,建立业务概念、代码模型、表结构的映射关系
2.3 通过场景例子,了解不同概念的使用场景,配置
2.4 通过源码分析,了解底层实现,方便必要时对其做扩展
阅读全文
IEEE 754:
https://zh.wikipedia.org/wiki/IEEE_754
FLOAT:
31 30 22 15 7 0
+---+----------+---------+----------+----------+
| | | |
+---+----------+---------+----------+----------+
+ S + E + M +
EXAMPLE(5.5):
=============================
int main() {
float a = 5.5;
int *p = &a;
printf("%d\n", *p);
printf("%X\n", *p);
}
gcc -o main main.c; ./main
十进制: 1085276160
十六进制: 40B00000
=============================
十进制 = 二进制 = 二进制指数形式
5.5 = 101.1 = 1.011 * 2^2
==> S=0 E=2 M = 11
31 30 22 15 7 0
+---+----------+---------+----------+----------+
| 0 | 10000001 | 0110000 | 00000000 | 00000000 |
+---+----------+---------+----------+----------+
+ S + E + M +
转换成INT:
二进制: 01000000101100000000000000000000
十进制: 1085276160
十六进制: 40B00000
EXAMPLE(5.1):
===========================================
int main() {
float a = 5.1;
int *p = &a;
printf("Float:\t%f\n", a);
printf("十进制:\t%d\n", *p);
printf("十六进制:\t%X\n", *p);
}
gcc -o main main.c; ./main
Float: 5.100000
十进制: 1084437299
十六进制: 40A33333
===========================================
存储形式:0b01000000101000110011001100110011
有效尾数:01000110011001100110011
表达方式:1.01000110011001100110011 * 2^2 ==> 101.000110011001100110011
101 ==> 5
0.000110011001100110011 ==> 2^-4 + 2^-5 + 2^-8 + 2^-9 + 2^-12 + 2^-13 + 2^-16 + 2^-17 + 2^-20 + 2^-21
实际表达: 5.09999990463256836
保留6位小数: 5.100000
命令行下的类似keepass一个东东.
如何使用Command line for Keep Password.
Usage:
keepass.sh -l
keepass.sh -e plain-text
keepass.sh -d encoded-text
keepass.sh -s encoded-text name
-l
展示保存下所有加密后的密码信息
-e
将明文密码, 加密, 密文自动保存到剪切板上
-d
将密文界面, 解密后的明文自动保存到剪切板上
-s
将密文持久化保存到文件中
代码实现
#!/bin/sh
DATA="$HOME/.password/data"
declare -a passwords
function enc()
{
#$1: plain text
echo "$1" | openssl enc -des | base64
}
function dec()
{
#$1: encoded text
echo "$1" | base64 -D | openssl enc -des -d
}
function sync()
{
for ((loop=0;loop<${#passwords[*]};loop++))
do
if [ -z "${passwords[$loop]}" ];then
continue
fi
value="$value\n${passwords[$loop]}"
done
echo $value > $DATA
}
function save()
{
#$1 encoded password
#$2 name
for ((loop=0; loop<${#passwords[*]}; loop++))
do
info=${passwords[$loop]}
password=$(echo $info | awk '{print $1}')
name=$(echo $info | awk '{print $2}')
if [ "$2" == "$name" ];then
passwords[$loop]="$1 $2"
return
fi
done
passwords[$loop]="$1 $2"
sync
}
function delete()
{
#$1: name
for ((loop=0; loop<${#passwords[*]}; loop++))
do
info=${passwords[$loop]}
password=$(echo $info | awk '{print $1}')
name=$(echo $info | awk '{print $2}')
if [ "$1" == "$name" ];then
passwords[$loop]=""
fi
done
sync
}
function list()
{
for ((loop=0;loop<${#passwords[*]};loop++))
do
echo ${passwords[$loop]}
done
}
function help()
{
echo "Command line for Keep Password.
Usage:
keepass.sh -l
keepass.sh -e plain-text
keepass.sh -d encoded-text
keepass.sh -s encoded-text name"
}
function init()
{
loop=0
while read line
do
if [ -z "$line" ];then
continue
fi
passwords[$loop]=$line
loop=$(echo $loop+1 | bc)
done < $DATA
}
init
case "$1" in
-l)
list
;;
-e)
enc "$2" | tr -d '\n' | pbcopy
;;
-d)
dec "$2" | tr -d '\n' | pbcopy
;;
-s)
save "$2" "$3"
;;
-r)
delete "$2"
;;
*)
help
;;
esac
备注:
1. 纯shell打造
2. 目前支持Mac shell, 理论上支持linux系统(唯一的改动, 把pbcopy改成linux下剪切板复制的命令即可)