This README contains a dump of commands that have helped me greatly, yet somehow, I am never able to recall them and always end up spending 10 minutes Googling for them.
sudo apt-get update
sudo apt-get dist-upgrade
These two commands above together help to update Ubuntu dependencies.
sudo du -hsx dir/* | sort -rh | head -n 20
Get a summary of disk usage for files in the given dir
, and list the top 20 (arbitrary) of them, with the largest at the top.
ssh-keygen -t ed25519 -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
These three commands above help to generate a new SSH key, based on GitHub's instructions. The commands above are for Linux - there are other commands for Mac and Windows.
adduser username
usermod -aG sudo username
su - username
mkdir ~/.ssh && chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys
These commands above help to create a new superuser account and set up the SSH keys accordingly.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Flushes the DNS cache on Mac.
sudo certbot certonly -d example.com --nginx
Creates a certificate but doesn't touch the NGINX default configuration.
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
Links the certificate in sites-available
to sites-enabled
.
sudo certbot certonly --manual -d example.com --preferred-challenges dns
vacuumdb --analyze --verbose dbname
Utility for cleaning a PostgreSQL database, and also generate internal statistics used by the PostgreSQL query optimizer. Read more here.
ncu -u
npm install # or yarn install
Requires npm-check-updates to be installed globally. It upgrades package.json
dependencies to the latest versions, ignoring specified versions.
npx yarn-audit-fix
Will install yarn-audit-fix and run it to fix vulnerabilities detected in the dependencies. Used for yarn projects.
poetry show --outdated | grep --file=<(poetry show --tree | grep '^\w' | cut -d' ' -f1 | sed 's/.*/^&\\s/')
Credit goes to @Hultner (see his comment here).
rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData && pod deintegrate && pod install
Clears all pods and caches and reinstalls them. May need to specify a project for pod deintegrate
.
gs -o output.png -sDEVICE=png256 -dLastPage=1 -r300 -dBackgroundColor=16#ffffff input.pdf
Uses Ghostscript to get an image of the first page of input.pdf
. The background colour is filled with white.
find . -name "*sql.xz" -exec bash -c ' mv $0 ${0/beyond-server/sparks}' {} \;