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 swapoff -a | |
sudo dd if=/dev/zero of=/swapfile bs=1G count=8 | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
grep Swap /proc/meminfo |
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 | |
tar -zcf /backups/backup-$(date +%Y%m%d).tar.gz --absolute-names /data | |
rm -f /backups/backup-$(date -d 'now - 7 days' +%Y%m%d).tar.gz |
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
cd $GOPATH | |
mkdir -p src/github.com/hello | |
cd src/github.com/hello | |
git clone https://github.com/hello/example.git | |
cd example | |
go install |
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
// delete all origin branch that deleted from origin and stay in your local | |
git fetch -p | |
// chekout to main brach to prevent delete it from local | |
git checkout master | |
// delete all local branch | |
git branch | xargs git branch -d | |
// delete all origin branch that don't deleted from origin and stay in your local | |
git branch | xargs git branch -D | |
// now you have master branch in local |
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
/etc/sysctl.conf | |
vm.dirty_background_ratio = 5 | |
vm.dirty_ratio = 10 | |
* run | |
sudo sysctl -p |
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
git config --global --add alias.permission-reset '!git diff -p -R --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply' | |
// use like git permission-reset |
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
var exec = require('child_process').exec; | |
var targetBranch = process.argv[2] || "develop" | |
var title = process.argv[3] || "initial task" | |
var description = process.argv[4] || "initial task" | |
exec("git push origin HEAD \ | |
-o merge_request.create \ | |
-o merge_request.remove_source_branch \ | |
-o merge_request.title=" + title + " \ |
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
Regex | |
========================================================== | |
GET /_search | |
{ | |
"query": { | |
"regexp": { | |
"user": { | |
"value": "k.*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
#!/bin/bash | |
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process." | |
read USERNAME | |
if [ -z "$USERNAME" ] ; then | |
echo "Exiting... Done." | |
exit | |
else | |
echo "Adding user to 'sudo' group..." |
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
* change drive name | |
Set-Partition -DriveLetter D -NewDriveLetter E | |
* get time of one command like get-process | |
Measure-Command {Get-Procees} | |
* find exe (or any) format in one directory | |
Get-childitem "C:\Program Files" -recurse | Where-Object {$_.extension -eq ".exe"} | |
* find powershell module install path like PSReadLine | |
(Get-Module -Name PSReadLine).Path |