Last active
February 16, 2024 02:40
-
-
Save dardo82/f7cc7c5c864fb5afa04bb12ecbcf3a9f to your computer and use it in GitHub Desktop.
Revisions
-
dardo82 revised this gist
Oct 26, 2021 . 1 changed file with 1 addition 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 @@ -6,4 +6,4 @@ DB="$DIR/../${${TIC// }%%s*}${${(C)CS}//_}.db"; SQL=$(sqlite3 "$DB" "SELECT host sqlite3 "$DB" "UPDATE $CS SET ${${${(L)TIC// /_}#*_}//s/_is_in}=1, download_status_flags=1" for png in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$DIR/../../Bookmarks.plist" | \ awk -F '[</>]' -v name="${${png##*/}%%.*}" '$3~name{getline;getline;getline;print $5}')"; \ cp -f -v "$png" "$DIR/${(U)$(md5 -q -s $URL)}.png"; done; chflags -v uappnd $DIR $DB* -
dardo82 revised this gist
Sep 25, 2019 . 1 changed file with 8 additions and 11 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,12 +1,9 @@ #!/bin/zsh # Fix Safari Favorites Icons CS="cache_settings"; TIC="Touch Icons Cache"; DIR="$HOME/Library/Safari/$TIC/Images" DB="$DIR/../${${TIC// }%%s*}${${(C)CS}//_}.db"; SQL=$(sqlite3 "$DB" "SELECT host FROM $CS") sqlite3 "$DB" "UPDATE $CS SET ${${${(L)TIC// /_}#*_}//s/_is_in}=1, download_status_flags=1" for png in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$DIR/../../Bookmarks.plist" | \ awk -F '[</>]' -v name="${${png##*/}%%.*}" '$3~name{getline;getline;getline;print $5}')"; \ cp -f -v "$png" "$DIR/${(U)$(md5 -q -s $URL)}.png"; done; chflags -v uappnd $DIR $DB -
dardo82 revised this gist
Jun 30, 2018 . 1 changed file with 1 addition 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 @@ -9,4 +9,4 @@ typeset -A BMA; BMA=($(plutil -p "$HLSD/Bookmarks.plist" \ | awk -F'"' '{name=$4; getline; if($0~/\"[a-z]+:\/\//){print name" "$4}}')) for bmn in ${(k)BMA[@]}; do cp -v "$1/$bmn.png" "$SCD/${(U)$(md5 -qs ${${${BMA[$bmn]}#*//}%%/*})}.png"; done -
dardo82 revised this gist
Jun 30, 2018 . 1 changed file with 1 addition 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 @@ -9,4 +9,4 @@ typeset -A BMA; BMA=($(plutil -p "$HLSD/Bookmarks.plist" \ | awk -F'"' '{name=$4; getline; if($0~/\"[a-z]+:\/\//){print name" "$4}}')) for bmn in ${(k)BMA[@]}; do cp -v "$1/$bmn.png" "$SCD/${(U)$(md5 -qs ${${${BMA[$bmn]}#*//}%%/*})}.png"; done -
dardo82 revised this gist
Jun 30, 2018 . 1 changed file with 11 additions and 3 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,4 +1,12 @@ #!/bin/zsh # Fix Safari Missing Touch Favicons HLSD="$HOME/Library/Safari"; SCD="$HLSD/Touch Icons Cache/Images" typeset -A BMA; BMA=($(plutil -p "$HLSD/Bookmarks.plist" \ | sed -n '/title/{h;n;n;H;x;p'$'\n''}' \ | awk -F'"' '{name=$4; getline; if($0~/\"[a-z]+:\/\//){print name" "$4}}')) for bmn in ${(k)BMA[@]}; do cp -v "$1/$bmn.png" "$SCD/${(U)$(md5 -qs ${${${BMA[$bmn]}#*//}%%/*})}.png"; done -
dardo82 revised this gist
Jun 30, 2018 . 1 changed file with 3 additions and 7 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,8 +1,4 @@ #!/bin/zsh HLSD="$HOME/Library/Safari";SCD="$HLSD/Touch Icons Cache/Images" typeset -A BMA;BMA=($(plutil -p "$HLSD/Bookmarks.plist"|sed -n '/title/{h;n;n;H;x;p'$'\n''}'|awk -F\" '{print $4}')) for bmn in ${(k)BMA[@]};do cp -v "$1/$bmn.png" "$SCD/${(U)$(md5 -qs ${${${BMA[$bmn]}#*//}%%/*})}.png";done -
dardo82 revised this gist
Jun 29, 2018 . 1 changed file with 5 additions and 5 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,8 +1,8 @@ #!/bin/zsh # Fixes Safari Touch Icons HLS="$HOME/Library/Safari"; TIC="$HLS/Touch Icons Cache/Images" plutil -p "$HLS/Bookmarks.plist" | sed -n '/title/{h;n;n;H;x;p'$'\n''}' | \ awk -F'[/"]' -v tic="$TIC" -v av1="$1" \ '{printf "cp -v \""av1"/"$4".png\" \""tic"/"; getline\ ; print system("md5 -qs "$6"|tr a-z A-Z")".png\""}' | sed -n 'N;s/\n0//;p'; -
dardo82 revised this gist
Jun 29, 2018 . 1 changed file with 6 additions and 8 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,10 +1,8 @@ #!/bin/zsh # Fixes Safari Touch Icons HLS="$HOME/Library/Safari" for f in "$1"/*; do SITE="$(plutil -convert xml1 -o - "$HLS/Bookmarks.plist" | \ awk -F '[</>]' -v f="${${f##*/}%%.*}" '$3~f{getline;getline;getline;print $5}')" cp -frv "$png" "$HLS/Touch Icons Cache/Images/${(U)$(md5 -qs $SITE)}.png"; done; -
dardo82 revised this gist
Jun 29, 2018 . 1 changed file with 7 additions and 7 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,10 +1,10 @@ #!/bin/zsh # Fix Safari Favorites Icons CS="cache_settings"; TIC="Touch Icons Cache"; DIR="$HOME/Library/Safari/$TIC/Images" DB="$DIR/../${${TIC// }%%s*}${${(C)CS}//_}.db"; SQL=$(sqlite3 "$DB" "SELECT host FROM $CS") diff <(ls "$DIR") <(for URL in "${=SQL}"; do echo ${(U)$(md5 -q -s $URL)}.png; done | sort) sqlite3 "$DB" "UPDATE $CS SET ${${${(L)TIC// /_}#*_}//s/_is_in}=1, download_status_flags=1" for png in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$DIR/../../Bookmarks.plist" | \ awk -F '[</>]' -v name="${${png##*/}%%.*}" '$3~name{getline;getline;getline;print $5}')"; \ cp -v "$png" "$DIR/${(U)$(md5 -q -s $URL)}.png"; done -
dardo82 revised this gist
Dec 15, 2017 . 1 changed file with 1 addition 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 @@ -4,7 +4,7 @@ LSD="Library/Safari"; TIC="Touch Icons Cache"; TAB="cache_settings"; DIR="/$HOME/$LSD/$TIC/" DBF="$DIR/${${TIC// /}%s*}${${(C)TAB}/_/}.db"; SQL=$(sqlite3 "$DBF" "SELECT host FROM $TAB") diff <(ls "$DIR/Images") <(for i in "${=SQL}"; do echo ${(U)$(md5 -qs $i)}.png; done | sort) sqlite3 "$DBF" "UPDATE $TAB SET ${${${(L)TIC// /_}#*_*}/s/_is_in}=1,download_status_flags=1" for file in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$HOME/$LSD/Bookmarks.plist" | \ awk -F '[</>]' -v f="${${file##*/}%%.*}" '{if($3~f){for(i=0;i<3;i++)getline;print $5}}')"; \ cp -fv "$file" "$HOME/$LSD/Touch Icons Cache/Images/${(U)$(md5 -q -s $URL)}.png"; done; exit -
dardo82 revised this gist
Dec 11, 2017 . 1 changed file with 7 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 @@ -1,4 +1,10 @@ #!/bin/zsh # Fix Safari Favorites Icons LSD="Library/Safari"; TIC="Touch Icons Cache"; TAB="cache_settings"; DIR="/$HOME/$LSD/$TIC/" DBF="$DIR/${${TIC// /}%s*}${${(C)TAB}/_/}.db"; SQL=$(sqlite3 "$DBF" "SELECT host FROM $TAB") diff <(ls "$DIR/Images") <(for i in "${=SQL}"; do echo ${(U)$(md5 -qs $i)}.png; done | sort) for file in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$HOME/$LSD/Bookmarks.plist" | \ awk -F '[</>]' -v f="${${file##*/}%%.*}" '{if($3~f){for(i=0;i<3;i++)getline;print $5}}')"; \ cp -fv "$file" "$HOME/$LSD/Touch Icons Cache/Images/${(U)$(md5 -q -s $URL)}.png"; done; exit -
dardo82 created this gist
Dec 11, 2017 .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,4 @@ #!/bin/zsh LSD="Library/Safari"; TIC="Touch Icons Cache"; TAB="cache_settings"; DIR="/$HOME/$LSD/$TIC/" DBF="$DIR/${${TIC// /}%s*}${${(C)TAB}/_/}.db"; SQL=$(sqlite3 "$DBF" "SELECT host FROM $TAB") diff <(ls "$DIR/Images") <(for i in "${=SQL}"; do echo ${(U)$(md5 -qs $i)}.png; done | sort)