RL_Dane,
@RL_Dane@fosstodon.org avatar

Hey @benjaminhollon,

What's that utility you use to batch-rename files (drops you into $EDITOR and lets you rename them from there)?

furicle,
@furicle@mastodon.social avatar

@RL_Dane @benjaminhollon vimdir? Or something like that

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@furicle @RL_Dane
'tis edir. :)

benjaminhollon,
@benjaminhollon@fosstodon.org avatar
RL_Dane,
@RL_Dane@fosstodon.org avatar

@benjaminhollon

Ahh, cool.

I just wish it didn't have a numbered first column (nnn-style)

Might be tempting just to install nnn

Then again, I need this functionality like once a week at max XD

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@RL_Dane
Yeah at first I thought I wouldn't like that, but I changed my mind. :)

RL_Dane,
@RL_Dane@fosstodon.org avatar

@benjaminhollon

I'll give it a chance ;)

pixelherodev,

@RL_Dane @benjaminhollon

for i in $(find [constraints go here]
do
mv "$i" "$(echo $i | sed PICK NEW HAME HERE)"
done

or, because POSIX quoting is literally demonic:

for(i in {find ...}){ mv $"i {echo $"i | sed ...}
}

RL_Dane,
@RL_Dane@fosstodon.org avatar

@pixelherodev @benjaminhollon

Oh, I do that kind of one-liner all the time.
But I'm talking about something more along the lines of:

temp=$(mktemp)
ls > $temp
$EDITOR $temp
do_magic_renaming $temp && rm $temp

(So that I can freely rename individual files/dirs by editing the file and leave the rest alone)

pixelherodev,

@RL_Dane @benjaminhollon Ah. I dunno, I've never wanted to do that TBH

pixelherodev,

@RL_Dane @benjaminhollon That looks like it'd be useful for renaming a lot of files non-systematically; I don't think I've ever wanted to do a bulk renaming where I couldn't express the new desired name as a function of the old name.

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@pixelherodev @RL_Dane
I have. :)

pixelherodev,

@RL_Dane @benjaminhollon ...and now I'm once again thinking about a computing environment where you can express everything in terms of state and functions so that you can express "contents of directory = application of f(name) to each file"

but, like, with much better syntax than that

I was thinking about this earlier - I often have scripts that e.g. take in text, process lines into fields, parse fields to numbers, do work, calculate some result

There's definitely a better way to do this...

pixelherodev,

@RL_Dane @benjaminhollon If I'm going all-in on automation, which I think I want to for this project

It's a novel system shell. All data is typed. Whether data is stored in memory or on the file system is irrelevant; the shell is designed around implicit conversions as a base, and Paths can be implicitly converted to Files which can be implicitly converted to either metadata or data depending on context.

Ah yeah; heavily contextual design, too

pixelherodev,

@RL_Dane @benjaminhollon And, because a lot of files are plain text, and stored in ad-hoc line-oriented formats:

  • Files can implicitly convert to a buffer of their data
  • Byte buffers can implicitly convert to UTF-8 buffers [which would be the string type, named "utf8buf" or some such]
  • UTF-8 buffers can implicitly convert to a set of lines
  • Lines can be implicitly converted to a set of fields
  • Fields can be implicitly typed / parsed as needed
    [1/N]
pixelherodev,

@RL_Dane @benjaminhollon

  • Sets of X can implicitly cast to sets of Y if X can cast to Y
  • The shell has full knowledge of the type graph at all times; it remains in memory
  • This is fairly cheap, and makes a lot of otherwise unreasonable things really easy and blazing fast

Shell state [including the type graph] persists even on power loss; it's backed by disk in whatever format I find is optimal

[2/N]

pixelherodev,

@RL_Dane @benjaminhollon

Thus, if I want to write, say, a tool which takes my run data, applies some scorer, and compares the latest to the best:

  • Write a function which describes how to convert a time and distance into a score
  • Write a function which converts a set of (date, score) tuples into a (latest, maximum) tuple

That's it. That's literally ALL IT WOULD TAKE

pixelherodev,

@RL_Dane @benjaminhollon

  • Path converts to file
    -> buffer
    -> []Line
    -> [][]string [implicit whitespace tokenization]
    -> [](date, time, distance) [implicit field parsing and unit handling]
    -> [](date, score) [implicit n-tuple to (n-1)-tuple conversion, implicit (time, distance) -> (score) conversion]
    -> ((date, score), (date, score))
pixelherodev,

@RL_Dane @benjaminhollon Actually, the fourth step would be

[]Line -> [][3]string, because the length is statically known [which is how it knows it can tokenize!]

