Created
February 1, 2022 14:16
-
-
Save rg3915/f53d621a9e00c7224c2b0645658fb1d1 to your computer and use it in GitHub Desktop.
Aliases in Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gitpush{ | |
git push -u origin master | |
} | |
Set-Alias gpu gitpush | |
function create_env { | |
python -m venv .venv | |
} | |
Set-Alias mkenv create_env | |
function open_explorer { | |
explorer . | |
} | |
Set-Alias open open_explorer | |
function git_commit { | |
$Server = Read-Host -Prompt 'Enter commit message' | |
git commit -m "$server" | |
} | |
Set-Alias gco git_commit | |
function navigate_to_workspace { | |
cd C:\users\arjun\workspace | |
} | |
Set-Alias work navigate_to_workspace | |
function create_django_app { | |
$app = Read-Host -Prompt 'Enter app name' | |
python manage.py startapp $app | |
} | |
Set-Alias djapp create_django_app | |
function activate_virtual_environment { | |
.\.venv\Scripts\activate | |
} | |
Set-Alias act activate_virtual_environment | |
function deactivate_virtual_environment { | |
deactivate | |
} | |
Set-Alias deact deactivate_virtual_environment | |
function git_status { | |
git status | |
} | |
Set-Alias gs git_status | |
function git_log_oneline { | |
git log --oneline --decorate --color | |
} | |
Set-Alias glo git_log_online | |
function pip_freeze { | |
pip freeze > requirements.txt | |
} | |
Set-Alias pipf pip_freeze | |
function make_migrations { | |
python manage.py makemigrations | |
} | |
Set-Alias mkmig make_migrations | |
function make_migrations_app { | |
$app = Read-Host -Prompt 'Enter app name' | |
python manage.py makemigrations $app | |
} | |
Set-Alias mkmiga make_migrations_app | |
function create_django_project { | |
$project = Read-Host -Prompt 'Enter project name' | |
django-admin startproject $project . | |
} | |
Set-Alias djpro create_django_project | |
function migrate_changes { | |
python manage.py migrate | |
} | |
Set-Alias mig migrate_changes | |
function powershell_alias_remote_push { | |
cat $profile | clip | |
Start-Process "https://gist.github.com/theArjun/7247d4fcb30d4a3d4c136af36dd3979f/edit" | |
} | |
Set-Alias palias powershell_alias_remote_push | |
function create_new_file { | |
New-Item -Path . -Name $args[0] -ItemType "file" | |
} | |
Set-Alias touch create_new_file | |
function run_server { | |
python manage.py runserver | |
} | |
Set-Alias run run_server | |
function run_server_public { | |
python manage.py runserver 0.0.0.0:80 | |
} | |
Set-Alias runp run_server_public | |
function create_superuser { | |
python manage.py createsuperuser | |
} | |
Set-Alias csu create_superuser | |
function git_ignore { | |
param( | |
[Parameter(Mandatory=$true)] | |
[string[]]$list | |
) | |
$params = ($list | ForEach-Object { [uri]::EscapeDataString($_) }) -join "," | |
Invoke-WebRequest -Uri "https://www.toptal.com/developers/gitignore/api/$params" -UseBasicParsing | select -ExpandProperty content | Out-File -FilePath $(Join-Path -path $pwd -ChildPath ".gitignore") -Encoding ascii | |
} | |
Set-Alias gig git_ignore | |
function battery_charge_report { | |
powercfg /batteryreport | |
C:\"Program Files"\"Mozilla Firefox"\firefox.exe "C:\Users\$env:UserName\battery-report.html" | |
} | |
Set-Alias battery battery_charge_report |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment