mirror of https://github.com/cheat/cheat.git
Merge pull request #233 from cedric-dufour/master
A few additional cheats
This commit is contained in:
commit
9c31ba5102
|
@ -23,3 +23,6 @@ apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" i
|
||||||
|
|
||||||
# Show apt-get installed packages.
|
# Show apt-get installed packages.
|
||||||
grep 'install ' /var/log/dpkg.log
|
grep 'install ' /var/log/dpkg.log
|
||||||
|
|
||||||
|
# Silently keep old configuration during batch updates
|
||||||
|
apt-get update -o DPkg::Options::='--force-confold' ...
|
||||||
|
|
|
@ -6,3 +6,6 @@ printf '1:2:3' | awk -F ":" '{print $1+$2+$3}'
|
||||||
|
|
||||||
# print a multiplication table
|
# 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")}'
|
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}'
|
||||||
|
|
|
@ -18,3 +18,10 @@ set -x
|
||||||
|
|
||||||
# Turn off debugging:
|
# Turn off debugging:
|
||||||
set +x
|
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'
|
||||||
|
|
|
@ -19,3 +19,6 @@ openssl x509 -text -noout -in server.crt
|
||||||
echo | openssl s_client -connect <hostname>:443 2> /dev/null | \
|
echo | openssl s_client -connect <hostname>:443 2> /dev/null | \
|
||||||
awk '/-----BEGIN/,/END CERTIFICATE-----/' | \
|
awk '/-----BEGIN/,/END CERTIFICATE-----/' | \
|
||||||
openssl x509 -noout -enddate
|
openssl x509 -noout -enddate
|
||||||
|
|
||||||
|
# Generate Diffie-Hellman parameters:
|
||||||
|
openssl dhparam -outform PEM -out dhparams.pem 2048
|
||||||
|
|
|
@ -24,3 +24,8 @@ tar -jtvf /path/to/foo.tgz
|
||||||
|
|
||||||
# To create a .gz archive and exclude all jpg,gif,... from the 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/
|
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 ...
|
||||||
|
|
Loading…
Reference in New Issue