about summary refs log tree commit diff stats
path: root/modules/home/conf/firefox/scripts/unzip_mozlz4.py
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 17:07:46 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 17:07:46 +0200
commitc52c7f314ccadcc2fcd91e28c8fd1b88f6d5ce0c (patch)
treee8b947710b467b32740598ff574982097836f66c /modules/home/conf/firefox/scripts/unzip_mozlz4.py
parentchore(pkgs/yt): 1.2.1 -> 1.3.0 (diff)
downloadnixos-config-c52c7f314ccadcc2fcd91e28c8fd1b88f6d5ce0c.tar.gz
nixos-config-c52c7f314ccadcc2fcd91e28c8fd1b88f6d5ce0c.zip
refactor(modules): Move all system modules to `by-name`
From now on all modules should be added to the new `by-name` directory.
This should help remove the (superficial and utterly useless)
distinction between `home-manager` and `NixOS` modules.
Diffstat (limited to 'modules/home/conf/firefox/scripts/unzip_mozlz4.py')
-rwxr-xr-xmodules/home/conf/firefox/scripts/unzip_mozlz4.py44
1 files changed, 0 insertions, 44 deletions
diff --git a/modules/home/conf/firefox/scripts/unzip_mozlz4.py b/modules/home/conf/firefox/scripts/unzip_mozlz4.py
deleted file mode 100755
index 9a2348bf..00000000
--- a/modules/home/conf/firefox/scripts/unzip_mozlz4.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# source: https://unix.stackexchange.com/a/497861
-# Command-line tool to decompress mozLz4 files used for example by Firefox to store various kinds of session backup information.
-# Works in both Python 2.7.15 and 3.6.7, as of version 2.1.6 of the LZ4 Python bindings at pypi.org/project/lz4.
-# To use in another script, simply cut and paste the import statement and the mozlz4_to_text() function (lines 8 to 17).
-
-import lz4.block  # pip install lz4 --user
-
-
-def mozlz4_to_text(filepath):
-    # Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
-    # return the uncompressed text.
-    bytestream = open(filepath, "rb")
-    bytestream.read(8)  # skip past the b"mozLz40\0" header
-    valid_bytes = bytestream.read()
-    text = lz4.block.decompress(valid_bytes)
-    return text
-
-
-def main(args):
-    # Given command-line arguments of an input filepath for a ".mozlz4" file
-    # and optionally an output filepath, write the decompressed text to the
-    # output filepath.
-    # Default output filepath is the input filepath minus the last three characters
-    # (e.g. "foo.jsonlz4" becomes "foo.json")
-    filepath_in = args[0]
-    if len(args) < 2:
-        filepath_out = filepath_in[:-3]
-    else:
-        filepath_out = args[1]
-    text = mozlz4_to_text(filepath_in)
-    with open(filepath_out, "wb") as outfile:
-        outfile.write(text)
-    print("Wrote decompressed text to {}".format(filepath_out))
-
-
-if __name__ == "__main__":
-    import sys
-
-    args = sys.argv[1:]
-    if args and args[0] not in ("--help", "-h"):
-        main(args)
-    else:
-        print("Usage: mozlz4.py <mozlz4 file to read> <location to write>")