Skip to content

Instantly share code, notes, and snippets.

View qa1's full-sized avatar
🎯
Focusing

qa1

🎯
Focusing
View GitHub Profile
@qa1
qa1 / gist:5982e9564f420253a396f2a6ba994df5
Created November 14, 2018 07:43 — forked from ebraminio/gist:5292017
Check Iranian National Code Validity - بررسی صحت کد ملی ایرانی - Clojure, C#, Ruby, JavaScript, Python, Scala, Java 8, PHP, C, Go, Swift, Kotlin
// Check Iranian National Code Validity - Clojure, C#, Ruby, JavaScript, Python, Scala, Java 8, PHP, C, Go, Swift, Kotlin
// بررسی صحت کد ملی ایران - کلوژر، سی‌شارپ، روبی، جاوااسکریپت، پایتون، اسکالا، جاوا ۸، پی‌اچ‌پی، سی، گو، سوئیفت، کاتلین
// در نسخه‌های قبل یکسان بودن اعداد نا معتبر تشخیص داده می‌شد ولی
// اعداد یکسان نامعتبر نیست http://www.fardanews.com/fa/news/127747
// بعضی از پیاده‌سازی‌ها سریع نیستند، می‌توانید نسخهٔ خود را بر پایهٔ
// نسخهٔ سی یا گو ایجاد کنید که بهترین سرعت را داشته باشد
/**
@qa1
qa1 / persian-braille.json
Created November 14, 2018 09:54 — forked from ebraminio/persian-braille.json
Persian Braille
{
"آ": "⠜",
"ا": "⠁",
"ب": "⠃",
"پ": "⠏",
"ت": "⠞",
"ث": "⠹",
"ج": "⠚",
"ﭺ": "⠉",
"ح": "⠱",
* 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
@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..."
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 + " \
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
/etc/sysctl.conf
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
* run
sudo sysctl -p
// 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