Skip to content

Instantly share code, notes, and snippets.

View bala-codes's full-sized avatar
👋
Good Vibes Only

Balakrishna Kumar V bala-codes

👋
Good Vibes Only
View GitHub Profile
sudo apt-get update
sudo apt-get upgrade
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt install docker.io
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose-cli/releases/download/v2.0.0-rc.1/docker-compose-linux-amd64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
sudo chmod 777 /var/run/docker.sock
@bala-codes
bala-codes / commands.txt
Created March 11, 2023 08:57
MongoDB Import and Export
sudo apt-get update
sudo apt-get upgrade
sudo dpkg -l mongodb-database-tools
curl -o mongodb-database-tools-ubuntu2004-x86_64-100.2.1.deb https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.2.1.deb
sudo apt install ./mongodb-database-tools-ubuntu2004-x86_64-100.2.1.deb
mongodump --uri "mongodb+srv://<username>:<password>@client-dev-cluster0.qf5b6.mongodb.net/dbname" -o ./mongo-backup
mongorestore --uri "mongodb+srv://<username>:<password>@client-dev-cluster1.qf5b6.mongodb.net/dbname" ./mongo-backup/
## If you want to exclude any collections
mongodump --uri "mongodb+srv://<username>:<password>@client-dev-cluster0.qf5b6.mongodb.net/dbname" -o ./mongo-backup --excludeCollection <collection_name>
@bala-codes
bala-codes / commands.txt
Created January 12, 2023 20:52
Mattermost Installation
1 sudo apt update
2 sudo apt -y install postgresql-12 postgresql-contrib
3 sudo systemctl enable postgresql
4 sudo systemctl start postgresql
5 sudo passwd postgres
6 su - postgres
7 sudo useradd --system --user-group mattermost
8 wget https://releases.mattermost.com/7.5.2/mattermost-7.5.2-linux-amd64.tar.gz
9 sudo tar xvf mattermost-7.5.2-linux-amd64.tar.gz
10 sudo mv mattermost /opt
@bala-codes
bala-codes / git_commands.txt
Created December 30, 2022 12:39
Store git credentials in any machine
git config --global credential.helper store
git pull
@bala-codes
bala-codes / nginx.conf
Last active September 7, 2022 08:16
Nginx Conf File for longer running requests
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /usr/share/nginx/html;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
client_max_body_size 30M;
proxy_set_header Upgrade $http_upgrade;
@bala-codes
bala-codes / memory.py
Created May 7, 2022 18:57
Check memory usage of ubuntu - watch -n 2 memory.py
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The shared RAM is problematic to calculate, and this script automatically
# selects the most accurate method available for your kernel.
# Licence: LGPLv2
@bala-codes
bala-codes / query_command.txt
Created May 7, 2022 07:16
mysql big query run
mysql -u developer -p -h db-ags-datastore.cjftak3f3fmt.us-east-1.rds.amazonaws.com trainingdata < query.sql | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > output.csv
@bala-codes
bala-codes / docker_commands.txt
Last active March 11, 2023 11:51
Pull docker image, view the codes and later push it to the hub.
Way - 1 :
docker images
docker create --name="tmp_$$" <image_uri>:<tag>
docker export tmp_$$ | tar t
docker export tmp_$$ > image-fs.tar
tar -xvf image-fs.tar
Way - 2 :
docker save 1234.dkr.ecr.us-east-1.amazonaws.com/pyblender:latest | gzip > myimage_latest.tar.gz
tar -xvzf myimage_latest.tar.gz
@bala-codes
bala-codes / commands.txt
Created February 28, 2022 06:11
Deploy Node.js based application in EC2 ubuntu using PM2
1 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
2 . ~/.nvm/nvm.sh
3 nvm install v16.6.1
4 node -e "console.log('Running Node.js ' + process.version)"
5 sudo apt-get update
6 sudo apt-get upgrade
7 git clone --branch dev https://github.com/Zevigo-Solutions/nhg-hr.git
8 cd nhg-hr/
9 node app.js
10 clear
@bala-codes
bala-codes / commands.txt
Last active December 30, 2022 12:59
Deploy Python based application in EC2 ubuntu using PM2
1 sudo apt-get update
2 sudo apt-get upgrade
3 ls
4 git clone https://github.com/Zevigo-Solutions/titan.git
5 ls
6 cd titan
7 ls
8 sudo apt install -y python3-pip
9 pip3 install --upgrade pip
10 python3 -V