Skip to content

Instantly share code, notes, and snippets.

@calraith
calraith / extract_tampermonkey_scripts.ps1
Created May 23, 2018 03:20
This is meant to be a PowerShell alternative to https://gist.github.com/derjanb/9f6c10168e63c3dc3cf0 for Windows users unable to compile the leveldb Python module.
# Copy your Tampermonkey storage.js into the same directory as this script.
# It'll extract the user scripts from storage.js and write them as .user.js files
# in the current working directory.
add-type -as System.Web.Extensions
$JSON = new-object Web.Script.Serialization.JavaScriptSerializer
$obj = $JSON.DeserializeObject((gc storage.js))
foreach ($key in $obj.keys) {
foreach ($val in $obj[$key].value) {
@calraith
calraith / json.awk
Last active March 7, 2021 05:56
gawk JSON serializer / deserializer. See the END {...} section for example usage, as well as the discussion below this script for further examples. Read the syntax comments within the function definitions.
#!/usr/bin/gawk -f
# Example usage: LC_ALL=C ./json.awk datafile.json
{ json = json $0 }
END {
# Build "obj" as a true multidimensional array from string data
deserialize(json, obj)