Today I Learn (@skpaik)
Hi I'm Sudipta Kumar Paik. I write everything, what I learn every day.
chmod -R 777 ./
Remove all .DS_Store
file from a directore
find . -name ".DS_Store" -print -delete
Remove all target
folder from a directore
find . -name "target" -type d -exec rm -rf {} \;
Remove all node_modules
folder from a directore
find . -name "node_modules" -type d -exec rm -rf {} \;
Download file aws_credentials_create.js
Open file ad add list of aws credentails on const accounts =
line 5
Add Permission
chmod +x ./aws_credentials_create.js
To run the file
./aws_credentials_create.js
Create a fine in root of the project. Named run.sh
Add following contents
#!/usr/bin/env bash
npm run deploy:sam:dev:feature feature-DXP-4868
.
.
Add Permission
chmod +x ./run.sh
To run the file
./run.sh
Command 1:
ps aux | grep node
Output
root 3766 0.5 13.3 989252 130196 ? Ssl Jul29 137:14 node /home/ubuntu/code/backend/server.js
ubuntu 55299 0.0 0.0 8168 736 pts/0 S+ 08:46 0:00 grep --color=auto node
Command 2:
sudo lsof -PiTCP -sTCP:LISTEN
Output
Password:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 1573 sudiptambp 5u IPv4 0xd6a1f5fb0c929ad9 0t0 TCP *:7000 (LISTEN)
ControlCe 1573 sudiptambp 6u IPv6 0xd6a1f5f17447b1a1 0t0 TCP *:7000 (LISTEN)
ControlCe 1573 sudiptambp 7u IPv4 0xd6a1f5fb0c940fc9 0t0 TCP *:5000 (LISTEN)
ControlCe 1573 sudiptambp 8u IPv6 0xd6a1f5f17447c9a1 0t0 TCP *:5000 (LISTEN)
rapportd 1587 sudiptambp 4u IPv4 0xd6a1f5fb09e2f0f9 0t0 TCP *:59400 (LISTEN)
rapportd 1587 sudiptambp 8u IPv6 0xd6a1f5f17a2931a1 0t0 TCP *:59400 (LISTEN)
PanGPS 1684 root 7u IPv4 0xd6a1f5fb0c93f9a9 0t0 TCP localhost:4767 (LISTEN)
idea 64752 sudiptambp 14u IPv6 0xd6a1f5f1744969a1 0t0 TCP localhost:6942 (LISTEN)
idea 64752 sudiptambp 33u IPv6 0xd6a1f5f1744981a1 0t0 TCP localhost:63342 (LISTEN)
idea 64752 sudiptambp 100u IPv6 0xd6a1f5f1744821a1 0t0 TCP localhost:59804 (LISTEN)
java 65751 sudiptambp 237u IPv6 0xd6a1f5f17a2a39a1 0t0 TCP localhost:59813 (LISTEN)
com.docke 65761 sudiptambp 87u IPv6 0xd6a1f5f17a2921a1 0t0 TCP *:27017 (LISTEN)
Find the process ID (second from the left):
Command 2:
kill -9 PROCESS_ID
Example
sudo kill -9 3766
This may also work
sudo killall node
Command 1:
lsof -i:8080
OR
Command 2:
lsof -i:5000
OR
Command 3:
lsof -i:3000
Command 1:
netstat -tulpn | grep LISTEN
OR
Command 2:
sudo lsof -i -P -n | grep LISTEN
Command 1: For company use
ssh-keygen -t ed25519 -C "info@newCompany.com" -f "id_rsa_github_newCompany"
OR
Command 2: For personal use
ssh-keygen -t ed25519 -C "me@gmail.com" -f "id_ed25519_github_personal"
OR
Command 3: If you are using a legacy system that doesn't support the Ed25519 algorithm, use:
ssh-keygen -t rsa -b 4096 -C "info@newCompany.com" -f "id_rsa_github_newCompany"
If you want to configure github, please follow this page .
[cmd] in terminal
git reset --hard HEAD
Ref: https://stackoverflow.com/q/9529078
Tech:
git
,reset
Date: 2020-04-15
[cmd] in active virtualenv
pip install isort
From the command line:
isort mypythonfile.py mypythonfile2.py
From recursively:
isort -rc .
or to see the proposed changes without applying them:
isort mypythonfile.py --diff
Ref: https://pypi.org/project/isort/
Tech:
python
,pep8
,standard
Date: 2020-04-01
Install the MySQL server by using the Ubuntu package manager:
- Open a Finder window.
- Select Applications from the sidebar.
- Double-click on Utilities.
- Double-click Terminal.
- type
sudo nano /etc/hosts
and then hit return. - Enter your administrator password and then hit return. Once you're done, hold down the control and O keys to save the file, then control and X to exit.
- One last step:
sudo killall -HUP mDNSResponder
Tech:
host
,mac
Date: 2019-11-13
sudo pip install virtualenv
virtualenv -p python3 .env
python3 -m venv .env
Here .env is environment name
source .env/bin/activate
source deactivate
Tech:
python3
,virtualenv
,mac
Date: 2019-10-31
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
sudo groupadd docker
sudo usermod -aG docker $USER
Ref: https://docs.docker.com/install/linux/docker-ce/ubuntu/
Tech:
docker
,docker-ce
,ubuntu
Date: 2019-07-01
sudo docker system prune
sudo docker system prune --volumes
sudo docker image ls -a
sudo docker image rm 75835a67d134 2a4cca5ac898
// Here '75835a67d134' & '2a4cca5ac898' is image ID
docker rmi -f $(docker images -a -q)
docker rm -vf $(docker ps -a -q)
sudo docker container ls -a
sudo docker container rm cc3f2ff51cab cd20b396a061
// Here 'cc3f2ff51cab' & 'cd20b396a061' is container ID
sudo docker container stop $(sudo docker container ls -aq)
sudo docker container rm $(sudo docker container ls -aq)
N.B.: if no container running, then error may shown.
sudo dpkg -l | grep -i docker
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
sudo rm -rf /var/lib/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
Download the file and open command line Then run
sudo ./delete_docker_fully.sh
sudo apt-get remove docker docker-engine docker.io containerd runc
Ref:
- https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks
- https://askubuntu.com/a/1021506/700201
Tech:
docker
,ubuntu
Date: 2019-03-06
apt-get update
apt-get install vim nano
Ref: https://stackoverflow.com/a/37156748/705293
Tech:
vim
,docker
,nano
,ubuntu
Date: 2019-03-06
Install the MySQL server by using the Ubuntu package manager:
sudo apt-get update
sudo apt-get install mysql-server
Ref: https://support.rackspace.com/how-to/installing-mysql-server-on-ubuntu/
Tech:
mysql
,ubuntu
Date: 2019-03-04
Use apt to uninstall and remove all MySQL packages:
sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
sudo apt-get autoremove -y
sudo apt-get autoclean
Remove the MySQL folder:
sudo rm -rf /etc/mysql
Delete all MySQL files on your server:
sudo find / -iname 'mysql*' -exec rm -rf {} \;
Ref: https://help.cloud66.com/node/how-to-guides/databases/shells/uninstall-mysql.html
Tech:
'mysql'
,ubuntu
Date: 2019-03-04
Dump or Take backup:
mongodump -h 127.0.0.1:27017 -d dbname --out bjson_folder
Restore to database:
mongorestore -h 127.0.0.1:27017 -d dbname bjson_folder/dbname
Here:
>Host = 127.0.0.1:27017(-h)
>Database name = dbname(-d)
>Dump locations BSON/JSON files = bjson_folder/(dbname auto create)(--out)
>Restore Locations of backup BSON/JSON folders = bjson_folder/dbname
Tech:
mongodb
Date: 2019-02-27
docker ps
docker exec -it name-of-container bash
Tech:
docker
Date: 2019-02-07
Ref: https://codehandbook.org/unit-test-express-route
Tech:
mocha
,nodejs
,expressjs
Date: 2019-01-28
Run command on Powershell
Download from https://www.python.org/downloads/
pip install virtualenv
cd ~/Desktop
mkdir pages
cd pages
virtualenv venv
.\venv\Scripts\activate
pip install django
django-admin startproject app .
python manage.py startapp pages
deactivate
Ref: https://www.codingforentrepreneurs.com/blog/install-python-django-on-windows/
Tech:
django
,python
Date: 2019-01-23
- Ref: https://www.codeblogbt.com/archives/282803
- Or you can activate using PyCharm_Activation_Code.txt
- Before activate please update hosts file to
0.0.0.0 account.jetbrains.com
Tech:
pycharm
,python
Date: 2019-01-22
git checkout -b feature_connect_issue remotes/origin/feature_connect_issue
Ref: https://stackoverflow.com/a/1783426/705293
Tech:
'git'
Date: 2019-01-16
git branch -D branch_name
Ref: https://stackoverflow.com/a/2003515/705293
Tech:
'git'
Date: 2019-01-16
A "LAMP" stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP. Ref: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04
Tech: php, mysql
Date: 2019-01-10
Faveo is a suport ticket system. Ref: https://github.com/ladybirdweb/faveo-helpdesk
Tech:
'php'
,'mysql'
Date: 2019-01-10
Table of Contents
[TOCM]
[TOC]