Skip to content

Instantly share code, notes, and snippets.

View kasir-barati's full-sized avatar
Dedicated to achieve his goals

Kasir Barati kasir-barati

Dedicated to achieve his goals
View GitHub Profile
@kasir-barati
kasir-barati / my-nest
Last active September 20, 2022 11:00
My NestJS bash script for creating a new NestJS project
#!/bin/bash
isPackageManagerSpecified="false";
for ((i=1; i<=$#; i++))
do
nextArgumentIndex=$((i+1));
if [[ "${!i}" == "--package-manager" ]] && [[ "${!nextArgumentIndex}" == "pnpm" ]];
then
isPackageManagerSpecified="true";
fi
@kasir-barati
kasir-barati / my-next
Last active September 20, 2022 10:54
#!/bin/bash
pnpm create next-app "$@"
cd "$1"
pnpm i
# Add prettier and its script
pnpm add -D prettier
wget https://gist.githubusercontent.com/kasir-barati/2bcdeea964f88712eca171adb3fbd979/raw/.prettierrc
@kasir-barati
kasir-barati / my-touch
Created September 8, 2022 10:54
A custom touch command to create parent directories and file too.
#!/bin/bash
mkdir -p "$(dirname "$1")" && touch "$1"
@kasir-barati
kasir-barati / general-linux-conf.sh
Last active September 8, 2022 10:56
After installing apps
git config --global init.defaultBranch main
sudo wget https://gist.githubusercontent.com/kasir-barati/5590e1420aedc2dc321571b4b9df7d33/raw/my-create-angular-app -O /usr/local/bin/my-create-angular-app
sudo chmod +x /usr/local/bin/my-create-angular-app
sudo wget https://gist.githubusercontent.com/kasir-barati/fb8263d5f546de1503847928ad4c6025/raw/my-create-react-app -O /usr/local/bin/my-create-react-app
sudo chmod +x /usr/local/bin/my-create-react-app
wget https://gist.githubusercontent.com/kasir-barati/bf022bc96f51ed351c8fc3667eb247b3/raw/my-touch -O /usr/local/bin/my-touch
sudo chmod +x /usr/local/bin/my-touch
@kasir-barati
kasir-barati / generated-new-ssh.md
Created September 2, 2022 13:03
My ssh journey
  1. ssh-keygen
  • Specify a new pass if you already have another ssh
  1. ssh-agent -s
  2. ssh-agent ssh-add .ssh/backup/id_rsa
@kasir-barati
kasir-barati / LICENCE
Created August 25, 2022 11:43
GNU GENERAL PUBLIC LICENSE for my bash script to change the project licence automatically to GNU
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
@kasir-barati
kasir-barati / keyboard-layout
Created August 25, 2022 07:31
Add keyboard change layout. Currently just English to Persian
#!/bin/bash
setxkbmap -layout us,ir
setxkbmap -option 'grp:alt_shift_toggle'
@kasir-barati
kasir-barati / manjaro-apps
Last active August 25, 2022 09:51
My bash script to install necessary apps in Manjaro
# Upgrade and update
sudo pacman -Syu --noconfirm
# Install Git and config it
sudo pacman -S git
git config --global init.defaultBranch main
git config --global user.name "Kasir Barati"
git config --global user.email "kasir.barati@gmail.com"
@kasir-barati
kasir-barati / my-create-react-app
Last active September 20, 2022 10:54
My customized create react app
#!/bin/bash
pnpx create-react-app "$@"
cd "$1"
rm -rf node_modules package-lock.json
pnpm i
# Add prettier and its script
pnpm add -D prettier
@kasir-barati
kasir-barati / js-to-py.md
Last active July 1, 2022 04:36
A simple gist full of syntax translation between two God, JS and Python

comprehensions

const arr = [1,2,3];
arr.map(x => 2*x);
arr.filter(x => x % 2 == 0);
arr = [1,2,3]
[2*x for x in arr]