Show HN: Venetianblinds.js – evenly spaced windows into text files (liveclip.substack.com)

1 points by firasd ↗ HN
I kept wanting a way to quickly orient myself in large files before searching them. Instead of searching, this CLI opens evenly spaced "windows" through a file and shows the surrounding context.

Github: https://github.com/firasd/venetianblinds

It turned out to be surprisingly useful on both source code and long text.

Usage:

npx github:firasd/venetianblinds --samples=5 reactdomroot.js # venetianblinds

file: reactdomroot.js characters: 12729 samples: 5 context_range: 120

--- sample 1/5 char 0 line 1 col 1 range 0:60 /* * Copyright (c) Meta Platforms, Inc. and affiliates. ^

--- sample 2/5 char 3182 line 106 col 1 range 3122:3242 t: FiberRoot) { this._internalRoot = internalRoot; }

// $FlowFixMe[prop-missing] found when upgrading Flow React ^

--- sample 3/5 char 6364 line 188 col 31 range 6304:6424 nDefaultTransitionIndicator; let transitionCallbacks = null;

  // $FlowFixMe[invalid-compare]
  if (options !== n
                              ^

1 comment

[ 3.4 ms ] story [ 15.0 ms ] thread
Works well on prose too

npx github:firasd/venetianblinds --samples=12 macbeth.txt # venetianblinds file: macbeth.txt characters: 128338 samples: 12 context_range: 120

--- sample 1/12 char 0 line 1 col 1 range 0:60 The Project Gutenberg eBook of Macbeth

This eBook is ^

--- sample 2/12 char 11667 line 481 col 25 range 11607:11727 thee from our royal master thanks; Only to herald thee into his sight, Not pay thee.

ROSS. And, for an earnest of ^

--- sample 3/12 char 23334 line 868 col 21 range 23274:23394 have judgement here; that we but teach Bloody instructions, which being taught, return To plague th’ inventor. This ev ^