From bcbcbce31d1c641a5197556f2a788a5ce0c652f0 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Sun, 19 Feb 2023 11:02:44 +0100 Subject: [PATCH] Reformat, add wget for webdav --- pages/04.other/useful-commands/default.en.md | 48 ++++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/pages/04.other/useful-commands/default.en.md b/pages/04.other/useful-commands/default.en.md index 6ee8369..7e73943 100644 --- a/pages/04.other/useful-commands/default.en.md +++ b/pages/04.other/useful-commands/default.en.md @@ -1,12 +1,17 @@ --- -title: 'Useful Commands' +title: "Useful Commands" visible: true --- [toc] + ## Imagemagick + ### Splitting PDF files -`$ convert -density 600 (input.pdf) -crop 50x100% +repage (out.pdf)` + +```sh +$ convert -density 600 {INPUT.PDF} -crop 50x100% +repage {OUT.PDF} +``` ``` -density: adjusts the quality of the resulting pdf. Higher values look better, but take longer to process @@ -14,20 +19,43 @@ visible: true ``` ## Find + ### Change filtered permissions + Using find with its `exec` switch one can set different permissions based on the usual find filters. -One example would be only changing file or directory permissions. -`$ find (directory) -type f -exec chmod 744 {} +` -Replacing `-type f` with `-type d` would execute the `chmod` for directories instead. +One example would be only changing file or directory permissions. + +```sh +$ find (directory) -type f -exec chmod 744 {} + +``` + +Replacing `-type f` with `-type d` would execute the `chmod` for directories instead. ## Various + ### Overwrite disk with pseudorandom data + Using openssl on CPUs with AES acceleration one can create pseudorandom data with high speeds. -Much faster than `/dev/urandom` at least -`# openssl enc -aes-128-ctr -md sha512 -pbkdf2 -nosalt -pass file:/dev/urandom < /dev/zero | pv > (target disk)` -Around 2GiB/s on my Ryzen 7 1700x if output to `/dev/null` +Much faster than `/dev/urandom` at least + +```sh +# openssl enc -aes-128-ctr -md sha512 -pbkdf2 -nosalt -pass file:/dev/urandom < /dev/zero | pv > {TARGET DISK} +``` + +Around 2GiB/s on my Ryzen 7 1700x if output to `/dev/null` ### Formatted csv in terminal -> [From Pretty CSV viewing on the Command Line](https://www.stefaanlippens.net/pretty-csv.html) -`$ column -t -s, < (file.csv)` +> [From Pretty CSV viewing on the Command Line](https://www.stefaanlippens.net/pretty-csv.html) + +```sh +$ column -t -s, < {FILE.CSV} +``` + +### Download directory from webdav + +Using `wget`, it's possible to download directories recursively from WebDAV. + +```sh +$ wget -r -nH -np --cut-dirs=1 --user={USERNAME} --password={PASSWORD} https://WEBDAVHOST/DIR/DIR +```