Skip to content

Instantly share code, notes, and snippets.

@Zia-
Last active April 4, 2022 17:11
Show Gist options
  • Save Zia-/da79586d874ef95c8a73b18055888e54 to your computer and use it in GitHub Desktop.
Save Zia-/da79586d874ef95c8a73b18055888e54 to your computer and use it in GitHub Desktop.
Docker commands
// Docker
- Kill/Stop all containers -
docker kill $(docker ps -q)
- Delete all containers -
docker rm $(docker ps -a -q)
- Delete all images -
docker rmi $(docker images -q)
- Delete <none>:<none> images -
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) --force
- Delete all stopped containers, all networks not used by at least one container, all volumes not used by at least one container, all dangling images, all build cache -
docker system prune --volumes
- Restart docker -
sudo systemctl restart docker
// Tmux
- Tmux create new session -
tmux new -s sessionName
- Tmux detach logged in session -
control+b - d
- Tmux go up in history -
control+b - [
- Tmux list sessions -
tmux ls
- Tmux reattach session -
tmux attach -t sessionName
- Tmux delete session -
tmux kill-session -t sessionName
// Ports
- Free port -
kill $(lsof -t -i:3003)
OR
fuser -k 3003/tcp
// Conda
- List all conda environments -
conda env list
- Deactivate current environment -
conda deactivate
// Mongo Db
- localhost Error: couldn't connect to server
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod start
mongo
- For "Failed to start mongodb.service: Unit mongodb.service not found." (https://www.codegrepper.com/code-examples/whatever/Failed+to+start+mongodb.service%3A+Unit+mongodb.service+not+found.)
sudo systemctl enable mongodb.service
systemctl list-unit-files --type=service
cd /lib/systemd/system
sudo touch mongodb.service
sudo nano mongodb.service
service mongodb start
mongo
- If mongo only starts while mongod is running, put mongod in crontab and only listen to it internally
crontab –e
@reboot sudo mongod --bind_ip 127.0.0.1 --port 27017
- NPM module install globally. The content would be available at '/Users/zzz/node_modules'
sudo npm i --save @turf/turf
-- Convert ipynb to .py
ipynb-py-convert /path/tf-linear-regression.ipynb /path/tf-linear-regression.py
-- Ignore git ssl issue
git -c http.sslVerify=false <cmd>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment