Last active
April 13, 2025 01:42
-
-
Save varenc/534c917806f77bf436e6982634b17181 to your computer and use it in GitHub Desktop.
Backup your Chrome Developer tools saved snippets
This file contains 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
## Use the path below for macOS. | |
# On linux it may be `~/.config/chromium/Default/Preferences` or `~/snap/chromium/common/chromium/Default/Preferences`` | |
# Find yours by opening chrome://version/, finding the "Profile Path" line, and appending `/Preferences` to it. | |
cat "$HOME/Library/Application Support/Google/Chrome/Default/Preferences" \ | |
| jq -r ' | |
.devtools.preferences["script-snippets"] | |
| fromjson[] | |
| [.name, (.content | @base64)] | |
| @tsv | |
' \ | |
| while IFS=$'\t' read -r snippet_name snippet_content_b64; do | |
snippet_name_clean=$(echo -n "$snippet_name" | tr -cs '[:alnum:]._$' '_') | |
base64 --decode <<<"$snippet_content_b64" \ | |
> "${snippet_name_clean}.js" | |
echo "Saved snippet: $snippet_name_clean.js (original name: $snippet_name)" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment