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
Before use replace <DisplayOffPort> && <ActiveDisplayPort> | |
Values you can get by `xrandr | grep " connected " | awk '{ print$1 }'` | |
xrandr --listactivemonitors | grep <DisplayOffPort> >/dev/null && xrandr --output <DisplayOffPort> --off || xrandr --output eDP1 --below <ActiveDisplayPort> --auto |
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
[user] | |
name = <NAME> | |
email = <EMAIL> | |
[alias] | |
go = checkout | |
co = "commit -m" | |
co-name = "!git add --all | git commit -m \"$(git branch-name)\"" | |
do = checkout -b | |
to = push origin | |
amend = commit --amend --no-edit |
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
grep <pattern> <file> | |
grep -Hsi <pattern> <dir> | |
flags: | |
-r - recursive(include subdirs) | |
-l - show only filenames where was found pattern | |
-H - show in which file was found row | |
-с - count of pattern matches | |
-v - show only non-matches | |
-i - ignore case |
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 mysql -u root | |
DROP USER 'root'@'localhost'; | |
CREATE USER 'root'@'localhost' IDENTIFIED BY ''; - for all hosts change localhost to %, not recommend | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'; | |
FLUSH PRIVILEGES; | |
exit |
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
Count commits by author: | |
git log --pretty=format:==%an --numstat | \ | |
sed -r '/==.*/{s/^==//;h;D};/^$/D;s/-/0/g;s/\t[^\t]+$//;G;s/(.*)\n(.*)/\2\t\1/' \ | |
| awk -F '\t' '{add[$1]+=$2;del[$1]+=$3} END {for (i in add) {print i,add[i],del[i]}}' | |
Delete branches(not current && not master): | |
alias clear-merged-branches='git branch --merged | grep -v -E "(^\*|\bmaster\b)" | xargs git branch -d' | |
alias clear-branches='git branch | grep -v -E "(^\*|\bmaster\b)" |xargs git branch -D' |
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
function show_branches() | |
{ | |
for sub in *; do | |
[[ -d "${sub}/.git" ]] || continue | |
local BRANCH="$(cd "$sub"; git for-each-ref refs/heads/$(git branch 2>/dev/null|sed -n '/^\*/s/^\* //p') --format='%(authordate:short)%09(%(committerdate:relative))%09[%1B[0;33m%(refname:short)%1B[m]')" | |
echo "$sub $BRANCH" | |
done | |
} |
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 r1.id | |
FROM forms AS r1 JOIN | |
(SELECT (RAND() * | |
(SELECT MAX(id) | |
FROM forms)) AS id) | |
AS r2 | |
WHERE r1.id >= r2.id | |
ORDER BY r1.id ASC | |
LIMIT 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
SELECT f.id + 1 AS empty | |
FROM <table> f | |
LEFT OUTER JOIN <table> r ON f.id + 1 = r.id | |
WHERE r.id IS NULL | |
ORDER BY f.id | |
LIMIT 1; | |
SELECT f.id + 1 AS empty | |
FROM <table> f |
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
PPA: | |
sudo add-apt-repository ppa:ondrej/php-zts || sudo add-apt-repository ppa:nhojohl/php7-zts | |
sudo apt-get update | |
sudo apt-get install php7.0-zts php7.0-zts-dev | |
PHTHREADS: | |
cd ~/ | |
git clone git://github.com/krakjoe/pthreads.git | |
cd pthreads |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
NewerOlder