file2qrcode(){
if [[ ! -f $1 ]]; then
exit;
fi
if [[ $(ls) =~ ${1%.*}.7z ]]; then
rm ${1%.*}.7z*
fi
# 圧縮
7z a -v1k ${1%.*}.7z $1
archive=$(ls |grep -E "${1%.*}.7z*")
# QRコード作成
for f in $archive; do
head=${f}";"
str=${head}
for s in $(xxd $f); do
adrs=$(echo $s|cut -d " " -f 1)
data=$(echo $s|cut -d " " -f 2-9|sed -e 's/ //g')
str=${str}${adrs}${data}","
done
echo $str | qrencode -o ${f}.png
done
}
dump2file(){
if [[ ! -f $1 ]]; then
exit
fi
cat $1| while read line
do
if [[ $line =~ ";" ]]; then
head=$(echo $line|cut -d ";" -f 1)
line=$(echo $line|sed -e 's/.*;//g')
line=$(echo $line|sed -e 's/,$//g')
>dumpfile
str=""
for s in $(echo $line|sed -e 's/,/\n/g'); do
adrs=$(echo $s|cut -d ":" -f 1):
data=""
for d in $(echo $s|cut -d ":" -f 2|fold -s4); do
data="${data} ${d}"
done
echo "${adrs}${data}" >> dumpfile
done
xxd -r dumpfile ${head}
rm dumpfile
fi
done
}
pdf_unpassword(){
if [[ 0 -ne $# ]]; then
echo "Input password"
exit
fi
for f in $(ls|grep .pdf); do
qpdf --decrypt --password=$1 $f ${f//.pdf/_nopass.pdf};
done
}
2021年5月9日日曜日
QRコード作成
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