Skip to content

Instantly share code, notes, and snippets.

View qa1's full-sized avatar
🎯
Focusing

qa1

🎯
Focusing
View GitHub Profile
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
sudo mkswap /swapfile
sudo swapon /swapfile
grep Swap /proc/meminfo
@qa1
qa1 / backup.sh
Created May 5, 2020 11:03 — forked from ssbostan/backup.sh
Create a backup and Delete old backups
#!/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
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
// 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
/etc/sysctl.conf
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
* run
sudo sysctl -p
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
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 + " \
@qa1
qa1 / install.sh
Last active March 9, 2020 05:36 — forked from insane-dev/install.sh
Lemp stack for Ubuntu 16.04 (PHP7, Nginx, MySql, MongoDB, PhpMyAdmin, Git, Node.js, Bower, Gulp, Docker, Composer(with asset plugin), Dnsmasq)
#!/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..."
* 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