8 ms·
Regex2fat: Turn your favorite regex into FAT32
- sonofgod 6y ago/A/A/A/A/A/A/A/A/A/A/A/A/A/H/H/H/H/MATCH
- duskwuff 6y agoThis is a horrifying abuse of a filesystem, and I love it.
- bryan_w 6y agoThis reminds me of that Lewis black bit, "If it weren't for my horse, I never would have spent that year in college". I saw the words, but my brain couldn't process them, no matter how many times I tried. If I die of an aneurysm, regex2fat will probably be the reason why
- TeMPOraL 6y agoI don't understand, what's the deal with that Lewis sentence? It seems pretty straightforward to parse. I read it as: if(!somethingAboutMyHorse) { // ? Road not taken. } else { //Spend a year in college. }
- nathancahill 6y agoThe horse raced past the barn fell.
- ssalazar 6y agoNever heard this before but despite being grammatically sound, I guess the events that would lead to someone truthfully saying it are meant to defy reason.
- Dylan16807 6y agoThere's a hundred things a pet can do that might cause inspire you to change your decision about college. I don't understand how it defies reason or is even confusing.
- projektfu 6y agoWithout being able to process the words in some way, put them into context, it can cause an aneurism to rupture in his brain.
- Ericson2314 6y agoThe were not and never cancel out, so remove the negation. The subjective asserts the horse thing was necessary, not merely sufficient, so be sure there is no college in the other branch. Also throw on some asserts as the non-horse non-college possible world is not the real one. In other words, imperative pseudo-code is a poor substitute for some temporal and possible-world modal logic.
- nl 6y agoYeah I didn't get it either. There's an explanation on Reddit[1] which basically says that there's no logical explanation for why having a horse should have led to a year in college. I was looking for some kind of grammatical trick, and judging by some of the replies here I'm not alone. [1] https://www.reddit.com/r/OutOfTheLoop/comments/1twwao/why_is_if_it_wasnt_for_my_horse_i_wouldnt_have/cecijq2/ https://www.reddit.com/r/OutOfTheLoop/comments/1twwao/why_is...
- bryanrasmussen 6y agoI think he made a mistake, it should have been "if it weren't for my horse I would have spent more than that year in college." English can be tricky that way.
- m463 6y agoI have to say that made me think of this really old game called Leisure Suit Larry. In one scene, he is sitting in a bar and an NPC sits next to him on a barstool and the dialog just spits out punchlines with no context. "...and there stood the pig and the cow!"
- yjftsjthsd-h 6y ago> Q: Should I use this in production^w^w anywhere? > A: No, but I can't stop you. The motto of so many of the best projects:)
- vunuxodo 6y agoWorry not, there's already a pull request fixing this obvious deficiency. Ah, the beauty of free software. https://github.com/8051Enthusiast/regex2fat/pull/2 https://github.com/8051Enthusiast/regex2fat/pull/2
- superasn 6y agoWhat happens if I my regex contains aux.h?
- the8472 6y agoAdd the file namespace prefix https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-file-namespaces https://docs.microsoft.com/en-us/windows/win32/fileio/naming...
- klodolph 6y agoIt will show up as something like /A/U/X/DOT/H
- tenebrisalietum 6y agoI think the filesystem supported naming files PRN, CON, AUX, LPT, COM1, etc. just fine, it's just DOS wouldn't let you "get to" them because it (and by "it" I'm not sure if COMMAND.COM or lower level DOS functions) parsed those characters as special devices. I think you could make those files manually in a disk or sector editor just fine, and it might even show up in DIR, but of course accessing them via normal DOS usage would be hard if not impossible.
- superasn 6y agoIDK man, I've switched to Linux but it wouldn't let me delete aux.h using windows explorer IIRC. But it was a long time ago so not sure.
- sunsu 6y agoAll In: "Haha OS-driven regex engine go brrrrr"
- nayuki 6y agoIndeed, a current meme. https://knowyourmeme.com/memes/money-printer-go-brrr https://knowyourmeme.com/memes/money-printer-go-brrr
- theandrewbailey 6y agoIf this was made as a joke (yes?), that's a pretty good punchline.
- jimrandomh 6y agoI think this could also be built out of symlinks in a Linux filesystem. This would be slightly more practical (though, of course, still not practical at all).
- gumby 6y ago“Slightly more expressive” as you can create longer filenames with most Linux filesystems and more entries too. I like that phrase as it sounds like “better” when we’re talking about, as you say, something wonderfully useless.
- Dylan16807 6y agoAs long as you don't mind the depth limit of 40 symlinks on Linux and I think 31 on Windows.
- mappu 6y ago/include/linux/namei.h:13 #define MAXSYMLINKS 40 Only takes one recompile to raise the limit - someone's next project can be regex2symlinks-in-a-bootable-initramfs.
- acheron 6y agoNow you have... quite a few problems.
- deleted 6y ago[deleted]
- Aloha 6y agoThis strikes me as a project that was created while drunk or high, probably high, possibly both.
- elteto 6y agoHe must have reached Ballmer’s Peak (https://xkcd.com/323/ https://xkcd.com/323/)
- asdfman123 6y agoI don't know about you, but some of us can generate a rich stream of dumb and useless ideas without the aid of substances.
- Aloha 6y agoI can generate those ideas sober just fine, its the doing them part that requires the substances.
- deleted 6y ago[deleted]
- buildbot 6y agoThis is hilarious! I was excited hoping that it was a fuse file system that let you mount a view of another file system with regex though, something that would be a pretty useful tool.
- fit2rule 6y agoI also wondered the same .. if it weren't some generalised way to apply regex to implement FAT32 (read and write) .. instead I think its a mapping of DFA to dentry semantics. Still pretty neat.
- rwmj 6y agoIf you think this is crazy, check out the VVFAT driver in qemu[1]. At first sight it seems simple enough - turn a host directory into a virtual FAT filesystem which is presented to the guest. The clever/insane thing is it supports writes. It is able to "reverse" those block level operations from the guest to modify the source filesystem on the host. It was written by the ever exceptional Fabrice Bellard. EDIT: No it wasn't, it was written by Johannes Schindelin, thanks for the clarification in replies. [1] https://github.com/qemu/qemu/blob/master/block/vvfat.c https://github.com/qemu/qemu/blob/master/block/vvfat.c
- beholder1 6y agoI see another name as author and no trace of Fabrice in history. Can you elaborate please?
- loeg 6y agoQEMU itself came from Bellard originally, but I believe you are correct that the RO and RW vvfat support came from Johannes Schindelin: https://github.com/qemu/qemu/commit/de167e416fa3d6e4bbdcac90973954c6bfae3070 https://github.com/qemu/qemu/commit/de167e416fa3d6e4bbdcac90... https://github.com/qemu/qemu/commit/a046433a161a1f554be55df8421d92cbdc52779f https://github.com/qemu/qemu/commit/a046433a161a1f554be55df8...
- lifthrasiir 6y ago> It was written by the ever exceptional Fabrice Bellard. I think it is rather by Johannes Schindelin [1]. [1] https://github.com/qemu/qemu/commit/de167e416fa3d6e4bbdcac90973954c6bfae3070#diff-90db5d22c672cc11fc524bf481313364 https://github.com/qemu/qemu/commit/de167e416fa3d6e4bbdcac90...
- yellowapple 6y agoOn the other hand, I don't think we've ever seen Fabrice Bellard and Johannes Schindelin in the same room together.
- Rokid 6y agoWhat is this? I'm so curious but nothing of this rings a bell with me. I mean I know what a regular expression is, and I've formatted several USBs to FAT32, but DFAs and everything in between have me Googling like crazy, still in the dark though.
- slondr 6y agoRegExp and DFAs are the same computation class, so it's useful sometimes to model them as each other.
- Pmop 6y agoNo idea why you're being downvoted. Also, classical comp. sci technique of reducing your problem into another that's already been solved (with good enough time/mem bounds).
- saagarjha 6y agoIt’s frequently useful, as many regex engines construct DFAs under the hood :)
- burntsushi 6y agoNot as frequent as you might expect! Most regex engines in common use don't use an automata based implementation, and instead use backtracking. This lets them implement additional non-regular features such as backreferences and recursion. Even automata based regex engines don't usually build up a full DFA, since the size of the DFA may be exponential in the size of the regex. Instead, an NFA similation might be used, or a hybrid NFA/DFA that builds the DFA during match time, but typically doesn't build out the full DFA.
- nicholaides 6y agoIt converts your regexp into a virtual filesystem and then you can test if a string matches the regexp by converting the string into a path and testing if that path is contained in the filesystem.
- russtrotter 6y agoI love these kinds of projects! Any description of it that has me cackling by the 2nd sentence is gonna be a gem. Good thing i brought my FAT32 driver.
- deleted 6y ago[deleted]
- a_c 6y agoHey thanks for the project! I (thought I) know what regex is, and I (thought I) know what FAT32 is. But Bamm! putting the two together, the whole sentence makes no sense to me. This is genius.
- wmu 6y agoThere's the first issue: "`regex2fat` is nine characters long" (https://github.com/8051Enthusiast/regex2fat/issues/1 https://github.com/8051Enthusiast/regex2fat/issues/1) :)
- Xenograph 6y agoCould someone explain the joke?
- binarytox1n 6y agohttps://en.wikipedia.org/wiki/8.3_filename https://en.wikipedia.org/wiki/8.3_filename > "A SFN filename can have at most 8 characters before the dot. If it has more than that, the first 6 must be written, then a tilde '~' as the seventh character and a number (usually 1) as the eighth. The number distinguishes it from other files with both the same first six letters and the same extension."
- why-oh-why 6y agoIt's a fat joke.
- m463 6y agoMICROS~1.COM came up with a naming workaround.
- codegladiator 6y agoCan I parse HTML with this ?
- Darkphibre 6y agoI read this first as "Turning your Registry into FAT32" and thought... oh, no. You do not want to do that. Regex though... this is humorous.
- ozzmotik 6y ago>Q: NOOOOOOOOOOO!!! YOU CAN'T TURN A DFA INTO A FAT32 FILE SYSTEM!!!! YOU CAN'T JUST HAVE A DIRECTORY WITH MULTIPLE PARENTS!!! YOU ARE BREAKING THE ASSUMPTION OF LACK OF LOOPERINOS NOOOOOOOOO >A: Haha OS-driven regex engine go brrrrr i absolutely love little toy things like this that probably shouldn't exist but do regardless, and even more so I love it when they close on a silly and playful note like this. this is a rather interesting concept and it reminds me a lot of the idea of glitterbombing from more occult/esoteric circles of the internet (performing acts of obscurity and aloof strangeness to degrade the meaning of consensual reality and expose people to a perspective of life they otherwise would not spend much time engaging in, sorta conceptually similar to Zen koans)
- saagarjha 6y agoIt’s a popular meme format.
- flingo 6y agoGreat. Now someone build one that can compile new regexes in fat32.
- aforty 6y agoLove the readme. haha regex engine go brrrrr
- newbie789 6y agoThis is a very stupid question and I apologize in advance, but could somebody explain to me (as if I were a five year old) what this does? Like literally what does it do? I'm assuming there is a theoretical use case, even if as a toy project just for shits and giggles but I'm completely at a loss.
- saagarjha 6y agoNot sure I can bring it down to the level of a five year old, but here’s something that might help: regular expressions need to be evaluated to see if they match, and how you do that is you build up a state machine called a DFA that essentially looks like “if I see an ‘a’, then I should go to a state that will look for the letters ‘b’ or ‘c’”. What this project does is encode those transitions in the filesystem, so that the states are directories. If you see a particular letter, you basically “cd” into that letter and you’ll be in the next state.
- bryanrasmussen 6y agodid you ever think you wanted your favorite regex as Fat32? Because if you did you have two problems.
- m463 6y agoA while back I had a car stereo that would read USB drives in fat (fat32) format, but it had a terrible user interface, and searching/traversing was a chore. I thought it would be a cool idea to hack the filesystem to allow you to have directories of albums or genres or artists all cross-linking to the same music files. I now see my "big dreams" were actually limited in scope.
- jra_samba 6y agoJames Cain did something similar on Windows using his user-space SMB2 server. https://www.youtube.com/watch?v=tDUL3wEs2ew https://www.youtube.com/watch?v=tDUL3wEs2ew You could also write a Samba VFS module that does the same thing with incoming filenames.