Skip to content

Instantly share code, notes, and snippets.

View jyhsu2000's full-sized avatar

KID jyhsu2000

View GitHub Profile
@jyhsu2000
jyhsu2000 / convert_all_files_to_jpg.sh
Created May 22, 2018 05:32
Convert all files to jpg
find . -type f -execdir mogrify -format jpg {} \;
@jyhsu2000
jyhsu2000 / count_all_files_extension.sh
Last active May 22, 2018 05:32
Count all files extension
find . -type f | sed -n 's/..*\.//p' | sort | uniq -c
@jyhsu2000
jyhsu2000 / random_files.sh
Created May 15, 2018 06:48
Select random files
ls dirname | shuf -n 10
find dirname -type f | shuf -n 10
# clear previous backup
rm -rf "$(git rev-parse --git-dir)/refs/original/"
commit="$1"
date=$(date -d "$2" +%s)
git filter-branch --env-filter \
"if [ \$GIT_COMMIT = '$commit' ]; then
export GIT_AUTHOR_DATE='$date'
export GIT_COMMITTER_DATE='$date'
export GIT_COMMITTER_NAME="\$GIT_AUTHOR_NAME"
def process():
pass
while True:
try:
process()
except EOFError:
break
@jyhsu2000
jyhsu2000 / FixDockerSharedDrives.ps
Created October 11, 2017 06:48
Fix docker shared drives
Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory Private
DB::statement('SET FOREIGN_KEY_CHECKS=0');
DB::table('products')->truncate();
robocopy d: g: /MIR /eta /R:3 /W:5
@jyhsu2000
jyhsu2000 / ConvertMtsToMp4.bat
Last active May 24, 2018 08:26
全資料夾轉檔
REM 轉檔
for %f in (*.mts) do ffmpeg -deinterlace -i "%~f" "%~nf.mp4"
REM 轉擋+保留修改時間/存取時間
for %f in (*.mts) do ffmpeg -deinterlace -i "%~f" "%~nf.mp4" & touch -r "%~f" "%~nf.mp4"
for %f in (*.mp4) do ffmpeg -deinterlace -i "%~f" "%~nf_2.mp4" & touch -r "%~f" "%~nf_2.mp4"
# Linux
for i in *.MTS; do ffmpeg -deinterlace -i "$i" "${i%.*}.mp4"; done
@jyhsu2000
jyhsu2000 / gitUntrackAllIgnoredFiles.sh
Last active March 11, 2017 11:56
git untrack all ignored files
git rm -r --cached .
git add .