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
| Kill sleeped connections | |
| for i in `mysql -u root -e "show processlist" | awk '/Sleep/ {print $1}'` ; do mysql -e "KILL $i;"; done | |
| MYSQL reset password | |
| sudo systemctl stop mysql | |
| sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" | |
| sudo systemctl start mysql | |
| sudo mysql -u root |
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
| Local and remote updates | |
| local-pc: git reset --hard HEAD~33 | |
| local-pc: git push origin +HEAD:master | |
| remote-pc: git reset --hard HEAD~33 | |
| remote-pc: git pull | |
| Reset last push commit | |
| git push -f origin last_known_good_commit:branch_name |
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
| $ sudo apt install bind9 | |
| $ cd /etc/bind | |
| $ sudo vim named.conf.options | |
| forwarders { | |
| 192.168.1.1; // Local office modem IP address | |
| 8.8.8.8; | |
| }; | |
| allow-transfer { | |
| 192.168.1.1; | |
| }; |
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
| ffmpeg -i input.jpg -vf scale=320:240 output_320x240.jpg | |
| ffmpeg -y -i input.jpg -vf "scale='min(500,iw)':'min(500,ih)'" output_500x500.png | |
| ffmpeg -y -i input.jpg -vf "crop=in_h" output_center.png | |
| ffmpeg -y -i input.jpg -vf "scale=w='min(500,in_h):h=-1'" output_center1.png | |
| ffmpeg -y -i input.jpg -vf "scale=w='min(1000,in_h):h=-1',crop=out_w=in_h,scale=w='min(200,in_h):h=-1" output_center2.png | |
| ffmpeg -i input1.mov -vcodec copy -acodec copy out1.mp4 | |
| ffmpeg -i input1.mov -q:v 0 output1.mp4 | |
| ffmpeg -i input.mkv -codec copy output.mp4 | |
| #ffmpeg -i 1000x1250.jpg -vf scale=w=300:h=300:force_original_aspect_ratio=increase,crop=300:300 temp.jpg -y |
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
| # Server autologin | |
| cp /lib/systemd/system/getty@.service /etc/systemd/system/getty@tty1.service | |
| [Service] | |
| ExecStart=-/sbin/agetty --autologin root --noclear %I | |
| # Increase LVM size of root folder / | |
| df -h | |
| cp -a /home /home2 | |
| umount /dev/mapper/centos-home |
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
| # Ubuntu welcome text disable | |
| sudo chmod -x /etc/update-motd.d/* | |
| # Ubuntu remove/hide user from login screen | |
| /var/lib/AccountsService/users/XXX | |
| [User] | |
| SystemAccount=true | |
| # Ubuntu Server autologin | |
| /etc/systemd/system/getty@tty1.service.d/override.conf |
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 | |
| MESSAGE=$(cat $FILE) | |
| REGEX_ISSUE_ID="^((ISSUE|TASK)\-[0-9]+:\s)" | |
| ISSUE_ID_IN_COMMIT=$(echo $MESSAGE | grep -o -E "$REGEX_ISSUE_ID") | |
| if [[ -z "$ISSUE_ID_IN_COMMIT" ]]; then | |
| BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
| echo "$BRANCH_NAME: $MESSAGE" > $FILE |
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
| # show, delete | |
| iptables -t nat -v -L PREROUTING -n --line-number | |
| iptables -t nat -D PREROUTING 5 | |
| # forward | |
| iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 33080 -j DNAT --to 10.0.27.67:33080 | |
| # Global IP to Local IP Ubuntu | |
| iptables -t nat -A OUTPUT -p all -d 123.45.67.89 -j DNAT --to-destination 127.0.0.1 |
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
| # http://maq.kz/123/ | |
| RewriteRule ^([1-9]+)/$ index.php?article=$1 [L] | |
| ## ajax http://maq.kz/dnfksnfsk/scripts/mslmflsmfsl/ | |
| RewriteRule ^(.+)/scripts/ scripts.php [L] | |
| ## pages http://maq.kz/page/123 | |
| RewriteRule ^page/(.*)$ index.php?a=1&b=2&c=$1 [L] | |
| ## |
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_ISSUE_ID="^((ISSUE|TASK)\-[0-9]+)" | |
| ISSUE_ID_IN_COMMIT=$(echo $(cat "$1") | grep -o -E "$REGEX_ISSUE_ID") | |
| if [[ -z "$ISSUE_ID_IN_COMMIT" ]]; then | |
| BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
| RED='\033[0;31m' | |
| NC='\033[0m' # No Color |