Results for “arc”
Small, practical examples. Search by task or narrow things down below.
Locate a value in a sorted array
Java: Use Arrays.binarySearch only after establishing ascending order.
Java✓ Tested
Match a whole word
Linux Commands: Use grep -w to exclude a matching substring inside a longer word.
Linux Commands✓ Tested
Match any pattern from a file
Linux Commands: Use grep -F -f with one literal pattern per line.
Linux Commands✓ Tested
Print only the matching portions
Linux Commands: Use extended regex and -o to extract digit sequences.
Linux Commands✓ Tested
Read a file size in bytes
Python: Use stat().st_size to read the logical byte length without loading the file.
Python✓ Tested
Read compressed text directly
Python: Open gzip data in text mode with an explicit encoding.
Python✓ Tested
Read concatenated gzip members
Linux Commands: GNU gzip decompresses concatenated gzip members in order.
Linux Commands✓ Tested
Remove a leading directory while extracting
Linux Commands: Use strip-components only after inspecting a trusted archive layout.
Linux Commands✓ Tested
Rename a file within a directory
Python: Use Path.rename and inspect the resulting path.
Python✓ Tested
Show line numbers beside matches
Linux Commands: Use grep -n so a result identifies its position in the source file.
Linux Commands✓ Tested
Verify a file against a checksum manifest
Linux Commands: Use sha256sum -c with a manifest obtained from a trusted source.
Linux Commands✓ Tested
Build a URL query string from values
JavaScript: URLSearchParams handles query escaping and repeated parameter appends.
JavaScript✓ Tested