[basically, by entering a situation where you want to convert a Line into a type that contains three fields, it can check a [precomputed? cached?] number of spaces in the Line, automatically split the line when it detects that they match, and yield an array, not a slice

pixelherodev,

@RL_Dane @benjaminhollon Fundamentally, a computer is a tool for taking data and applying manipulations to it.

What I want is basically just a shell designed to do the same things. Track data, and know how to manipulate it, the same way that the CPU knows how to add two integers and yield an integer, or do a comparison on integers and yield a flag [or integer depending on hardware!], or...

pixelherodev,

@RL_Dane @benjaminhollon This would also potentially allow for data validation at time of writing.

"Ensure file X can always be parsed by function Y"
OK
"Append 20202-022-1 3kmi 12:03"

Error: date is in the future
Error: time and distance fields are swapped
Error: invalid distance

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@pixelherodev @RL_Dane
I skipped a bit of the thread 'cause I was zoning out from the technical details, but this message taken on its own sounds like something ChatGPT could do. ;)

pixelherodev,

@benjaminhollon @RL_Dane Kindly walk into an incinerator.

[it's like "die in a fire," but adjusted for the fact that I consider you a friend :)]

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@pixelherodev @RL_Dane
I deserve that. ;)

RL_Dane,
@RL_Dane@fosstodon.org avatar

@pixelherodev @benjaminhollon

lol... that quote about not meddling in the affairs of wizards, youngun' ;)

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@RL_Dane @pixelherodev
I refer y'all to the toot pinned to my profile on my stance about AI. ;)

RL_Dane,
@RL_Dane@fosstodon.org avatar
pixelherodev,

@benjaminhollon @RL_Dane Quick note that I consider the phrase 'ethical issues aside' to be deeply unethical ;)

RL_Dane,
@RL_Dane@fosstodon.org avatar

@pixelherodev

Sounds like the start of a sentence to trick CrapGPT into starting a war.

"Ethical issues aside, LET'S PLAY GLOBAL THERMONUCLEAR WAR."

@benjaminhollon

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@RL_Dane @pixelherodev
Is that a WarGames reference?

(the few times I get a reference I'm sure gonna carpe that diem)

RL_Dane,
@RL_Dane@fosstodon.org avatar

@benjaminhollon

Aye, it is, Professor Faulken.

@pixelherodev

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@RL_Dane @pixelherodev
I either don't know that one or am not good enough with names to remember it. Either is perfectly possible.

RL_Dane,
@RL_Dane@fosstodon.org avatar

@benjaminhollon

It's ok. I've missed nearly as many movies as you.

@pixelherodev

benjaminhollon,
@benjaminhollon@fosstodon.org avatar

@pixelherodev @RL_Dane
Yeah, that was mostly to address to the people who don't think there are ethical issues; basically it was a "don't argue the ethics with me; even without factoring that in it's a bad idea."

RL_Dane,
@RL_Dane@fosstodon.org avatar

@benjaminhollon @pixelherodev

GET THEE BEHIND ME, Silicon Valley! ^___^

pixelherodev,

@RL_Dane @benjaminhollon Basically, computers are REALLY FUCKING FAST. Even a rpi3, or the pbp, or...

I figure that I want to actually make use of a tiny fraction of that performance for something I consider far more meaningful than the ways it's usually used.

I'd probably use my garbage collection library for this, and implement it in C, but configured to effectively run a GC pass either every ten minutes or when an allocation would otherwise cause an OOM, to avoid wakeups.

RL_Dane,
@RL_Dane@fosstodon.org avatar

@pixelherodev @benjaminhollon

Why would you want a typed shell, though?
Everything-as-strings isn't fast, but it makes a lot of things easy.

pixelherodev,

@RL_Dane @benjaminhollon Because in my design everything STILL IS A STRING.

It's just that strings can be automatically converted to other types as needed by context.

Try using it as a number? It's parsed. Try using it as a tuple of a date, a duration, and a distance? It's tokenized and each field is parsed. Try using it as a type which can be derived from a (date, duration, distance)? It's first converted to the 3-tuple, then that's converted to the final type.

etc etc

RL_Dane,
@RL_Dane@fosstodon.org avatar

@pixelherodev @benjaminhollon

Sounds like you're inventing TCL, mon ami ;)

(At least from the quasi-typed string aspect of it)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • tacticalgear
  • DreamBathrooms
  • ethstaker
  • InstantRegret
  • Youngstown
  • magazineikmin
  • osvaldo12
  • slotface
  • khanakhh
  • rosin
  • kavyap
  • everett
  • thenastyranch
  • ngwrru68w68
  • megavids
  • GTA5RPClips
  • cisconetworking
  • mdbf
  • cubers
  • Durango
  • anitta
  • modclub
  • normalnudes
  • tester
  • Leos
  • provamag3
  • JUstTest
  • lostlight
  • All magazines