Last active
December 14, 2015 19:08
Revisions
-
phunehehe revised this gist
Dec 6, 2013 . 1 changed file with 0 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,3 @@ Print permissions in a way that is suitable for executing again ```bash -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 19 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,30 @@ Enable `autostart` for running VMs ```bash for i in $(virsh list | grep running | awk '{print $2}') do virsh autostart $i done ``` Disable `autostart` for shut-off VMs ```bash for i in $(virsh list --all | grep 'shut off' | awk '{print $2}') do virsh autostart --disable $i done ``` Print permissions in a way that is suitable for executing again ```bash for i in * do echo chown $(stat -c%U:%G $i) $i echo chmod $(stat -c%a $i) $i done ``` Rename files to remove special characters -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 16 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,19 +22,19 @@ Print permissions in a way that is suitable for executing again Rename files to remove special characters ```bash #!/bin/zsh for f in "$1"/**/* do if [ -f "$f" ] then dir_name=$(dirname "$f") file_name=$(basename "$f") name=${file_name%.*} ext=${file_name:(-4)} good_name=$(echo "$name" | sed -re 's/\W+/_/g' -e 's/_+/_/g')"$ext" [[ "$file_name" == "$good_name" ]] || echo mv "$f" "$dir_name"/"$good_name" fi done ``` -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Print permissions in a way that is suitable for executing again Rename files to remove special characters ~~~zsh #!/bin/zsh for f in "$1"/**/* @@ -37,4 +37,4 @@ Rename files to remove special characters [[ "$file_name" == "$good_name" ]] || echo mv "$f" "$dir_name"/"$good_name" fi done ~~~ -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Print permissions in a way that is suitable for executing again Rename files to remove special characters ~~~zsh #!/bin/zsh for f in "$1"/**/* @@ -35,4 +36,5 @@ Rename files to remove special characters good_name=$(echo "$name" | sed -re 's/\W+/_/g' -e 's/_+/_/g')"$ext" [[ "$file_name" == "$good_name" ]] || echo mv "$f" "$dir_name"/"$good_name" fi done ~~~ -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,21 @@ Print permissions in a way that is suitable for executing again do echo chown $(stat -c%U:%G $i) $i echo chmod $(stat -c%a $i) $i done Rename files to remove special characters #!/bin/zsh for f in "$1"/**/* do if [ -f "$f" ] then dir_name=$(dirname "$f") file_name=$(basename "$f") name=${file_name%.*} ext=${file_name:(-4)} good_name=$(echo "$name" | sed -re 's/\W+/_/g' -e 's/_+/_/g')"$ext" [[ "$file_name" == "$good_name" ]] || echo mv "$f" "$dir_name"/"$good_name" fi done -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,12 @@ Disable `autostart` for shut-off VMs for i in $(virsh list --all | grep 'shut off' | awk '{print $2}') do virsh autostart --disable $i done Print permissions in a way that is suitable for executing again for i in * do echo chown $(stat -c%U:%G $i) $i echo chmod $(stat -c%a $i) $i done -
phunehehe revised this gist
Mar 11, 2013 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,4 +3,11 @@ Enable `autostart` for running VMs for i in $(virsh list | grep running | awk '{print $2}') do virsh autostart $i done Disable `autostart` for shut-off VMs for i in $(virsh list --all | grep 'shut off' | awk '{print $2}') do virsh autostart --disable $i done -
phunehehe created this gist
Mar 11, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ Enable `autostart` for running VMs for i in $(virsh list | grep running | awk '{print $2}') do virsh autostart $i done