Skip to content

Instantly share code, notes, and snippets.

@calraith
calraith / json.awk
Last active Jun 8, 2018
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.
View json.awk
#!/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)
@calraith
calraith / extract_tampermonkey_scripts.ps1
Created May 23, 2018
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.
View extract_tampermonkey_scripts.ps1
# 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) {
You can’t perform that action at this time.