Skip to content

Instantly share code, notes, and snippets.

View jyhsu2000's full-sized avatar

KID jyhsu2000

View GitHub Profile
@jyhsu2000
jyhsu2000 / .htaccess
Created March 8, 2015 17:39
Laravel - .htaccess of preventing redirect-loop
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# no-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@jyhsu2000
jyhsu2000 / git tree command.sh
Last active August 29, 2015 14:24
git tree
git config --global alias.tree "log --graph --pretty=format:'%C(yellow)%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
@jyhsu2000
jyhsu2000 / gist:50962be377ea10a440e4
Last active May 12, 2020 15:45
chmod all directories except files (recursively)
find . -type d -exec chmod g+s {} +
@jyhsu2000
jyhsu2000 / recalculated.sql
Created October 22, 2015 11:40
Recalculated migrations id
SET @a = 0;
UPDATE migrations SET batch = @a:=@a+1;
@jyhsu2000
jyhsu2000 / FindBigFiles.sh
Created September 12, 2016 14:13
找大檔
find / -type f -size +1G -exec du {} \; 2>/dev/null | sort -n | tail -n 10 | xargs -n 1 du -h 2>/dev/null
@jyhsu2000
jyhsu2000 / FolderSize.sh
Created December 10, 2016 19:40
資料夾容量
df -h .; du -sh -- * | sort -hr
@jyhsu2000
jyhsu2000 / Pretty-Print JSON.sh
Created January 12, 2017 04:03
印出排版後的JSON
python -m json.tool my_json.json
@jyhsu2000
jyhsu2000 / CleanDockerVolume.sh
Created February 6, 2017 10:51
清除殘留的DockerVolume
docker volume rm $(docker volume ls -qf dangling=true)
@jyhsu2000
jyhsu2000 / gitUntrackAllIgnoredFiles.sh
Last active March 11, 2017 11:56
git untrack all ignored files
git rm -r --cached .
git add .
@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