This file contains hidden or 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 | |
ENCODER="-c:v libx264 -b:v 1.5M -preset superfast -tune zerolatency -c:a aac -ar 44100" | |
ENCODER2="-c:v libx264 -b:v 1.5M -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -ac 2" | |
genPort() { | |
while | |
port=$(shuf -n 1 -i 49152-65535) | |
netstat -atun | grep -q "$port" | |
do |
This file contains hidden or 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 | |
### Check A record and add virtualhost to Zimbra | |
domains="$1" | |
server=$(dig +short a `hostname -f`) | |
flag=0 | |
for dom in $domains | |
do | |
dom=`echo "$dom" | tr '[:upper:]' '[:lower:]'` |
This file contains hidden or 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 [ -n "$1" ] | |
then | |
sudo iptables -I INPUT -s $1 -j DROP -m comment --comment "Block. Reason: $2" | |
echo "This IP ($1) has been blocked by $2" | |
else | |
echo -e "Usage: ./$0 <ip> <reason>\nExample: ./$0 1.2.3.4 \"Bruteforce site abc.com\"" | |
fi |
This file contains hidden or 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 | |
systemctl stop firewalld | |
systemctl disable firewalld | |
systemctl stop postfix | |
systemctl disable postfix | |
systemctl stop NetworkManager | |
systemctl disable NetworkManager |
This file contains hidden or 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
<VirtualHost *:80> | |
DocumentRoot "/opt/ctds" | |
<Directory /opt/ctds> | |
Options -Indexes +FollowSymLinks +MultiViews | |
AllowOverride All | |
Require all granted | |
</Directory> | |
ServerName nangtam.vn | |
ServerAlias *.nangtam.vn | |
ErrorLog ${APACHE_LOG_DIR}/ctds-error.log |
This file contains hidden or 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 | |
FILE="$1" | |
data=`cat $FILE` | |
filename=$(echo kq-`date +%H:%M:%S-%d.%m-%Y`.txt) | |
touch $filename | |
for x in $data | |
do |
This file contains hidden or 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 | |
# Dinh dang mac dinh cua phan vung moi | |
FORMAT='ext4' | |
## Liet ke danh sach disk chua duoc phan vung | |
disks=`parted -l 2>&1 > /dev/null | awk -F ':' {'print $2'} | grep -Ev '[0-9]$|Warning|Read-only'` | |
## Phan vung; dinh dang disk (ext4) | |
for d in $disks |
This file contains hidden or 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 | |
### Get current swap size | |
info=`free -m | grep "Swap:"` | |
size_cur=$(echo $info | awk {'print $2'}) | |
echo -e "Current swap size: $size_cur" | |
read -p "Enter new size (Unit: MB): " size_new |
This file contains hidden or 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 | |
#### | |
# | |
# Count IP send SYN's flag | |
# | |
#### | |
list=`netstat -npt | grep SYN_RECV | awk {'print $5'} | cut -d':' -f1`; | |
for x in $list; |
This file contains hidden or 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 | |
regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' | |
if [ -e $1 ] | |
then | |
lists=`cat $1` | |
for x in $lists | |
do | |
name=`echo $x | grep -Eo '?.*?\.mp4' | awk -F '/' {'print $NF'}` | |
ffmpeg -i "$x" -c copy $name | |
done |