forkrun
v2-tooling
forkrun | v2-tooling | |
---|---|---|
18 | 6 | |
136 | 3 | |
- | - | |
9.7 | 7.9 | |
7 days ago | about 1 year ago | |
Shell | Shell | |
MIT License | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
forkrun
- Forkrun: Runs multiple inputs through a command in parallel using bash coprocs
- Forkrun – A pure-bash function for parallelizing loops
-
rparse: an easy-to-use shell script/function option parser that uses regex to determine which inputs are options
EDIT: moved code + example to GITHUB
-
[BASH] Can I use procfs to change the file that a backgrounded process is writing data to?
One example that I dont know how to do streaming for involves breaking up the stdin stream and sending it to different places, but where you determine where to send it in realtime. This isnt the code that spawned this particular thread, but a good example of this is in this function I wrote called forkrun.
-
Optimizing bash scripts?
If you want an example of a really optimized bash script check out my forkrun utility. I spent a really long time optimizing it. It parallelizes loops (like xargs -P and parallel), and for problems with "many very quick iterations" (e.g., sha256sum of a million tiny files) it is twice as fast as the fastest method available via xargs or parallel (which means it is outpacing well optimized compiled C/C++ binaries).
-
Bash continuous parallelization
as it so happens, I recently wrote a script called forkrun that parallelizes loops really fast. In particular for things like your simulation that require running 1 at a time in parallel (N parallel batches of 1 simulation, as opposed to N parallel batches of M simulations) the parallelization framework itself is 7x faster than xargs -l 1 -P N and ~25x faster than parallel -j N.
-
Globals or not globals?
However, if you have bash 4 or later, using bash coprocs can offer much better performance. The idea is that you spawn a bunch of persistent coprocs and pipe data to them, allowing you to parallelize the loop without forking each individual iteration. I wrote / am writing a utility called forkrun that parallelizes loops using bash coprocs. You're welcome to use it, though heads up it is still in beta (almost everything works, but I am still debugging the -k flag sometimes not working properly...-k ensures the output order is the same as input order). If nothing else it gives a real world example of parallelizing using coprocs.
-
Can you force bash to not give a throw a specific error?
Side note: in case you were wondering the actual code that inspired this post is my forkrun utility. If you felt like checking it out Id love to hear any feedback you might have on it.
-
Out of curiosity, what is your best script you can showcase?
For me? My personal best script is (by a wide margin) my forkrun utility. It uses bash coprocs to efficiently parallelize loops. Usage is nearly identical to xargs -P <#>. Options are similar to xargs....a few are missing (namely those related to running things interactively), and a few options are things xargs doesnt do but forkrun can.
-
How can I run commands in parallel and write the output of each command to different linux terminals, one linux terminal for each command running in parallel.
I wrote a nifty function for parallelizing loops in bash really fast called forkrun. It will, with the help of tail -F, let you do this (among many other things) by writing the output from each parallel worker to a separate file, which you can then monitor in real time with tail -F in another terminal window.
v2-tooling
-
Double dashes for options are replaced by "–" by pandoc, how to fix it?
Here is my makefile and there is my man page.
-
Parser for Command Line Interface Pages is ready for usage
This parser is completely Bash + Sed-based. It allows extracting info about page easily and not to deal with Sed directly, delegating such business for a parser. As parser doesn't built AST, it's a little bit limited.
-
Why `intcmp` returns empty string instead of 0 when numbers are equal?
Thanks! I just expected to see an error if some undefined function is called. Here is how I solved my issue, just delegated integer comparison to the shell.
-
Globals or not globals?
Recently, I've implemented my first parser in Bash. It works, but the problem is how slow it works on thousands of files. One of the issues that almost all functions accepts some page as an input and produce some output, which means that they reparse the same page too many times. I don't use global variables now to cache parsed results to use them later. Its speed is not a big issue when just using it for small amount of files.
-
I've implemented working parser in Bash + Sed from the ground and wrote unit tests for it
No. Here it is https://github.com/command-line-interface-pages/v2-tooling/pull/60
What are some alternatives?
pkm - A super minimal TUI package manager wrapper written in BASH v4.2+
bin - my bins (mostly shell scripts)
resholve - a shell resolver? :) (find and resolve shell script dependencies)
dyetide - a bash script that replaces hex, rgb, or hsl color codes out for other color codes. either within a file or from the terminal!
dun - Meeting notes and todo tasks CLI
fml - :card_index_dividers: A stupid simple, fast TUI file manager written in BASH v4.2+
wgs - A minimal wallpaper getter setter written in pure BASH
nvm - Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
arg - usage: arg [...args]; output: (count of args):(len of args) (...quoted arguments)
jq - Command-line JSON processor [Moved to: https://github.com/jqlang/jq]
pueue - :stars: Manage your shell commands.