https://github.com/ra101/alias-alchemy
Best way to download alias for fast setup (WIP)
https://github.com/ra101/alias-alchemy
alias aliases bash bashrc cli curl deno gnu gnu-linux javascript linux nodejs productivity utility wget zsh zshrc
Last synced: 11 months ago
JSON representation
Best way to download alias for fast setup (WIP)
- Host: GitHub
- URL: https://github.com/ra101/alias-alchemy
- Owner: ra101
- License: mit
- Created: 2023-12-01T14:45:19.000Z (about 2 years ago)
- Default Branch: core
- Last Pushed: 2025-02-12T11:53:30.000Z (12 months ago)
- Last Synced: 2025-02-12T12:28:44.285Z (12 months ago)
- Topics: alias, aliases, bash, bashrc, cli, curl, deno, gnu, gnu-linux, javascript, linux, nodejs, productivity, utility, wget, zsh, zshrc
- Language: TypeScript
- Homepage: https://alias-alchemy.ra101.dev
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Alias Alchemy
The best way to download alias for fast setup.
Usage
Step 1: Using any of the following tools, send a GET request
to alias alchemy domain with/without q (default all) query
parameter to download the composite alias file and the finally save this
file at the ~/.alias.sh.
Using cURL
```bash
# Fetch all aliases at once.
curl -L "alal.deno.dev" > ~/.alias.sh
# Fetch aliases based on query param.
curl -L "alias-alchemy.ra101.dev?q=py,dj,docker" > ~/.alias.sh
# /help endpoint to get usage.
curl -L "alal.deno.dev/help"
```
Using Wget
```bash
wget "alias-alchemy.ra101.dev?q=py,dj,docker" -O ~/.alias.sh
```
Other supported tools
HTTPie http -d [url] > [filepath]
aria2 aria2c -c [url] > [filepath]
Postman GET [url] | Save to File
Any Tool [tool] [header: {'User-Agent': 'alal'}] [url] > [filepath]
Mirrors:
Step 2: Configure our system to auto-run the alias file whenever a
terminal is launched. (This is just a first-time setup)
Assuming we saved the file at ~/.alias.sh, run the following
command:
```bash
# Append `Executing Command (source)` in the shell's configuration profile.
## Bash
grep -qxF 'source ~/.alias.sh' ~/.bashrc || echo 'source ~/.alias.sh' >> ~/.bashrc
## ZSH
grep -qxF 'source ~/.alias.sh' ~/.zshrc || echo 'source ~/.alias.sh' >> ~/.zshrc
```
Step 3: After creating the alias file and configuring our system, another
operation that can be performed is appending the alias file using the
>> operator. It is perhaps the reason why this project exists.
```bash
curl -L "alias-alchemy.ra101.dev?q=kubernetes" >> ~/.alias.sh
```
Alias Details
〉 Shell (sh) Aliases
```bash
# Shell Aliases
alias '$ '=''
alias sudo='sudo '
alias 'cd..'='cd ..'
alias ls='ls -CFG'
alias ll='ls -alFG'
alias la='ls -ACFG'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias vgrep='grep -v grep | grep --color=auto'
alias bc='bc -l'
alias ipi='ipconfig getifaddr en0'
alias ipe='curl ipinfo.io/ip && printf "\n"'
alias cls='clear'
alias dir='ls'
alias pping='prettyping --nolegend'
alias ':q'='exit'
alias sag='sudo apt-get'
alias sai='sudo apt install'
alias sau='sudo apt update'
alias sauu='sudo apt upgrade'
alias sadu='sudo apt dist-upgrade'
alias sar='sudo apt autoremove'
function long_clear() {
len=${1:-10}
for ((i=1; i <= len; i++)) do
printf '\n'
done
}
alias lcls='long_clear'
cat() {
for file in "$@"; do
ext="${file##*.}"
case "$ext" in
json)
if command -v python &> /dev/null && command -v pygmentize &> /dev/null; then
command python -m json.tool "$file" | pygmentize -l json
else
command cat "$file"
fi
;;
yaml|yml)
if command -v pygmentize &> /dev/null; then
command cat "$file" | pygmentize -l yaml
else
command cat "$file"
fi
;;
toml)
if command -v pygmentize &> /dev/null; then
command cat "$file" | pygmentize -l toml
else
command cat "$file"
fi
;;
md)
if command -v glow &> /dev/null; then
command glow "$file"
else
command cat "$file"
fi
;;
*) command cat "$file";;
esac
done
}
alias 'kore_nani?'='if [[ $((KORE_NANI_COUNT+=1)) -ge 6 ]]; then nyancat; KORE_NANI_COUNT=0; fi;'
## Git Aliases
parse_git_branch2() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
alias gbr='git branch'
alias gps='git push'
alias gpl='git pull'
alias gch='git checkout'
alias gco='git commit -m'
alias gca='git commit --amend --no-edit'
alias gs='git status'
alias gsb='git status -sb'
alias ga='git add'
alias gus='git restore --staged'
alias gr='git reset'
alias grs='git reset --soft'
alias grh='git reset --hard'
alias grb='git rebase --autostash'
alias grbm='git rebase $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@") --autostash'
alias gf='git fetch'
alias gd='git diff'
alias gup="git push --set-upstream origin \$(parse_git_branch2)"
alias gw='git whatchanged'
alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
gac() {
## The Idea is to create a commit message from the branch name
## For Example:
## if branch name is `feature/jira-123-this-is-issue-desc`
## then commit would be `[Enhancement JIRA-123] This Is Issue Desc`
# Exit, if there is nothing to commit!
if [[ $(git diff --staged) == "" ]]; then
echo "Nothing to Commit! " && return 1
fi
# Fetch Details
# ----------------
local current_branch
local issue_type
local issue_no
local issue_desc
## `feature/jira-123-this-is-issue-desc`, all in lower case
current_branch=$(git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]')
## `feature`
issue_type=$(echo "$current_branch" | cut -d '/' -f 1)
## `jira-123`
issue_no=$(echo "$current_branch" | cut -d '/' -f 2- | cut -d '-' -f -2)
## `this-is-issue-desc`
issue_desc=$(echo "$current_branch" | cut -d '/' -f 2- | cut -d '-' -f 3- )
# Format Details
# ----------------
## We will use this map to get issue_type out of branch name
declare -A branch_map; branch_map["feature"]="Enhancement";
branch_map["bugfix"]="Patch"; branch_map["version"]="Upgrade";
## `feature` -> `Enhancement`; `random` -> `Random`
issue_type=${branch_map[$issue_type]-${issue_type^}}
## `jira-123` -> `JIRA-123`
issue_no=$(echo "$issue_no" | tr '[:lower:]' '[:upper:]')
## `this-is-issue-desc` -> `This Is Issue Desc`
issue_desc=$(echo "$issue_desc" | sed 's/-/ /g' | awk '{for (i=1; i<=NF; i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')
## `[Enhancement JIRA-123] This Is Issue Desc`
local commit_msg="[$issue_type $issue_no] $issue_desc"
# Commit!
# ----------------
## Along with this message, I have added $@, So that all the
## flags and arguments of `git commit` can be passed in this command.
git commit -m \""$commit_msg"\" "$@"
}
```
〉 Python (py) Aliases
```bash
# Python Aliases
DEFAULT_VENV_DIR='./venv'
alias actenv='source $DEFAULT_VENV_DIR/bin/activate'
alias py='python'
alias py2='python2'
alias bpy='bpython'
alias ptpy='ptpython'
alias ipy='ipython'
alias jn='jupyter notebook'
alias crtenv='python -m venv $DEFAULT_VENV_DIR'
alias pi='pip install'
alias pir='pip install -r requirements.txt'
alias pirc='pip install -r requirements.txt -c constraints.txt'
alias pui='pip uninstall'
alias pf='pip freeze | sort'
alias pfr='pip freeze | sort > requirements.txt'
alias pyserve="python3 -m http.server"
pyclean () {
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
}
## uv Aliases: overwrite venv and pip aliases, if uv is installed.
if command -v uv &> /dev/null; then
alias upy='uv python'
alias crtenv='uv python venv $DEFAULT_VENV_DIR'
alias pi='uv pip install'
alias pir='uv pip install -r requirements.txt'
alias pirc='uv pip install -r requirements.txt -c constraints.txt'
alias pui='uv pip uninstall'
alias pf='uv pip freeze | sort'
alias pfr='uv pip freeze | sort > requirements.txt'
fi
## Alembic Aliases
alias alex='alembic'
alias alre='alembic revision'
alias alup='alembic upgrade'
alias aldn='alembic downgrade'
## Django Aliases
# ${PWD##*/} returns current working directory.
alias wsgi='gunicorn ${PYPROJ:-${PWD##*/}}.wsgi:application'
alias asgi='daphne ${PYPROJ:-${PWD##*/}}.asgi:application'
alias dj='python manage.py'
alias djr='python manage.py runserver'
alias djr+='python manage.py runserver_plus'
alias djmm='python manage.py makemigrations'
alias djm='python manage.py migrate'
alias djmmm='python manage.py makemigrations && python manage.py migrate'
alias djs='python manage.py shell'
alias djs+='python manage.py shell_plus'
alias djdb='python manage.py dbshell'
alias djdb+='python manage.py dbshell_plus'
alias djcs='python manage.py collectstatic --noinput --clear'
alias djt='python manage.py test'
alias djdd="python manage.py dumpdata"
alias djld="python manage.py loaddata"
## Celery Aliases
alias clb='celery -A ${PYPROJ:-${PWD##*/}} beat -l info'
alias clw='celery -A ${PYPROJ:-${PWD##*/}} worker -l info'
alias clf='celery -A ${PYPROJ:-${PWD##*/}} flower'
```
〉 Docker (dc) Aliases
```bash
# Docker Aliases
```
〉 Kubernetes (k) Aliases
```bash
# Kubernetes Aliases
```