Skip to content

Instantly share code, notes, and snippets.

View aamsur-mkt's full-sized avatar

Aam S aamsur-mkt

View GitHub Profile
@aamsur-mkt
aamsur-mkt / del-redis-key.sh
Last active September 23, 2019 09:17
One liner Del Redis By Key
redis-cli -h 9.9.9.9 -p 6379 -a authkey -n indexdb --scan --pattern *yourfpattern* | xargs redis-cli -h 9.9.9.9 -p 6379 -a authkey -n indexdb del
# first syntax will show list of keys
redis-cli -h 9.9.9.9 -p 6379 -a authkey -n indexdb --scan --pattern *yourfpattern*
@aamsur-mkt
aamsur-mkt / update-prefix.sql
Last active September 24, 2019 04:00
Update prefix of a field
UPDATE db_rumah_sakit
SET icon = REPLACE (icon, 'https://from.url.com', 'http://to.url.com')
where icon like 'https://from.url.com%'
@aamsur-mkt
aamsur-mkt / create-user-mysql.sql
Last active October 22, 2019 04:57
Create user mysql
CREATE USER 'user'@'%' IDENTIFIED BY 'yourfpassword';
GRANT SELECT ON *.* TO 'user'@'%';
FLUSH PRIVILEGES;
# ALL PRIVILEGES- as we saw previously, this would allow a MySQL user full access to a designated database (or if no database is selected, global access across the system)
# CREATE- allows them to create new tables or databases
# DROP- allows them to them to delete tables or databases
# DELETE- allows them to delete rows from tables
# INSERT- allows them to insert rows into tables
# SELECT- allows them to use the SELECT command to read through databases
@aamsur-mkt
aamsur-mkt / change-password.sql
Created September 24, 2019 10:38
Change user password in Mysql
ALTER USER 'user'@'%' IDENTIFIED BY 'yourfpassword';
FLUSH PRIVILEGES;
@aamsur-mkt
aamsur-mkt / master-slave.artikel
Last active October 2, 2019 10:10
Master Slave Mysql
https://www.tecmint.com/setup-mysql-master-slave-replication-on-ubuntu/ 18.04
https://technologyrss.com/mysql-master-slave-replication/ 14.04
dont forget to dump master db to slave db first!
@aamsur-mkt
aamsur-mkt / create_table.psql
Created September 25, 2019 09:22
Create db on Postgre
create database new_f_database
with
owner=yourfuser;
@aamsur-mkt
aamsur-mkt / change-hostname.sh
Last active September 19, 2023 02:46
Change ubuntu hostname
$ sudo nano /etc/hosts
# add yourfhostname after localhost
# example :
# 127.0.0.1 localhost yourfhostname
# then save
$ sudo hostnamectl set-hostname yourfhostname
# check the result with:
@aamsur-mkt
aamsur-mkt / install-docker.sh
Last active September 26, 2019 04:11
Install docker & docker-compose on Ubuntu 18.04
$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose -v
@aamsur-mkt
aamsur-mkt / install-docker.sh
Last active March 29, 2022 08:43
Install docker & docker-compose on Ubuntu 18.04
$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose -v
$ sudo usermod -a -G docker $USER
$ sudo newgrp docker # add user to docker group without restart
$ sudo systemctl enable docker # Auto-start on boot
@aamsur-mkt
aamsur-mkt / decrease-volume.artikel
Created September 27, 2019 07:48
Decrease volume EC2 AWS
good artikel, read here
https://medium.com/@rahulian/how-to-reduce-volume-of-an-aws-ec2-instance-d493ec891698
also the problems here
https://serverfault.com/questions/673048/how-to-reduce-aws-ebs-root-volume-size