From 705601f0b19fe529e82b09b5916666f66752c7f1 Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 10:06:37 +0200 Subject: [PATCH 1/7] Added parallel (multi-threaded) processing --- cheat/cheatsheets/tar | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cheat/cheatsheets/tar b/cheat/cheatsheets/tar index efa615f..088137a 100644 --- a/cheat/cheatsheets/tar +++ b/cheat/cheatsheets/tar @@ -24,3 +24,8 @@ tar -jtvf /path/to/foo.tgz # To create a .gz archive and exclude all jpg,gif,... from the tgz tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/ + +# To use parallel (multi-threaded) implementation of compression algorithms: +tar -z ... -> tar -Ipigz ... +tar -j ... -> tar -Ipbzip2 ... +tar -J ... -> tar -Ipixz ... From ac445388d98e4362076d23dc88c50b57308d3c05 Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 10:08:42 +0200 Subject: [PATCH 2/7] Keep old configuration during update --- cheat/cheatsheets/apt-get | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheat/cheatsheets/apt-get b/cheat/cheatsheets/apt-get index f46e1ef..b0347ce 100644 --- a/cheat/cheatsheets/apt-get +++ b/cheat/cheatsheets/apt-get @@ -23,3 +23,6 @@ apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" i # Show apt-get installed packages. grep 'install ' /var/log/dpkg.log + +# Silently keep old configuration during batch updates +apt-get update -o DPkg::Options::='--force-confold' ... From 4c2d0d2d8e81e5680c5668a5bc460912452d6b20 Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 10:10:32 +0200 Subject: [PATCH 3/7] Generate Diffie-Hellman parameters --- cheat/cheatsheets/openssl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheat/cheatsheets/openssl b/cheat/cheatsheets/openssl index 74a2511..46b14ed 100644 --- a/cheat/cheatsheets/openssl +++ b/cheat/cheatsheets/openssl @@ -19,3 +19,6 @@ openssl x509 -text -noout -in server.crt echo | openssl s_client -connect :443 2> /dev/null | \ awk '/-----BEGIN/,/END CERTIFICATE-----/' | \ openssl x509 -noout -enddate + +# Generate Diffie-Hellman parameters: +openssl dhparamm -outform PEM -out dhparams.pem 2048 From 8f0d2e9fc3d0bf712b6ab2fe7c724b7c723cd310 Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 10:12:46 +0200 Subject: [PATCH 4/7] Specify output separator character --- cheat/cheatsheets/awk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheat/cheatsheets/awk b/cheat/cheatsheets/awk index dbc670e..14d07de 100644 --- a/cheat/cheatsheets/awk +++ b/cheat/cheatsheets/awk @@ -6,3 +6,6 @@ printf '1:2:3' | awk -F ":" '{print $1+$2+$3}' # print a multiplication table seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}' + +# Specify output separator character +printf '1 2 3' | awk 'BEGIN {OFS=":"}; {print $1,$2,$3}' From b3a93bc128f9918bd6c60b7571ba4c81006626cd Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 10:16:54 +0200 Subject: [PATCH 5/7] Retrieve N-th piped command exit status --- cheat/cheatsheets/bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cheat/cheatsheets/bash b/cheat/cheatsheets/bash index 5b7a702..c19f599 100644 --- a/cheat/cheatsheets/bash +++ b/cheat/cheatsheets/bash @@ -18,3 +18,7 @@ set -x # Turn off debugging: set +x + +# Retrieve N-th piped command exit status +printf 'foo' | fgrep 'foo' | sed 's/foo/bar/' +echo ${PIPESTATUS[0]} # replace 0 with N From f63406bc3e5a871703bc5fc9f08f64a2373ab899 Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 11:09:39 +0200 Subject: [PATCH 6/7] Lock file --- cheat/cheatsheets/bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheat/cheatsheets/bash b/cheat/cheatsheets/bash index c19f599..571b3ca 100644 --- a/cheat/cheatsheets/bash +++ b/cheat/cheatsheets/bash @@ -22,3 +22,6 @@ set +x # Retrieve N-th piped command exit status printf 'foo' | fgrep 'foo' | sed 's/foo/bar/' echo ${PIPESTATUS[0]} # replace 0 with N + +# Lock file: +( set -o noclobber; echo > my.lock ) || echo 'Failed to create lock file' From 90f66ccaf3004ab3ef4db7511ed9ce75d0ca50f9 Mon Sep 17 00:00:00 2001 From: Cedric Dufour Date: Fri, 4 Sep 2015 11:16:18 +0200 Subject: [PATCH 7/7] (fixed typo) --- cheat/cheatsheets/openssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheat/cheatsheets/openssl b/cheat/cheatsheets/openssl index 46b14ed..9254c1c 100644 --- a/cheat/cheatsheets/openssl +++ b/cheat/cheatsheets/openssl @@ -21,4 +21,4 @@ awk '/-----BEGIN/,/END CERTIFICATE-----/' | \ openssl x509 -noout -enddate # Generate Diffie-Hellman parameters: -openssl dhparamm -outform PEM -out dhparams.pem 2048 +openssl dhparam -outform PEM -out dhparams.pem 2048