Skip to content

Instantly share code, notes, and snippets.

Avatar

Abbas Esafzay esafzay

  • Rakuten Inc
  • Fukuoka, Japan
View GitHub Profile
@esafzay
esafzay / customized-database-container
Created Jun 25, 2019
Create a database image from a container
View customized-database-container
docker run -p 5432:5432 --name some-postgres -e PGDATA=/var/lib/postgresql/pgdata -e POSTGRES_PASSWORD=MyPa@@W0rd -d postgres
populate the database ...
docker commit some-postgres myAccount/repo-name:1.0
make sure the data is now persisted in the new image
docker run -p 5432:5432 --name persistent-postgres -d myAccount/repo-name:1.0
docker login -u myAccount
@esafzay
esafzay / databases-docker
Last active Jul 8, 2019
Databases on Docker
View databases-docker
// MySQL
docker run -p 3306:3306 --name some-mysql -e MYSQL_ROOT_PASSWORD=yousafzai -d mysql
sudo docker inspect some-mysql
docker exec -it some-mysql bash
mysql --password
create database db_example;
create user 'springuser'@'%' identified by 'ThePassword';
grant all on db_example.* to 'springuser'@'%';
// Postgres
@esafzay
esafzay / shell-commands
Last active Sep 3, 2019
Common shell commands
View shell-commands
// 10 lines before and 10 lines after
grep -C 10 'WARNING' notification*
// regex search string
FacesContext(.*)UIComponent
Search for files containing word
grep -rl --include \*.java "SomeLogic"
Check HardDisk file system
@esafzay
esafzay / git-commands
Last active May 30, 2021
Common GIT commands
View git-commands
Clone a remote repository on your local machine
```
git clone <repository_url>
```
List all local branches
```
git branch
```