Skip to content

Instantly share code, notes, and snippets.

View amin3mej's full-sized avatar
🕊️

Amin Djawadi amin3mej

🕊️
View GitHub Profile
Computer Information:
Manufacturer: Apple
Model: MacBookPro16,1
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
CPU Family: 0x6
@amin3mej
amin3mej / rule.js
Created February 22, 2021 20:53
Auth0's rule to create an user credential for users who logged in with social accounts
function(user, context, callback) {
var request = require("request");
function mergeProcess({ primaryUser, toMergeUser }) {
var provider = toMergeUser.identities[0].provider;
var providerUserId = toMergeUser.identities[0].user_id;
var userIdentitiesEndpoint =
auth0.baseUrl + "/users/" + primaryUser.user_id + "/identities";
@amin3mej
amin3mej / iran_cities.json
Last active November 3, 2019 16:25
Iran provinces and cities database.
{
"provinces": [
{
"id": "1",
"name": "آذربایجان شرقي"
},
{
"id": "2",
"name": "آذربایجان غربي"
},
@amin3mej
amin3mej / .aminrc
Last active February 8, 2020 14:01
cdp () {
cd ~/Projects && cd $1
}
dl (){
aria2c -c -x16 -s16 $1
}
alias c='sudo openconnect --cafile ~/cert/ca.crt --certificate ~/cert/dinner-loop.p12 --key-password 'confirm.traffic.jacket' --pfs 94.130.39.16:4443 -b --pid-file=$HOME/.openconnect.pid'
function dc() {
sudo kill -2 `cat "$HOME/.openconnect.pid"` && rm -f "$HOME/.openconnect.pid"
sleep 3
@amin3mej
amin3mej / GoToEnd.js
Last active May 31, 2021 06:20
go to end
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function run() {
let last;
for (let i = 0; i < 2;) {
await sleep(2000);
if(last == document.body.scrollHeight) i++;
window.scrollTo(0,document.body.scrollHeight);
@amin3mej
amin3mej / autoexec.sh
Created July 15, 2019 18:19
Wait 3 seconds and if "q" button doesn't pressed, go to HACKER mode! (good for RPi)
#!/bin/bash
tmuv() ( tmux split-window -dv -t $TMUX_PANE "bash --rcfile <(echo '. ~/.bashrc;$*')" )
tmuh() ( tmux split-window -dh -t $TMUX_PANE "bash --rcfile <(echo '. ~/.bashrc;$*')" )
end=$((SECONDS+3))
while [ $SECONDS -lt $end ]; do
read -t 0.25 -N 1 input
if [[ $input = "q" ]] || [[ $input = "Q" ]]; then
exit 0
fi
@amin3mej
amin3mej / .aminrc
Created July 9, 2019 19:01
My zsh config file
cdp () {
cd ~/Projects && cd $1
}
dl (){
aria2c -c -x16 -s16 $1
}
alias c='sudo openconnect --cafile ~/cert/ca.crt --certificate ~/cert/dinner-loop.p12 --key-password 'YOUR PASSWORD' --pfs 11.22.33.44 -b --pid-file=$HOME/.openconnect.pid'
function dc() {
sudo kill -2 `cat "$HOME/.openconnect.pid"` && rm -f "$HOME/.openconnect.pid"
sleep 3
@amin3mej
amin3mej / do.sh
Last active June 25, 2018 09:40
ESLint config for react-native
yarn -D add eslint eslint-config-airbnb-base eslint-plugin-import eslint-plugin-react eslint-plugin-react-native babel-eslint
echo "{
\"parser\": \"babel-eslint\",
\"plugins\": [\"react\", \"react-native\"],
\"parserOptions\": {
\"ecmaFeatures\": {
\"jsx\": true,
\"modules\": true
}
},