Last active
March 30, 2018 08:04
-
-
Save itsjzt/e7734809a2852a3ae915ce190c50dfff to your computer and use it in GitHub Desktop.
my powershell config . π
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
# profile.ps1 for configuring Powershell's defaults | |
# created by @itsjzt | |
# dont forget to update the gist. | |
# import post-git for showing git status in terminal | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
Set-Theme Agnoster | |
# no bells | |
Set-PSReadlineOption -BellStyle None | |
# overriding default prompt | |
# function global:prompt { | |
# # exit code so, it don't over-write it, good for debugging | |
# $realLASTEXITCODE = $LASTEXITCODE | |
# # your current directory (directory relative to home) | |
# $cwd = (get-item $pwd).Name | |
# $node = node -v | |
# $battery = (Get-WmiObject win32_battery).estimatedChargeRemaining | |
# Write-Host "$cwd" -noNewLine -foregroundcolor "Magenta" | |
# Write-Host " at" -noNewLine | |
# Write-Host " $battery%" -noNewLine -foregroundcolor "Yellow" | |
# Write-Host " using" -noNewLine | |
# Write-Host " node $node" -noNewLine -foregroundcolor "Green" | |
# # git or any other VCS | |
# Write-VcsStatus | |
# # now last exit code | |
# $global:LASTEXITCODE = $realLASTEXITCODE | |
# # you should return something for prompts, some like to use $ for it. | |
# return '> ' | |
# } | |
# using ..'s for navigation | |
function .. { Set-Location ../ } | |
function pr { (Invoke-WebRequest "https://rapid-ride.herokuapp.com/").Content } | |
function myip { $(Invoke-WebRequest "http://ipecho.net/plain").Content } | |
# Simple function to start a new admin powershell prompt. | |
function admin { | |
Start-Process "$psHome\powershell.exe" -Verb runAs | |
} | |
# useful while working on tutorials to find videos I was on. | |
function last { | |
git log --max-count=5 --oneline | |
} | |
# alias | |
function tr { | |
trash $args | |
} | |
# react setup | |
function cra { | |
create-react-app $args | |
} | |
# open firefox good when you have different default browser | |
function firefox { | |
& "C:\Program Files\Firefox Developer Edition\firefox.exe" $args | |
} | |
Set-Alias -Name ff -Value firefox | |
# open vlc without any fuss . | |
function vlc { | |
& "C:\Program Files\VideoLAN\VLC\vlc.exe" $args | |
} | |
# tell the size of <folder> passed as $args | |
# ex: size <folder-name> | |
function size { | |
"{0:N2} MB" -f ((Get-ChildItem $args -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB) | |
} | |
# Compute file hashes - useful for checking successful downloads | |
function md5 { Get-FileHash -Algorithm MD5 $args } | |
function sha1 { Get-FileHash -Algorithm SHA1 $args } | |
function sha256 { Get-FileHash -Algorithm SHA256 $args } | |
# yarn aliases | |
function ys { yarn start } | |
function ya { yarn add $args } | |
function yrd { yarn run dev } | |
# Git stuff :0 | |
function gcl { git clone $args } | |
# easily commit with all files selected | |
function gcp { | |
# add all files | |
git add --all | |
# then commit | |
git commit -m $args | |
} | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment