Skip to content

Instantly share code, notes, and snippets.

View yuswitayudi's full-sized avatar
🎯
Listening port . . . . .

Yudi Tata yuswitayudi

🎯
Listening port . . . . .
View GitHub Profile
@yuswitayudi
yuswitayudi / bash
Created January 30, 2020 09:06 — forked from panchicore/bash
solve perl: warning: Setting locale failed.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@yuswitayudi
yuswitayudi / backup_collection_mongo.sh
Created March 3, 2020 07:23 — forked from dungmanh88/backup_collection_mongo.sh
Dump multiple collections of a db in mongodb
#!/bin/bash
db=<db>
collection_list="<collection1> <collection2> <collection3>"
host=127.0.0.1
port=<port>
out_prefix=/Temp
for collection in $collection_list; do
echo $collection
out_dir="${out_prefix}/${db}_${collection}/"
[program:app_name]
directory=/home/user/path-app/
command=/home/user/path-app/app
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/log/supervisor/app_name/app_name.out.log
stdout_logfile=/var/log/supervisor/app_name/app_name.err.log
user=user
@yuswitayudi
yuswitayudi / RabbitMq monit
Created October 6, 2020 03:42
Monit config for RabbitMq service
check PROCESS rabbitmq with MATCHING rabbitmq
if failed port 5672 type tcp then restart
if changed pid then alert
start program = "/etc/init.d/rabbitmq-server start"
stop program = "/etc/init.d/rabbitmq-server stop"
@yuswitayudi
yuswitayudi / Running python with uwsgi module
Last active March 22, 2021 11:27
Example config uwsgi python with nginx
uwsgi -s :3017 --module run --callable app --enable-threads --processes 1
#!/bin/bash
sudo apt update
sudo apt install wget curl -y
wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt update
sudo apt install -y mongodb-org
@yuswitayudi
yuswitayudi / mysql-docker.sh
Created July 7, 2021 09:31 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@yuswitayudi
yuswitayudi / main.tf
Created June 7, 2022 03:45
basic config main.tf Terraform to deploy docker container from docker private registry on another server
//define docker provider
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "2.15.0"
}
}
}
@yuswitayudi
yuswitayudi / Dockerfile.example
Last active June 30, 2022 03:08
Zero downtime docker, with docker-compose and nginx
FROM nginx:alpine
COPY index.html /usr/share/nginx/html
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record