free software resistance
the cost of computing freedom is eternal vigilance
### another-quick-coding-job-for-mlsd
*originally posted:* feb 2022
*updated:* jan 2024
im calling it showdup.fig:
```
#### license: creative commons cc0 1.0 (public domain)
#### http://creativecommons.org/publicdomain/zero/1.0/
buf arr mid 1 0
p arrstdin
forin each p
single each rtrim ltrim
ck instr buf single
iftrue ck
iftrue single
now "dup: " plus single print
else
now single print
next
else
buf plus single
now each print
next
next
```
this was very easy to write. the one line i had to add was "now each print" but the rest was written on the first try without compiling.
instead of only showing unique lines, or counting consecutive instances, this simply marks any duplicate line (not including the first) as such.
this is useful for the work im doing with mlsd.
```
cat mlsd.mlsd | ./showdup.fig.py
```
here is a version that is perhaps more readable:
```
#### license: creative commons cc0 1.0 (public domain)
#### http://creativecommons.org/publicdomain/zero/1.0/
buf = arr | mid 1 0
p arrstdin
forin each p
single = each | rtrim | ltrim
ck = instr(buf, single)
iftrue ck
iftrue single
now = "dup: " | plus single | print
else
now = single | print
next
else
buf = plus single
now = each | print
next
next
```
license: 0-clause bsd
```
# 2018, 2019, 2020, 2021, 2022, 2023, 2024
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org