Рубрика: Программирование
window.location.href not working
После некоторых плясок с бубном и поиску в интернете, было найдено универсально работающее во всех браузерах решение. window.location.href = "page.html" заменить на setTimeout(function(){document.location.href = "page.html";},500);
Яндекс.Облако
Java Script
Microsoft security chief: IE is not a browser, so stop using it as your default
Отправка почты из docker контейнера
RUN apt-get update && \ apt-get install -y msmtp && \ apt-get clean && \ echo "account yandex" >> ~/.msmtprc && \ echo "logfile ~/.msmtp.log" >> ~/.msmtprc && \ echo "host smtp.yandex.ru" >> ~/.msmtprc && \ echo "port 587" >> ~/.msmtprc && \ echo "from no-reply@serov.eu" >> ~/.msmtprc && \ echo "keepbcc on" >> ~/.msmtprc && \ echo "auth on" >> ~/.msmtprc && \ echo "user no-reply@serov.eu" >> ~/.msmtprc && \ echo "password Uzum2G9pkZt" >> ~/.msmtprc && \ echo "tls on" >> ~/.msmtprc && \ echo "tls_starttls on" >> ~/.msmtprc && \ echo "tls_certcheck off" >> ~/.msmtprc && \ chmod 0600 ~/.msmtprc && \ cp -p ~/.msmtprc /etc/.msmtp_php && \ chown www-data:www-data /etc/.msmtp_php && \ touch /var/log/msmtp.log && \ chown www-data:www-data /var/log/msmtp.log
в php.ini
sendmail_path = "/usr/bin/msmtp -C /etc/.msmtp_php --logfile /var/log/msmtp.log -a yandex -t"
Другие конфиги
account yandex logfile /var/log/msmtp.log host smtp.yandex.ru port 587 from mail@yandex.ru keepbcc on auth on user mail@yandex.ru password пароль tls on tls_starttls on account yahoo tls on tls_starttls off tls_certcheck off auth on host smtp.mail.yahoo.com user user1 from user1@yahoo.com password yourYahooPa5sw0rd account gmail tls on tls_certcheck off auth on host smtp.gmail.com port 587 user user1@gmail.com from user1@gmail.com password yourgmailPassw0rd
Тестирование:
echo -e "test message" | /usr/bin/msmtp --debug -t -i name@site.ru
Капча
docker backup mysql DB
My
docker exec app-mysql /usr/bin/mysqldump -u bitrix --password=tA32KVQ bitrix | gzip -9 > backup.sql.gz
Other
# 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
script
#!/bin/bash DATA=`date +"%Y-%m-%d_%H-%M"` PATHB=/mnt/backups # Бэкапим дампом docker exec container_name /usr/bin/mysqldump -u root --password=rootpass db_name > "$PATHB"/"$DATA"-db_name.sql # Жмем /bin/gzip "$PATHB"/"$DATA"-db_name.sql # Чистим, удаляя файлы старше 10-ти дней /usr/bin/find "$PATHB" -type f -mtime +10 -exec rm -rf {} \;
rsync для забора с другого ПК
/usr/bin/rsync -av -e "ssh -p 17222 -i /root/.ssh/id_rsa" rsyncuser@162.111.178.155:/mnt/backups/* /backups/mysql
Backup a MySQL local or remote database
Command to backup a local or remote MySQL database using Docker:
$ docker run -it mysql /usr/bin/mysqldump -h [MYSQL_HOST] -u [MYSQL_USER] --password=[MYSQL_PASSWORD] [MYSQL_DATABASE] > backup.sql
Command to backup a local or remote MySQL database using Docker with compression (using gzip):
$ docker run -it mysql /usr/bin/mysqldump -h [MYSQL_HOST] -u [MYSQL_USER] --password=[MYSQL_PASSWORD] [MYSQL_DATABASE] | gzip -9 > backup.sql.gz
Backup a containerized MySQL database
Command to backup a containerized MySQL database creating a compressed file using Docker and gzip:
$ docker exec [MYSQL_CONTAINER] /usr/bin/mysqldump -u [MYSQL_USER] --password=[MYSQL_PASSWORD] [MYSQL_DATABASE] | gzip -9 > backup.sql.gz
Когда надо обратиться с apache на nginx
docker-compose
nginx: image: nginx restart: always container_name: app-nginx volumes: - ./nginx.conf:/etc/nginx/nginx.conf - ./nginx/:/etc/nginx/conf.d/ - ./apache/data/:/data/ environment: TZ: "Europe/Moscow" ports: - "80:80" - "443:443" networks: - front - backend apache: build: ./apache container_name: app-apache restart: always volumes: - ./php.ini:/usr/local/etc/php/php.ini - ./apache/data/:/data/ links: - "nginx:test1.yandex.ru"
Когда нужно дать понять php что он работает по ssl
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = 443; }