-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
555 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-vscode.powershell", | ||
"foxundermoon.shell-format", | ||
"timonwong.shellcheck", | ||
"bierner.markdown-preview-github-styles", | ||
"bierner.markdown-mermaid" | ||
] | ||
"recommendations": [ | ||
"ms-vscode.powershell", | ||
"foxundermoon.shell-format", | ||
"timonwong.shellcheck", | ||
"bierner.markdown-preview-github-styles", | ||
"bierner.markdown-mermaid" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,77 @@ | ||
function cmake_configure_debug() { | ||
if test -e CMakeLists.txt; then | ||
cmake -B _build-Debug-$WSL_DISTRO_NAME$OS -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug "$@" | ||
else | ||
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug "$@" | ||
fi | ||
if test -e CMakeLists.txt; then | ||
cmake -B _build-Debug-$WSL_DISTRO_NAME$OS -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug "$@" | ||
else | ||
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug "$@" | ||
fi | ||
} | ||
|
||
function cmake_configure_release() { | ||
if test -e CMakeLists.txt; then | ||
cmake -B _build-Release-$WSL_DISTRO_NAME$OS -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release "$@" | ||
else | ||
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release "$@" | ||
fi | ||
if test -e CMakeLists.txt; then | ||
cmake -B _build-Release-$WSL_DISTRO_NAME$OS -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release "$@" | ||
else | ||
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DSTATIC_LINKING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release "$@" | ||
fi | ||
} | ||
|
||
function cmake_build() { | ||
cmake --build . --target all | ||
cmake --build . --target all | ||
} | ||
|
||
function cmake_clean() { | ||
cmake --build . --target clean | ||
cmake --build . --target clean | ||
} | ||
|
||
function cmake_build_target() { | ||
cmake --build . --target $1 | ||
cmake --build . --target $1 | ||
} | ||
|
||
function cmake_check() { | ||
cmake --build . --target check | ||
cmake --build . --target check | ||
} | ||
|
||
function cmake_install() { | ||
case $OSTYPE in | ||
linux*) | ||
sudo cmake --install . --prefix /usr | ||
;; | ||
msys*) | ||
cmake --install . | ||
;; | ||
*) | ||
sudo cmake --install . | ||
;; | ||
esac | ||
case $OSTYPE in | ||
linux*) | ||
sudo cmake --install . --prefix /usr | ||
;; | ||
msys*) | ||
cmake --install . | ||
;; | ||
*) | ||
sudo cmake --install . | ||
;; | ||
esac | ||
} | ||
|
||
function cmake_uninstall() { | ||
local manifest="install_manifest.txt" | ||
if test -e $manifest; then | ||
while IFS= read -r i; do | ||
local file=${i%$'\r'} | ||
if test -e "$file"; then | ||
echo "uninstall $file" | ||
sudo rm "$file" | ||
fi | ||
done <$manifest | ||
else | ||
log_error "$manifest does not exist" && return 1 | ||
fi | ||
local manifest="install_manifest.txt" | ||
if test -e $manifest; then | ||
while IFS= read -r i; do | ||
local file=${i%$'\r'} | ||
if test -e "$file"; then | ||
echo "uninstall $file" | ||
sudo rm "$file" | ||
fi | ||
done <$manifest | ||
else | ||
log_error "$manifest does not exist" && return 1 | ||
fi | ||
} | ||
|
||
function cmake_clean_retain_objs() { | ||
if test -d CMakeFiles; then | ||
find . -maxdepth 1 -not -name '.' -not -name CMakeFiles -exec rm -rf {} \; | ||
else | ||
log_error "there is no CMakeFiles dir" && return 1 | ||
fi | ||
if test -d CMakeFiles; then | ||
find . -maxdepth 1 -not -name '.' -not -name CMakeFiles -exec rm -rf {} \; | ||
else | ||
log_error "there is no CMakeFiles dir" && return 1 | ||
fi | ||
} | ||
|
||
function cmake_test_all() { | ||
ctest | ||
ctest | ||
} | ||
|
||
function cmake_test_target() { | ||
cmake --build . --target $1 | ||
ctest -R $1 | ||
cmake --build . --target $1 | ||
ctest -R $1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
function convert_heic_to_jpg_at_dir() { | ||
if test -z "*.heic"; then | ||
for file in *.heic; do convert $file ${file/%.heic/.jpg}; done | ||
else | ||
log_msg "no .heic file at dir" | ||
fi | ||
if test -z "*.heic"; then | ||
for file in *.heic; do convert $file ${file/%.heic/.jpg}; done | ||
else | ||
log_msg "no .heic file at dir" | ||
fi | ||
} | ||
|
||
function convert_pptx_compress_images() { | ||
: ${1?"Usage: ${FUNCNAME[0]} <pptx_file>"} | ||
# https://dev.to/feldroy/til-strategies-for-compressing-jpg-files-with-imagemagick-5fn9 | ||
[[ -d /tmp/pptx_extracted ]] && rm -rf /tmp/pptx_extracted/ | ||
[[ -d ${1%.*}-compressed.pptx ]] && rm -rf ${1%.*}-compressed.pptx | ||
unzip -q "$1" -d /tmp/pptx_extracted | ||
local large_images=$(find /tmp/pptx_extracted/ppt/media -type f -size +500k -name *.jpg -o -name *.png -o -name *.jpeg -print) | ||
local mogrigfy_params="-sampling-factor 4:2:0 -quality 85 -strip" | ||
[[ -z $large_images ]] && log_msg "no large images" && return | ||
for image in $large_images; do | ||
log_msg "compressing $(basename $image)" | ||
mogrify $mogrigfy_params $image | ||
done | ||
# create file | ||
local cwd=$(pwd) | ||
(cd /tmp/pptx_extracted/ && | ||
zip -9 -q -r "$cwd/${1%.*}-compressed.pptx" *) | ||
: ${1?"Usage: ${FUNCNAME[0]} <pptx_file>"} | ||
# https://dev.to/feldroy/til-strategies-for-compressing-jpg-files-with-imagemagick-5fn9 | ||
[[ -d /tmp/pptx_extracted ]] && rm -rf /tmp/pptx_extracted/ | ||
[[ -d ${1%.*}-compressed.pptx ]] && rm -rf ${1%.*}-compressed.pptx | ||
unzip -q "$1" -d /tmp/pptx_extracted | ||
local large_images=$(find /tmp/pptx_extracted/ppt/media -type f -size +500k -name *.jpg -o -name *.png -o -name *.jpeg -print) | ||
local mogrigfy_params="-sampling-factor 4:2:0 -quality 85 -strip" | ||
[[ -z $large_images ]] && log_msg "no large images" && return | ||
for image in $large_images; do | ||
log_msg "compressing $(basename $image)" | ||
mogrify $mogrigfy_params $image | ||
done | ||
# create file | ||
local cwd=$(pwd) | ||
(cd /tmp/pptx_extracted/ && | ||
zip -9 -q -r "$cwd/${1%.*}-compressed.pptx" *) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
alias docker_prune="docker container prune; docker image prune -a" | ||
function docker_run_at_same_folder(){ | ||
: ${2?"Usage: ${FUNCNAME[0]} <image> <command and args>"} | ||
local image=$1 | ||
shift 1 | ||
local cmd="$*" | ||
docker run -v $(pwd):$(pwd) -w $(pwd) -it $image $cmd | ||
} | ||
function docker_run_at_same_folder() { | ||
: ${2?"Usage: ${FUNCNAME[0]} <image> <command and args>"} | ||
local image=$1 | ||
shift 1 | ||
local cmd="$*" | ||
docker run -v $(pwd):$(pwd) -w $(pwd) -it $image $cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
function ffmpeg_cut_mp4() { | ||
: ${3?"Usage: ${FUNCNAME[0]} <video> <begin_time_in_format_00:00:00> <end_time_in_format_00:00:00>"} | ||
ffmpeg -i $1 -vcodec copy -acodec copy -ss $2 -t $3 -f mp4 cuted-$1 | ||
: ${3?"Usage: ${FUNCNAME[0]} <video> <begin_time_in_format_00:00:00> <end_time_in_format_00:00:00>"} | ||
ffmpeg -i $1 -vcodec copy -acodec copy -ss $2 -t $3 -f mp4 cuted-$1 | ||
} | ||
|
||
function ffmpeg_show_motion_vectors() { | ||
: ${1?"Usage: ${FUNCNAME[0]} <video>"} | ||
ffplay -flags2 +export_mvs -vf codecview=mv=pf+bf+bb $1 | ||
: ${1?"Usage: ${FUNCNAME[0]} <video>"} | ||
ffplay -flags2 +export_mvs -vf codecview=mv=pf+bf+bb $1 | ||
} | ||
|
||
function ffmpeg_images_merge_to_mp4() { | ||
: ${1?"Usage: ${FUNCNAME[0]} <image>"} | ||
ffmpeg -loop_input -i "$1".png -t 5 "$1".mp4 | ||
: ${1?"Usage: ${FUNCNAME[0]} <image>"} | ||
ffmpeg -loop_input -i "$1".png -t 5 "$1".mp4 | ||
} | ||
|
||
function ffmpeg_mp4_files_merge() { | ||
: ${1?"Usage: ${FUNCNAME[0]} <file1> ... "} | ||
ffmpeg -f concat -safe 0 -i <(for f in "$@"; do echo "file '$PWD/$f'"; done) -c copy output.mp4 | ||
: ${1?"Usage: ${FUNCNAME[0]} <file1> ... "} | ||
ffmpeg -f concat -safe 0 -i <(for f in "$@"; do echo "file '$PWD/$f'"; done) -c copy output.mp4 | ||
} |
Oops, something went wrong.