|
| 1 | +Create Virtual Env Commands: |
| 2 | +python3 -m venv my-project-env |
| 3 | +source my-project-env/bin/activate |
| 4 | + |
| 5 | +#************************************************************************************************* |
| 6 | + |
| 7 | +Freezing Libraries from Env: |
| 8 | +pip freeze > requirements.txt |
| 9 | +pip install -r requirements.txt |
| 10 | +cat requirements.txt | xargs -n 1 pip install |
| 11 | + |
| 12 | +#************************************************************************************************* |
| 13 | + |
| 14 | +List all the libraries install in Env |
| 15 | +pip list --local |
| 16 | + |
| 17 | +#************************************************************************************************* |
| 18 | + |
| 19 | +Install DEB package |
| 20 | +sudo dpkg -i /path/to/package.deb |
| 21 | + |
| 22 | +#************************************************************************************************* |
| 23 | + |
| 24 | +Create Screen Commands: |
| 25 | +screen ls |
| 26 | +screen -S screen_name |
| 27 | +screen -r mtbc_forecasting |
| 28 | +Activate Venv and go to specific dir and run python file. |
| 29 | +Next Follow this command to exit. it will run in background. |
| 30 | +Ctrl A ctrl D to detach , it will run on back ground. |
| 31 | + |
| 32 | +#************************************************************************************************* |
| 33 | + |
| 34 | +Kill PORT |
| 35 | +Bellow command will print you PID of process bound on that port. |
| 36 | +fuser 8080/tcp |
| 37 | +And this command will kill that process. |
| 38 | +fuser -k 8080/tcp |
| 39 | + |
| 40 | +#************************************************************************************************* |
| 41 | + |
| 42 | +SSH & SCP Commands |
| 43 | + |
| 44 | + |
| 45 | +#************************************************************************************************* |
| 46 | + |
| 47 | +scp abc.txt.docx [email protected]:/home/bilal/ |
| 48 | +scp -r abc_folder [email protected]:/home/bilal/ |
| 49 | +pscp -i DS-Private.ppk ABC.zip [email protected]:/home/bilal/ |
| 50 | +GCP: scp -i /home/abc/service/ds_1 env.zip [email protected]:~/abc/ |
| 51 | + |
| 52 | +#************************************************************************************************* |
| 53 | + |
| 54 | +Search in files |
| 55 | +grep -nr mtbcweb /claim_transcription |
| 56 | + |
| 57 | +#************************************************************************************************* |
| 58 | + |
| 59 | +Git Commands |
| 60 | +you are in ur branch (bilal_dev) |
| 61 | +do your work |
| 62 | +commit your changes and push to your own branch |
| 63 | +git diff HEAD |
| 64 | +git add . |
| 65 | +git commit -m "Bilal changes" |
| 66 | +git branch -M bilal_dev |
| 67 | +git push -u origin bilal_dev |
| 68 | + |
| 69 | +after pushing |
| 70 | +goto testing branch (git checkout feature) |
| 71 | +git testing pull (git pull origin feature) |
| 72 | +again go to you ouwn branch (git checkout feature_MTBCDAT_5087_bilal) |
| 73 | +merge testing with your branch (git merge origin/feature) |
| 74 | +if no confict then simply push to your own branch (git push origin feature_MTBCDAT_5087_bilal) |
| 75 | +if colfict then resolve conflict and add and commit changes then push changes to your own branch |
| 76 | +after that goto azure repo |
| 77 | +crete new pull request (bilal_dev to testing) |
| 78 | +git config --global --unset http.proxy |
| 79 | + |
| 80 | +#************************************************************************************************* |
| 81 | + |
| 82 | +RASA COMMANDS |
| 83 | +rasa run --enable-api --port 5022 |
| 84 | +python manage.py runserver 0.0.0.0:5030 |
| 85 | +rasa run --enable-api --port 5031 |
| 86 | +rasa run actions |
| 87 | +rasa train --fixed-model-name vfd_bot_model |
| 88 | +python -m rasa interactive --model models/vfd_bot_model.tar.gz --port 5032 |
| 89 | +rasa shell --port 5033 |
| 90 | +rasa run --enable-api -p 5031 -i 0.0.0.0 |
| 91 | + |
| 92 | +#************************************************************************************************* |
| 93 | + |
| 94 | +Delete Ubuntu user |
| 95 | +sudo userdel username |
| 96 | +sudo rm -rf username/ |
| 97 | + |
| 98 | +#************************************************************************************************* |
| 99 | + |
| 100 | +List all sudo User: |
| 101 | +getent group sudo |
| 102 | + |
| 103 | +#************************************************************************************************* |
| 104 | + |
| 105 | +Remove User from Sudo Grop |
| 106 | +sudo deluser username sudo |
| 107 | + |
| 108 | +#************************************************************************************************* |
| 109 | + |
| 110 | +Add New User Ubuntu |
| 111 | +sudo useradd -s /bin/bash -d /home/bilal/ -m -G sudo bilal |
| 112 | +sudo passwd username |
| 113 | + |
| 114 | +#************************************************************************************************* |
| 115 | + |
| 116 | +use this to add User: |
| 117 | +sudo adduser bilal |
| 118 | +sudo usermod -a -G tsusers bilal |
| 119 | +sudo usermod -aG sudo bilal |
| 120 | +sudo killall -u bilal |
| 121 | + |
| 122 | +#************************************************************************************************* |
| 123 | + |
| 124 | +Nginx Commands |
| 125 | +sudo systemctl stop nginx |
| 126 | +sudo systemctl start nginx |
| 127 | +sudo systemctl restart nginx.service |
| 128 | +sudo systemctl status nginx.service |
| 129 | +sudo systemctl reload nginx |
| 130 | + |
| 131 | +#************************************************************************************************* |
| 132 | + |
| 133 | +symbolic link |
| 134 | +sudo ln -s /etc/nginx/sites-available/myproject /etc/nginx/sites-enabled |
| 135 | +sudo nginx -t |
| 136 | + |
| 137 | +#************************************************************************************************* |
| 138 | + |
| 139 | +Docker Commands |
| 140 | +sudo docker build -t language-lab-img . |
| 141 | +sudo docker images |
| 142 | +sudo docker run -p 8080:8080 language-lab-img |
| 143 | +sudo docker build -t language-lab-img . |
| 144 | +sudo docker images |
| 145 | +sudo docker run -p 8080:8080 language-lab-imgsudo docker build -t language-lab-img . |
| 146 | +sudo docker run --restart unless-stopped --gpus all -d -p 8080:8080 --name lan_lab_container2 --mount type=bind,source="/home/abc/abc/abc/lan_lab",target="/usr/src/app" language-lab-img |
| 147 | +sudo docker run --restart unless-stopped --gpus device=0 --memory=3g -d -p 8085:8080 --name lan_lab_container_gpu1 --mount type=bind,source="/home/abc/abc/abc/lan_lab",target="/usr/src/app" language-lab-img |
| 148 | + |
| 149 | +#************************************************************************************************* |
| 150 | + |
| 151 | +Systemd Comands |
| 152 | +sudo vim /etc/systemd/system/language_lab8000.service |
| 153 | +sudo systemctl daemon-reload |
| 154 | +sudo systemctl start abc.service |
| 155 | +sudo systemctl enable abc.service |
| 156 | +sudo systemctl status abc.service |
| 157 | +sudo systemctl stop abc.service |
| 158 | +sudo journalctl -xe -u abc.service |
| 159 | +sudo journalctl -u abc.service -f |
| 160 | +sudo chmod 755 /instance |
| 161 | + |
| 162 | +#************************************************************************************************* |
| 163 | + |
| 164 | +GPU Monitoring: |
| 165 | +watch -n0.1 nvidia-smi |
| 166 | + |
| 167 | +#************************************************************************************************* |
| 168 | + |
| 169 | +jupyter nbconvert my_input_notebook.ipynb --to notebook --ClearOutputPreprocessor.enabled=True --output my_output_notebook |
| 170 | +conda config --set auto_activate_base false |
| 171 | + |
| 172 | +#************************************************************************************************* |
| 173 | + |
| 174 | +File permission |
| 175 | +chmod -R a+rwx path (all user all rights) |
| 176 | +sudo chmod -R 777 /var/DirectoryName |
| 177 | + |
| 178 | +#************************************************************************************************* |
| 179 | + |
| 180 | + |
| 181 | + |
0 commit comments