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
#!/usr/bin/sh | |
file=$1 | |
if [ -z "$file" ]; then | |
echo "USAGE: extract_mkv_track.sh <filename>" | |
exit 1; | |
fi | |
extension="${file##*.}" |
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 | |
# Config | |
day=$(date +%Y-%m-%d) | |
filename=/var/cache/logwatch/$day-logwatch.txt | |
token=<YOUR BOT TOKEN> | |
chat_id=<YOUR CHAT_ID> | |
#Check if removed-but-not-purged | |
test -x /usr/share/logwatch/scripts/logwatch.pl || exit 0 |
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 | |
/** | |
* Функция склонения числительных в русском языке | |
* | |
* @param int $number Число которое нужно просклонять | |
* @param array $titles Массив слов для склонения | |
* @return string | |
**/ | |
$titles = array('Сидит %d котик', 'Сидят %d котика', 'Сидит %d котиков'); | |
function declOfNum($number, $titles) |
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 | |
if ! command -v svgo &> /dev/null; then | |
echo "SVGO is not installed. Install it by running 'npm install -g svgo'" | |
exit 1 | |
fi | |
for file in "$@"; do | |
if [ -f "$file" ]; then | |
extension="${file##*.}" |
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
<!-- contactform.php --> | |
<div class="cf" id="cf"> | |
<form action="javascript:void(0);"> | |
<div><input type="text" name="name" placeholder="Name"/><span class="error"></span></div> | |
<div><input type="text" name="email" placeholder="Email"/><span class="error"></span></div> | |
<div><textarea name="message" placeholder="Message"></textarea><span class="error"></span></div> | |
<div><button type="submit">Submit</button> <span class="loader"></span></div> | |
</form> | |
</div> |
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
// Check banned IP | |
sudo zgrep '<IP>' /var/log/fail2ban.log* | |
// Unban IP | |
sudo fail2ban-client set <jail_name> unbanip <IP> |
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
#!/usr/bin/sh | |
cd images_processed | |
# Convert png to jpg | |
mogrify -format jpg -quality 90 *.png | |
rm -f *.png | |
# Resize images | |
for PHOTO in * |
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 | |
/* | |
* Принимаемые параметры: | |
* $from - email отправителя | |
* $fromName - имя отправителя | |
* $to - email получателя | |
* $replyTo - email Reply To | |
* $bccTo - email "скрытая копия" | |
* $template - чанк с шаблоном письма | |
* $subject - Тема письма |
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
# Chown | |
chown user:group /path/to/base/dir -R | |
# For directories only | |
find /path/to/base/dir -type d -exec chmod 755 {} + | |
# For files only | |
find /path/to/base/dir -type f -exec chmod 644 {} + |
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
<script type="text/javascript"> | |
ga('send', 'event', 'error_404', '<?php echo $_SERVER['REQUEST_URI']; ?>', '<?php echo ($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'direct'; ?>'); | |
</script> |
NewerOlder