fork/nix-index
git clone https://git.julia.blue/fork/nix-index
e7c66ba
v0.1.6
1#!/usr/bin/env python3 2import sys 3import json 4 5 6CHUNK_SIZE = 4 * 32 * 1024 7 8 9def wrong_written_size (x ): 10out = 0 11while x >= 0 : 12out += x 13x -= CHUNK_SIZE 14return out 15 16 17if __name__ == '__main__' : 18with open (sys .argv [1 ],'rb' )as f : 19data = f .read () 20 21sys .argv [1 ]) 22try : 23json .loads (data ) 24except json .JSONDecodeError as e : 25exc = e 26for margin in range (10 ): 27if len (data )== wrong_written_size (e .pos + margin ): 28margin ,exc ,len (data ),e .pos ,data [e .pos :][:10 ],data [:10 ]) 29sys .exit (0 ) 30 31sys .exit (1 )