This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# MySQL Database Backup Script | |
TODAY=`date +"%F"` | |
DB_BACKUP_PATH='/path/to/backup' | |
MYSQL_USER='user' | |
MYSQL_PASSWORD='password' | |
DATABASE_NAME=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote rename origin bitbucket | |
git remote add origin git@github.com:username/project.git | |
git push -u origin master | |
git remote rm bitbucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /var/lib/nginx/cache -type f -exec rm {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
truncate -s 0 filename.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//reject overly long 2 byte sequences, as well as characters above U+10000 | |
$text = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. | |
'|[\x00-\x7F][\x80-\xBF]+'. | |
'|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. | |
'|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. | |
'|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S', | |
'', $text); | |
//reject overly long 3 byte sequences and UTF-16 surrogates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Для удаления старых ядер, кроме последнего и предпоследнего, можно использовать команду | |
sudo apt-get purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) | |
# а после этого выполнить | |
sudo apt-get autoremove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -h --max-depth=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Статистика кеша */ | |
SHOW GLOBAL STATUS LIKE 'Qcache%'; | |
/* Настройки кеша */ | |
SHOW VARIABLES LIKE 'query_cache%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(IF(a>0,1,null)), COUNT(*) FROM t |
NewerOlder