diff --git a/home/bin/executable_auto-screenshot-monitor b/home/bin/executable_auto-screenshot-monitor new file mode 100644 index 0000000..ee0b720 --- /dev/null +++ b/home/bin/executable_auto-screenshot-monitor @@ -0,0 +1,30 @@ +#!/bin/sh -e + +# filename format datetime YYYYMMDD-HHMMSS.png +filename=$(date +%Y%m%d-%H%M%S).png + +# Get the picture from maim +# flameshot gui -r > $HOME/.cache/src.png & +grim -g "0,0 1920x1200" "$HOME/ramdisk/$filename" & +wait $! + +# add shadow, round corner, border and watermark +# convert $HOME/ramdisk/src.png \ +# \( +clone -alpha extract \ +# -draw 'fill black polygon 0,0 0,8 8,0 fill white circle 8,8 8,0' \ +# \( +clone -flip \) -compose Multiply -composite \ +# \( +clone -flop \) -compose Multiply -composite \ +# \) -alpha off -compose CopyOpacity -composite $HOME/ramdisk/output.png + +# convert $HOME/ramdisk/output.png -bordercolor none -border 20 \( +clone -background black -shadow 80x8+15+15 \) \ +# +swap -background transparent -layers merge +repage $HOME/ramdisk/des.png + +# # composite -gravity South ~/.local/bin/watermark.png $HOME/ramdisk/des.png $HOME/ramdisk/des.png + +# # Send the Picture to clipboard +# # xclip -selection clipboard -t image/png -i $HOME/ramdisk/des.png +# wl-copy -t image/png < $HOME/ramdisk/des.png + +# # remove the other pictures +# rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png +notify-send "screenshot success" diff --git a/home/bin/executable_hls-convert b/home/bin/executable_hls-convert new file mode 100644 index 0000000..aaa41bc --- /dev/null +++ b/home/bin/executable_hls-convert @@ -0,0 +1,38 @@ +#!/bin/bash + + +if [ -z "$1" ]; then + echo "請輸入檔案名稱" + exit 1 +fi + +if [ ! -f "$1" ]; then + echo "file not exists" + exit 1 +fi + +FILENAME="${1##*/}" +DIRNAME="${FILENAME%.*}" +EXTNAME="${FILENAME##*.}" + +echo "$DIRNAME" + +mkdir "$DIRNAME" + +# gen key +openssl rand 16 > "$DIRNAME/enc.key" + +# new key info file +echo "enc.key" > keyinfo +echo "$DIRNAME/enc.key" >> keyinfo +openssl rand 16 -hex >> keyinfo + +# convert +ffmpeg -i "$1" -f hls -hls_time 10 -hls_list_size 0 -vn -hls_segment_filename "$DIRNAME/segment%d.ts" -hls_key_info_file keyinfo -hls_playlist_type vod "$DIRNAME/playlist.m3u8" + +# move origin file +cp "$1" "$DIRNAME/origin.$EXTNAME" + +# clean tmp file +rm keyinfo + diff --git a/home/bin/executable_lbk-package.sh b/home/bin/executable_lbk-package.sh new file mode 100644 index 0000000..5f7e134 --- /dev/null +++ b/home/bin/executable_lbk-package.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -xe +set -o pipefail + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +tmpFolder=$(mktemp -d) + +deleteTmpFolder() { + rm -rf $tmpFolder +} + +trap deleteTmpFolder EXIT + +wd=$(pwd) +encName="lbk-$(date +%Y%m%d)-enc.zip" + +# 7z a -tzip -p -mem=AES256 archive.zip file1 file2 directory/ + +# compress Source.zip without encryption +cd $1 + +zip -r "$tmpFolder/Source.zip" . + +# generate Source.zip md5 +md5sum "$tmpFolder/Source.zip" | cut -d' ' -f1 | tee "$tmpFolder/Vendor_Src_MD5.txt" + +# compress with encryption +cd $tmpFolder + +7z a -tzip -pLb1234567890 -mem=AES256 "$tmpFolder/$encName" Source.zip Vendor_Src_MD5.txt + +# copy to pwd folder +cp "$tmpFolder/$encName" $wd +cd $wd diff --git a/home/bin/executable_pack-magneto2-source b/home/bin/executable_pack-magneto2-source new file mode 100644 index 0000000..685e0b8 --- /dev/null +++ b/home/bin/executable_pack-magneto2-source @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -xe + +# usage: pack-magneto2-source [output folder] +if [ $# -lt 1 ]; then + echo "Usage: $0 [output folder]" + exit 1 +fi +IMAGE_REPO=$1 +OUTPUT_FOLDER=$(realpath "${2:-.}") + +# echo "Packing Magento 2 source code from $IMAGE_REPO to $OUTPUT_FOLDER" +uid=$(id -u) + +docker run -it --rm -v "$OUTPUT_FOLDER:/out" -e "HOST_UID=$uid" \ + "$IMAGE_REPO" \ + bash -c 'cd /app && \ + find /app -type f -iname "*test*" -exec rm -f {} \; && \ + rm -rf /app/node_modules && \ + rm -rf /app/system/modules/swagger/public/swagger-ui/* && \ + chown -R $HOST_UID /app && \ + tar -cvf /out/magneto2.tar . && \ + chown $HOST_UID /out/magneto2.tar' + +# vim : set ft=sh :