|
prisoner of waffles posted:tef or others, can you think of any others that might make the list? https://www.mkssoftware.com/docs/man1/ls.1.asp quote:ls [-AabCcdFfghikLlmnopqRrstux1] [-timeout seconds] [-X attr] [pathname...]
|
# ? Sep 5, 2018 17:06 |
|
|
# ? Dec 3, 2024 16:57 |
prisoner of waffles posted:git has to be among the top 10 command line programs for sheer complexity of the possible valid command-line inputs. find has a ton of options which I've seen used in fairly creative ways. sed always seems to have a bunch of interesting and obscure uses, too. And of course awk can be used for all kinds of things but that one might be cheating because awk is basically a full programming language.
|
|
# ? Sep 5, 2018 17:18 |
|
isn't sed also turing-complete e: yes http://www.catonmat.net/blog/proof-that-sed-is-turing-complete/ looks like ls is actually not turing-complete, tho
|
# ? Sep 5, 2018 17:24 |
|
NihilCredo posted:yeah, we have f# and c# script files (actually f# scripting predates powershell by a year), they're way better than pshell for writing scripts longer than two lines. akadajet posted:people say this, but i've never seen anybody use f#
|
# ? Sep 5, 2018 17:26 |
|
My favorite man git page used to be git-rebase, until they changed it.quote:git-rebase - Forward-port local commits to the updated upstream head lmao that's like 90% git-specific jargon
|
# ? Sep 5, 2018 17:28 |
bob dobbs is dead posted:isn't sed also turing-complete Neat! I actually think find is probably Turing complete too. The reason I specifically called out awk there because it was designed to be more of a full programming language than the other two. E.g. from the man page: quote:The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation.
|
|
# ? Sep 5, 2018 17:28 |
|
Incidentally, I think one thing Powershell has really done a good job of proving is that piping objects between commands works much better than piping text. It's too bad there haven't been any serious efforts to make something like powershell but statically typed (for some reason it seems like whenever people try to make shell-like environments for other programming languages, they are determined to stick to piping around text whenever possible).
|
# ? Sep 5, 2018 17:30 |
|
mystes posted:Incidentally, I think one thing Powershell has really done a good job of proving is that piping objects between commands works much better than piping text. It's too bad there haven't been any serious efforts to make something like powershell but statically typed (for some reason it seems like whenever people try to make shell-like environments for other programming languages, they are determined to stick to piping around text whenever possible). A static-typed shell env would own. That being said, wasn't the lovely WinFS sort of headed in that direction? IIRC, they were going towards an object-oriented file system and a statically typed scripting lang would've actually worked pretty well in that OOP hellscape. Tangentially, I can't find the WinFS schema disgram, as it was a truly impressive example of enterprise software design. This blog post inadvertantly illustrates how bad this was: https://blogs.msdn.microsoft.com/winfs/2005/09/08/visualizing-winfs-types/
|
# ? Sep 5, 2018 17:35 |
|
wondering if i can get some feedback on a recent phone interview for the interview i wrote a moving average class. it has a circular buffer where (assuming a full buffer) the oldest sample is overwritten as a new sample is written in: code:
the interviewer also asked how to return the minimum-valued sample in the averaging window in < lg(n) time. I suggested keeping a binary search tree alongside the circular buffer and performing the same deletes/overwrites to it along with the array. i'm not sure if that's a good answer now since i just read that "classic" binary search trees can't have duplicates. the interviewer also seemed to suggest that only a binary search tree was necessary to solve the problem (not both a buffer and tree), but i can't seem to figure out how that would work. thoughts on the above? nothing like interviews to make you feel dumb
|
# ? Sep 5, 2018 17:36 |
|
lots of static typed langs have a repl and a command api
|
# ? Sep 5, 2018 17:37 |
|
e: argh beaten ^ does anything meaningful differentiate what we think of as a shell from a language REPL?
|
# ? Sep 5, 2018 17:37 |
|
the rare good shitpost from r/programming: a PCRE regex that matches "A B C" where A+B=C https://regex101.com/r/YCTmCs/3
|
# ? Sep 5, 2018 17:40 |
|
DONT THREAD ON ME posted:e: argh beaten ^ In my mind, it should provide a simple interface to your host environment. REPLs don't really do that? I mean, you could argue that a REPL provides this, but in c#, for example, it takes multiple lines of code to start up a process and I wouldn't want to type System.Process.Start("turd --help") or whatever just to get help with the turd tool.
|
# ? Sep 5, 2018 17:42 |
|
hosed up that they called it detached head and not dullahan mode
|
# ? Sep 5, 2018 17:44 |
|
meatpotato posted:wondering if i can get some feedback on a recent phone interview you can make your BST and your buffer cotenant by either using the buffer as the backing storage for BST nodes or having your BST nodes include prev/next links to embed a doubly-linked list since you're eating lg(n) inserts anyways you might as well use a min-heap to get worst-case lg(n) insert and constant-time minimum retrievals
|
# ? Sep 5, 2018 17:45 |
|
ulmont posted:ls [-AabCcdFfghikLlmnopqRrstux1] [-timeout seconds] [-X attr] [pathname...] It's the most remarkable word I've ever seen!
|
# ? Sep 5, 2018 17:51 |
|
gonadic io posted:lots of static typed langs have a repl and a command api There are some repl environments for python that are sort of the right idea, but what I really want is something similar for a statically typed language that has good type inference. Also, I want proper tab completion in the shell. I'm not aware of anything right now that checks all these boxes. I think c# could be made to work but I don't think the current repls are suitable right now.
|
# ? Sep 5, 2018 17:52 |
|
animist posted:the rare good shitpost from r/programming: a PCRE regex that matches "A B C" where A+B=C
|
# ? Sep 5, 2018 17:54 |
|
mystes posted:It's mostly an issue of ergonomics. It's pretty inconvenient to do simple shell-script like stuff in most languages. Powershell is cool because just poking around in directories, moving stuff, etc. is just as fast as in bash. it would not be that difficult to design some sort of shell prelude that makes f#/haskell feel a lot like bash but with types. might be kinda fun to try it in rust.
|
# ? Sep 5, 2018 17:57 |
|
mystes posted:It's mostly an issue of ergonomics. It's pretty inconvenient to do simple shell-script like stuff in most languages. Powershell is cool because just poking around in directories, moving stuff, etc. is just as fast as in bash. This is build with that in mind, tab completion would depend on your editor though as it's regular haskell types http://www.haskellforall.com/2015/01/use-haskell-for-shell-scripting.html?m=1
|
# ? Sep 5, 2018 18:01 |
DONT THREAD ON ME posted:it would not be that difficult to design some sort of shell prelude that makes f#/haskell feel a lot like bash but with types. It already exists: https://hackage.haskell.org/package/turtle e: dammit gonadic io!
|
|
# ? Sep 5, 2018 18:03 |
|
Or there's http://ammonite.io/ for scala
|
# ? Sep 5, 2018 18:04 |
|
gonadic io posted:This is build with that in mind, tab completion would depend on your editor though as it's regular haskell types
|
# ? Sep 5, 2018 18:12 |
|
mystes posted:I haven't tried Turtle but it seems to just be oriented around running unix commands. I guess maybe I should try it because at the least that would make it easier to explain why it's not what I'm looking for. 1) what else do you want from a shell I'm confused 2) if you want to do text processing or something that's not running a single unix command you have all regular haskell functions at your fingertips or did you mean windows? I'm not sure Gabriel is aware that windows exists no idea if it works there or not
|
# ? Sep 5, 2018 18:19 |
|
VikingofRock posted:e: dammit gonadic io! don't test me on my monadic io
|
# ? Sep 5, 2018 18:20 |
mystes posted:I haven't tried Turtle but it seems to just be oriented around running unix commands. I guess maybe I should try it because at the least that would make it easier to explain why it's not what I'm looking for. It's more of a reimplementation of common unix commands' core functionalities, and instead of just doing text transformations it has Haskell's type system. So really I'd say it's less "Turtle is oriented around running unix commands" and more "Turtle often names its functions after similar Unix commands". I've never used Turtle interactively as my main shell or anything, but I've used it to write what would have been medium-length shell scripts and it's pretty nice for that.
|
|
# ? Sep 5, 2018 18:22 |
|
FamDav posted:you can make your BST and your buffer cotenant by either using the buffer as the backing storage for BST nodes or having your BST nodes include prev/next links to embed a doubly-linked list drat, ive literally never thought about mingling different types of data structures like that. that's eye-opening stuff, thank you. maybe one day i won't be a terrible programmer. just to make sure i understand, here's a breakdown of how i think each solution you mentioned could work. mind double-checking my understanding? 1. BST uses circular buffer as backing storage for its nodes - use a classic 'bst_node' type containing left/right 'bst_node' pointers and a value - circular buffer stores 'bst_node' types instead of naked values - (assuming a full buffer) writes delete a node and insert a new node. bst property is enforced on deletes and inserts. - time complexity typical case lg(n), but worst O(n) for find minimum, inserts and deletes. 2. BST nodes include prev/next links to embed a doubly-linked list - No circular buffer involved, only using the modified bst now - modified 'bst_node' type has a value and 'bst_node' pointers for left, right, prev, next - keep list head and tail pointers - (assuming number of stored nodes is equal to the window size) add_sample drops the list head, appends to the tail. bst property enforced on inserts and deletes. - time complexity typical case lg(n), but worst O(n) for find minimum, inserts and deletes. 3. use a min-heap - Similar to #2 but using a min-heap embedding a doubly-linked list instead of a BST embedding a doubly-linked list - Constant-time minimum lookups, average constant-time inserts and deletes, worst-case lg(n) inserts and deletes.
|
# ? Sep 5, 2018 18:22 |
|
meatpotato posted:drat, ive literally never thought about mingling different types of data structures like that. that's eye-opening stuff, thank you. maybe one day i won't be a terrible programmer. not to belittle the rest of your point but people that know these datastructure/interview tricks are still terrible programmers like the rest of us. some of this stuff took 10+ years for researchers to figure out and you can onyl really do it if you knew in advance so people that ask this in interviews are terrible too unless youre job is to write an actual compiler stdlib. good interviews questions are stuff like: client asks for x give me a minimal working implementation here's your ide and your google let's pair.
|
# ? Sep 5, 2018 18:27 |
|
gonadic io posted:not to belittle the rest of your point but people that know these datastructure/interview tricks are still terrible programmers like the rest of us. some of this stuff took 10+ years for researchers to figure out and you can onyl really do it if you knew in advance so people that ask this in interviews are terrible too unless youre job is to write an actual compiler stdlib. oh, for sure --i slaved for four years in the code mines gluing simple pieces of code together and did an okay job at it without using much of anything from a data structures and algorithms class i unironically got excited when i realized you could embed two data structures to order/arrange the same data in memory different in ways. it should have been obvious, but like you said, a lot of this stuff took decades to figure out. i think it's good to feel some occasional enjoyment from this interview prep poo poo because a lot of it is boring as gently caress
|
# ? Sep 5, 2018 18:40 |
|
meatpotato posted:i think it's good to feel some occasional enjoyment from this interview prep poo poo because a lot of it is boring as gently caress yes I agree I enjoy programming lots and it's great when people get excited about stuff I didn't mean to harsh your "this is neat" buzz
|
# ? Sep 5, 2018 18:41 |
|
I am a user who always used hg but has been forced to use git out of tiredness of assholes asking to migrate all the things to git and github. It ended up being easier to to just switch than use software I like and think is good because of network effects and it is loving bad also the command I can never use without doc is any of 'find' or 'tar' (if tar -xvf <tar.gz file> won't cut it) E: I use find * | grep <pattern I am looking for>
|
# ? Sep 5, 2018 19:32 |
|
meatpotato posted:3. use a min-heap since you only add and remove samples from the ends of the embedded list, you can use singly-linked nodes and just keep two pointers for head and tail outside the min-heap
|
# ? Sep 5, 2018 19:48 |
|
ah, that's true for #2, using a linked-list embedded in a BST, as well, isn't it?
|
# ? Sep 5, 2018 19:49 |
|
oh yeah for sure
|
# ? Sep 5, 2018 19:50 |
|
man that's such a hard problem for an interview imo. i mean, give me a few hours and some loving space and i'll work through it and come up with a good solution but there's no way i'd get through that under pressure.
|
# ? Sep 5, 2018 19:51 |
|
MononcQc posted:I am a user who always used hg but has been forced to use git out of tiredness of assholes asking to migrate all the things to git and github. It ended up being easier to to just switch than use software I like and think is good because of network effects and it is loving bad ack-grep, silver surfer (ag-grep), ripgrep pick one (ripgrep is your default, it's fastest) tar is kind of a pain bob dobbs is dead fucked around with this message at 21:12 on Sep 5, 2018 |
# ? Sep 5, 2018 21:10 |
|
OK, I tried turtle. Finding the total size of the most recent 5 files in powershell and turtle (admittedly I suck at haskell so the haskell version is probably not the best solution). Powershell: code:
code:
|
# ? Sep 5, 2018 21:18 |
|
What i want wrt powershell is linq syntax. something like (dir).OrderByDescending(i=>i.LastWriteTime).Take(5).Sum(i=>i.length)
|
# ? Sep 5, 2018 21:24 |
|
meatpotato posted:wondering if i can get some feedback on a recent phone interview decent answers imo you could keep a range minimum query table updated with ln(n) time per insertion, not too hard to code in c for o(1): keep a double-ended queue of (position, value) pairs that will have two invariants - from oldest to newest value - from lowest to highest value when you insert a new sample - pop the oldest sample off the start if it's too old - pop all values bigger than this value off the end - they will drop off before the new value, so they can never be the minimum - insert the new value id visualize it by considering the two cases of always-increasing and always-decreasing samples - for always-decreasing we can just throw away the old samples, for always-increasing we need to keep them stacked away until it's their time to be the minimum
|
# ? Sep 5, 2018 21:35 |
|
|
# ? Dec 3, 2024 16:57 |
|
Finster Dexter posted:My favorite man git page used to be git-rebase, until they changed it. git-start-stash is pretty good: quote:start any non-forward-ported upstream stashes to various annotated non-named local indices
|
# ? Sep 5, 2018 21:54 |