Created
October 16, 2020 09:52
-
-
Save akkys77/2768380671b54e18637d7c4ac5da9b75 to your computer and use it in GitHub Desktop.
Extract snippets from chrome
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 characters
| # Tested with jq-1.6 | |
| # The script converts json entries into lines of format | |
| # `filename[TAB]content-in-base64` and then | |
| # for each line creates the corresponding file | |
| # with the content decoded. | |
| # Better be in a safe directory!! | |
| mkdir /tmp/snippets-backup | |
| cd /tmp/snippets-backup | |
| jq .devtools.preferences.scriptSnippets ~/.config/chromium/Default/Preferences \ | |
| | jq '. | fromjson | .[]| [ .name, @base64 "\(.content)" ] | @tsv' -r \ | |
| | xargs -I{} /bin/bash -c 'file=$(echo "{}"|cut -f1); fileContent=$(echo "{}"|cut -f2); echo "$fileContent" | base64 -d > "${file}.js"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment