Skip to content

Instantly share code, notes, and snippets.

@MM25Zamanian
Created March 28, 2024 19:06
Show Gist options
  • Save MM25Zamanian/94f4bb08032e379ca63d7ae505718076 to your computer and use it in GitHub Desktop.
Save MM25Zamanian/94f4bb08032e379ca63d7ae505718076 to your computer and use it in GitHub Desktop.
function logo
# Define Variables
set windowWidth (tput cols)
set windowHeight (tput lines)
set windowMinViewport (math min "$windowWidth, $windowHeight")
set showLogo test $windowWidth -gt 50 -a $windowHeight -gt 20
if $showLogo
set logoWidth 34
set logoHeight 18
else
set logoWidth 19
set logoHeight 3
end
set logoStartSpaces (math "($windowWidth - $logoWidth)/2-1")
set logoHeightSpaces (math "($windowHeight - $logoHeight)/2")
for i in (seq $logoHeightSpaces)
echo ""
end
if $showLogo
printf "\e[32;1m%"$logoStartSpaces"s @@@@@@@@@@@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@@@@@@@@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@@@@@ @@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@@@@ @@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@@ @@@@@@@@ @@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@ @@@@@@@@@ @@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@ @@@@@@@@@ @@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@@ @@@@@ @@@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@@@ @@@@@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%"$logoStartSpaces"s@@@@@@@@@@ @@@@@@@@@ @@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@ @@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@@@@@@@@@@@@@@@@@
%"$logoStartSpaces"s @@@@@@@@@@@@@@@@@@@@\e[0m"
else
printf "\e[32;1m%"$logoStartSpaces"s█▀▀ █▀▀ █▀▀ █ █ ▀█▀
%"$logoStartSpaces"s█ █ █▀▀ █ █ █ █
%"$logoStartSpaces"s▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀ \e[0m"
end
for i in (seq $logoHeightSpaces)
echo ""
end
end
# Python Django
alias dj="python manage.py"
alias drs="python manage.py runserver"
alias dsh="python manage.py shell"
alias dsm="python manage.py schemamigration"
alias dcsu="python manage.py createsuperuser"
alias dm="python manage.py migrate"
alias d2m="python manage.py makemigrations"
alias d3m="python manage.py makemigrations & python manage.py migrate"
# General
alias clear="clear && logo"
alias c="clear"
# Docker
alias d='docker'
alias dc='docker-compose'
alias dps="docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.RunningFor}}\t{{.Status}}\t{{.Ports}}'"
alias dtop="docker ps --format '{{.Names}}' | xargs docker stats $1"
alias dclog='dc logs -f --tail'
# General Tools
alias g='git'
alias n='nano'
alias y='yarn'
alias p='ping'
# Pings
alias pg='ping 8.8.8.8'
alias pc='ping 1.1.1.1'
alias rm="rm -i" # Interactive mode delete
alias hs="cd ~/ && ls"
alias up="cd .."
alias home="cd ~/"
alias root="sudo su"
alias mkdir="mkdir -pv" # Creates parent directories if needed
alias hist="history"
alias jobs="jobs -l"
# Power commands
alias shutdown="sudo shutdown -P now"
alias reboot="sudo shutdown -r now"
# Grep shorthands
alias grep="grep --color=auto" # Colorize grep command output
# ls shorthands
alias ls="ls -C --color=auto" # Make 'normal' ls nice with Columns and Colors
alias lm="ls -lhA --color=auto | more" # For big directories
alias ll="ls -lh --color=auto"
alias la="ls -lhA --color=auto"
alias lar="ls -lhAR --color=auto | more" # Recursive subdirectories, listed out
alias lcr="ls -CAR --color=auto | more" # Recursive subdirectories, by column
# Time
alias now="date +"%T""
alias nowtime=now
alias nowdate="date +\"%d-%m-%Y\""
# Networking
alias ports="netstat -tulanp"
# Updates
alias update="dnf -y check-update && sudo dnf -y upgrade"
# NVM init
function nvm
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
end
# ~/.config/fish/functions/nvm_find_nvmrc.fish
function nvm_find_nvmrc
bass source ~/.nvm/nvm.sh --no-use ';' nvm_find_nvmrc
end
# ~/.config/fish/functions/load_nvm.fish
function load_nvm --on-variable="PWD"
set -l default_node_version (nvm version default)
set -l node_version (nvm version)
set -l nvmrc_path (nvm_find_nvmrc)
if test -n "$nvmrc_path"
set -l nvmrc_node_version (nvm version (cat $nvmrc_path))
if test "$nvmrc_node_version" = N/A
nvm install (cat $nvmrc_path)
else if test "$nvmrc_node_version" != "$node_version"
nvm use $nvmrc_node_version
end
else if test "$node_version" != "$default_node_version"
echo "Reverting to default Node version"
nvm use default
end
end
export GITHUB_TOKEN=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
# Start Cli
clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment