rust_cmd_lib
Packagist
rust_cmd_lib | Packagist | |
---|---|---|
11 | 61 | |
991 | 1,712 | |
- | 0.2% | |
8.0 | 9.0 | |
5 months ago | 19 days ago | |
Rust | PHP | |
Apache License 2.0 | 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.
rust_cmd_lib
- Was Rust Worth It?
-
Execute $(command) in std::process::Command?
With rust_cmd_lib, you can write below code without launching shell:
-
How to do things safely in Bash
zsh is also doing the variable substitution better than bash. FYI, I just released rust_cmd_lib 1.0 recently, which can do variable substitution without any quotes: https://github.com/rust-shell-script/rust_cmd_lib
- cmd_lib: v1.0 released!
-
Process file in parallel
With cmd_lib and rayon, it could be done in below one line code:
-
Using rust cmd_lib to replace your bash scripts!
#!/usr/bin/env ngs # In response to https://github.com/rust-shell-script/rust_cmd_lib/blob/1f2fc2303db3f467c42589bd944b31834c8a0bca/examples/dd_test.rs # $ ./dd_test.ngs --file /dev/nvme0n1 --block_size 4096 --threads_count 4 # [LOG 2021-03-20 10:57:14 IST] Dropping caches at first # [LOG 2021-03-20 10:57:14 IST] Running command: sudo bash -c echo\ 3\ \>\ /proc/sys/vm/drop_caches # [LOG 2021-03-20 10:57:15 IST] Running with threads: 4, block size: 4096 # [LOG 2021-03-20 10:57:15 IST] Running command: sudo bash -c dd\ if=/dev/nvme0n1\ of=/dev/null\ bs=4096\ skip=1310720\ count=655360\ 2\>\&1 # [LOG 2021-03-20 10:57:15 IST] Running command: sudo bash -c dd\ if=/dev/nvme0n1\ of=/dev/null\ bs=4096\ skip=655360\ count=655360\ 2\>\&1 # [LOG 2021-03-20 10:57:15 IST] Running command: sudo bash -c dd\ if=/dev/nvme0n1\ of=/dev/null\ bs=4096\ skip=1966080\ count=655360\ 2\>\&1 # [LOG 2021-03-20 10:57:15 IST] Running command: sudo bash -c dd\ if=/dev/nvme0n1\ of=/dev/null\ bs=4096\ skip=0\ count=655360\ 2\>\&1 # [LOG 2021-03-20 10:57:22 IST] thread 0 bandwidth: 450 MB/s # [LOG 2021-03-20 10:57:22 IST] thread 1 bandwidth: 451 MB/s # [LOG 2021-03-20 10:57:22 IST] thread 2 bandwidth: 453 MB/s # [LOG 2021-03-20 10:57:22 IST] thread 3 bandwidth: 451 MB/s # [LOG 2021-03-20 10:57:22 IST] Total bandwidth: 1805 MB/s # Command line arguments automatically fed into main() # Default data size - 10G F main(file:Str, block_size:Int=4096, threads_count:Int=1, data_size:Int=10 * 1024 * 1024 * 1024) { log("Dropping caches at first") $(log: sudo bash -c "echo 3 > /proc/sys/vm/drop_caches") log("Running with threads: ${threads_count}, block size: ${block_size}") # Parallel map: each callback runs in it's own thread cnt = data_size / threads_count / block_size results = threads_count.pmap(F(i) { off = cnt * i `log: sudo bash -c "dd if=$file of=/dev/null bs=$block_size skip=$off count=$cnt 2>&1"` }) total_bandwidth = 0 results.each_idx_val(F(i, output) { # "line:" makes the first line of output as the result of `...` bandwidth = `echo $output | line: awk '/MB/ {print $10}'`.Int() log("thread ${i} bandwidth: ${bandwidth} MB/s") total_bandwidth += bandwidth }) log("Total bandwidth: $total_bandwidth MB/s") } # When running without arguments F main() { # exit() - exit code is 1 unless otherwise specified exit("Usage: ${ARGV0} --file FILE [--block_size BLOCK_SIZE] [--threads_count THREADS_COUNT] [--data_size DATA_SIZE]") }
- Release v0.12.0 · rust-shell-script/rust_cmd_lib
-
Convert tetris.sh and pipes.sh line-by-line to rust code
Thanks for the inspiration from previous posts, and I tried to convert pipes.sh to rust code today. It turned out to be very straightforward with the help of rust_cmd_lib, and your can check both language versions in the project examples directory.
-
rust_cmd_lib v0.10: to write shell-script like tasks in a clean, natural and rusty way
Yes, your concern is correct and that's why I encourage people to use macros by default: https://github.com/rust-shell-script/rust_cmd_lib#security-notes
Packagist
-
Get YouTube Channel Details API: Testing Connection
What will we do next time? Actually, the whole package is ready, and all that's left is to publish it on Packagist.
-
Building Python Package: API Client for YouTube Channel Details (RapidAPI)
publishing our work on https://packagist.org/
-
Shopware Changes since the 6.0 Dev Training Videos
The latter one is based on nix OS using Symfony flex recipes and PHP packagist composer. The flex devenv should work cross-platform on Linux, Windows, and Mac. "The main difference to other tools like Docker or a VM is that it neither uses containerization nor virtualization techniques. Instead, the services run natively on your machine."
-
Have an interview for PHP, any tips on where to start?
Composer is (still) the defacto standard package manager, with the Packagist repo being the standard place to find and install libraries.
-
Was Rust Worth It?
Sorta—it looks like they were most enforced by convention until May 2015, when they finally become enforced [0]. Still, that's a good one that I hadn't thought of, and they at least had the convention in place.
[0] https://github.com/composer/packagist/issues/163#issuecommen...
-
Best practices for building a production-ready Dockerfile for PHP applications
Scanning your image for vulnerabilities is a critical step before you deploy it to production. You can use Snyk to scan your PHP Docker image and identify and resolve vulnerabilities. The Snyk Vulnerability Database includes records for all popular operating systems and dependencies, including PHP packages published to Packagist.
-
laravel is apple and symfony is android, your own framework is linux distro buit by you
No. The only linked commercial thing I know - is Nova admin panel interface lib. But you don't have to use it. (Filament or Encore are free and suitable). Modules are free ( packagist.org and gthub.com ) and you should handle them with standard composer package tool. But you need to code. It is not WordPress like CMS
-
How to tame a language
Once you understand the underlying principles of a concept, you're free to find a library via packagist.org to use.
-
New to PHP - I'm actually impressed
For strings I use Stringy (https://github.com/danielstjules/Stringy) for arrays I built my own Collection library, but pretty sure there are plenty in packagist (https://packagist.org/)
-
Google Drive API, PHP discontinued.
I guess I tried downloading a old version. and have to download a newer version of apiclient I found on https://packagist.org/packages/google/apiclient with monolog/monolog: ^2.9||^3.0. I'll try that in a second, I am away from computer now.
What are some alternatives?
PowerShell - PowerShell for every system!
Laravel-Zero - A PHP framework for console artisans
shellharden - The corrective bash syntax highlighter
WordPress Packagist - WordPress Packagist — manage your plugins with Composer
makesure - Simple task/command runner with declarative goals and dependencies
Laravel 6 - Powerful REPL for the Laravel framework.
scripts - Useful scripts that I find handy to work with
Bingo Functional - A simple functional programming library for PHP
pipe-trait - Make it possible to chain regular functions
Symfony Panther - A browser testing and web crawling library for PHP and Symfony
shellclear - Secure shell history commands by finding sensitive data
LaravelS - LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.