Skip to content

Instantly share code, notes, and snippets.

@trevren11
Last active November 21, 2020 02:15
Show Gist options
  • Save trevren11/69fb5088d72b0e3678cdce59eb248351 to your computer and use it in GitHub Desktop.
Save trevren11/69fb5088d72b0e3678cdce59eb248351 to your computer and use it in GitHub Desktop.
Macros for powershell development
###############################################################################
# Simple Textbased Powershell Menu
# Author : Michael Albert
# E-Mail : info@michlstechblog.info
# License: none, feel free to modify
# usage:
# Source the menu.ps1 file in your script:
# . .\menu.ps1
# fShowMenu requieres 2 Parameters:
# Parameter 1: [string]MenuTitle
# Parameter 2: [hashtable]@{[string]"ReturnString1"=[string]"Menu Entry 1";[string]"ReturnString2"=[string]"Menu Entry 2";[string]"ReturnString3"=[string]"Menu Entry 3"
# Return : Select String
# For example:
# fShowMenu "Choose your favorite Band" @{"sl"="Slayer";"me"="Metallica";"ex"="Exodus";"an"="Anthrax"}
# #############################################################################
function fShowMenu([System.String]$sMenuTitle,[System.Collections.Hashtable]$hMenuEntries, [System.Int16]$highlight)
{
# Orginal
[System.Int16]$iSavedBackgroundColor=[System.Console]::BackgroundColor
[System.Int16]$iSavedForegroundColor=[System.Console]::ForegroundColor
# Menu Colors
# inverse fore- and backgroundcolor
[System.Int16]$iMenuForeGroundColor=$iSavedForegroundColor
[System.Int16]$iMenuBackGroundColor=$iSavedBackgroundColor
# [System.Int16]$iMenuBackGroundColorSelectedLine=$iMenuForeGroundColor
[System.Int16]$iMenuForeGroundColorSelectedLine=$iMenuBackGroundColor
# Alternative, colors
# 4 is red (to use when deleting or something similar)
[System.Int16]$iMenuBackGroundColor=0
[System.Int16]$iMenuForeGroundColor=8
[System.Int16]$iMenuBackGroundColorSelectedLine=2
if ($highlight){
$iMenuBackGroundColorSelectedLine = $highlight
}
# Init
[System.Int16]$iMenuStartLineAbsolute=0
[System.Int16]$iMenuLoopCount=0
[System.Int16]$iMenuSelectLine=1
[System.Int16]$iMenuEntries=$hMenuEntries.Count
[Hashtable]$hMenu=@{};
[Hashtable]$hMenuHotKeyList=@{};
[Hashtable]$hMenuHotKeyListReverse=@{};
[System.Int16]$iMenuHotKeyChar=0
[System.String]$sValidChars=""
[System.Console]::WriteLine(" "+$sMenuTitle)
$iMenuLoopCount=1
$iMenuHotKeyChar=49
foreach ($sKey in $hMenuEntries.Keys){
$hMenu.Add([System.Int16]$iMenuLoopCount,[System.String]$sKey)
$hMenuHotKeyList.Add([System.Int16]$iMenuLoopCount,[System.Convert]::ToChar($iMenuHotKeyChar))
$hMenuHotKeyListReverse.Add([System.Convert]::ToChar($iMenuHotKeyChar),[System.Int16]$iMenuLoopCount)
$sValidChars+=[System.Convert]::ToChar($iMenuHotKeyChar)
$iMenuLoopCount++
$iMenuHotKeyChar++
if($iMenuHotKeyChar -eq 58){$iMenuHotKeyChar=97}
elseif($iMenuHotKeyChar -eq 123){$iMenuHotKeyChar=65}
elseif($iMenuHotKeyChar -eq 91){
Write-Error " Menu too big!"
exit(99)
}
}
# Remember Menu start
[System.Int16]$iBufferFullOffset=0
$iMenuStartLineAbsolute=[System.Console]::CursorTop
do{
####### Draw Menu #######
[System.Console]::CursorTop=($iMenuStartLineAbsolute-$iBufferFullOffset)
for ($iMenuLoopCount=1;$iMenuLoopCount -le $iMenuEntries;$iMenuLoopCount++){
[System.Console]::Write("`r")
[System.String]$sPreMenuline=""
$sPreMenuline=" "+$hMenuHotKeyList[[System.Int16]$iMenuLoopCount]
$sPreMenuline+=": "
if ($iMenuLoopCount -eq $iMenuSelectLine){
[System.Console]::BackgroundColor=$iMenuBackGroundColorSelectedLine
[System.Console]::ForegroundColor=$iMenuForeGroundColorSelectedLine
}
if ($hMenuEntries.Item([System.String]$hMenu.Item($iMenuLoopCount)).Length -gt 0){
[System.Console]::Write($sPreMenuline+$hMenuEntries.Item([System.String]$hMenu.Item($iMenuLoopCount)))
}
else{
[System.Console]::Write($sPreMenuline+$hMenu.Item($iMenuLoopCount))
}
[System.Console]::BackgroundColor=$iMenuBackGroundColor
[System.Console]::ForegroundColor=$iMenuForeGroundColor
[System.Console]::WriteLine("")
}
[System.Console]::BackgroundColor=$iMenuBackGroundColor
[System.Console]::ForegroundColor=$iMenuForeGroundColor
[System.Console]::Write(" Selected: " )
if (($iMenuStartLineAbsolute+$iMenuLoopCount) -gt [System.Console]::BufferHeight){
$iBufferFullOffset=($iMenuStartLineAbsolute+$iMenuLoopCount)-[System.Console]::BufferHeight
}
####### End Menu #######
####### Read Kex from Console
$oInputChar=[System.Console]::ReadKey($true)
if([System.Int16]$oInputChar.Key -eq [System.ConsoleKey]::Escape -or [System.Int16]$oInputChar.Key -eq [System.ConsoleKey]::Q){
# reset colors
[System.Console]::ForegroundColor=$iSavedForegroundColor
[System.Console]::BackgroundColor=$iSavedBackgroundColor
return ""
}
# Down Arrow or J?
elseif ([System.Int16]$oInputChar.Key -eq [System.ConsoleKey]::DownArrow -or [System.Int16]$oInputChar.Key -eq [System.ConsoleKey]::J){
if ($iMenuSelectLine -lt $iMenuEntries){
$iMenuSelectLine++
}
}
# Up Arrow or K
elseif([System.Int16]$oInputChar.Key -eq [System.ConsoleKey]::UpArrow -or [System.Int16]$oInputChar.Key -eq [System.ConsoleKey]::K){
if ($iMenuSelectLine -gt 1){
$iMenuSelectLine--
}
}
elseif([System.Char]::IsLetterOrDigit($oInputChar.KeyChar)){
[System.Console]::Write($oInputChar.KeyChar.ToString())
}
[System.Console]::BackgroundColor=$iMenuBackGroundColor
[System.Console]::ForegroundColor=$iMenuForeGroundColor
} while(([System.Int16]$oInputChar.Key -ne [System.ConsoleKey]::Enter) -and ($sValidChars.IndexOf($oInputChar.KeyChar) -eq -1))
# reset colors
[System.Console]::ForegroundColor=$iSavedForegroundColor
[System.Console]::BackgroundColor=$iSavedBackgroundColor
if($oInputChar.Key -eq [System.ConsoleKey]::Enter){
[System.Console]::Writeline($hMenuHotKeyList[$iMenuSelectLine])
return([System.String]$hMenu.Item($iMenuSelectLine))
}
else{
[System.Console]::Writeline("")
return($hMenu[$hMenuHotKeyListReverse[$oInputChar.KeyChar]])
}
}
Write-Host "Loading tren custom profile"
# Place file in this location
# C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
# for powershell 6, location is here
# C:\Program Files\PowerShell\6\pwsh.exe
# Get-Alias # output the current aliases
# Add menu option
# Found here http://michlstechblog.info/blog/powershell-a-text-based-menu/
$script:MyInvocation.MyCommand.Path
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
. $ScriptDir\Menu.ps1
# todo, change information to be table friendly (automatic spacing)
$i = @();
# add the powershell scripts to my command line
# Remove-Module Common-MMX # -ErrorAction ignore
Import-Module \\wexfs\users\MMX\Scripts\Powershell\Common-MMX.psm1 -ErrorAction silentlycontinue -WarningAction 0 # ignore warning actions
$i += ""
$i += "## MACROS -------------------------------------------"
$i += '```'
function Get-Edit { & code C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1 }
New-Alias -Name edit -Value Get-Edit
$i += "edit -> open up powershell profile to edit macros"
function Touch { & New-Item -ItemType file $args }
New-Alias -Name t -Value Touch
$i += "t, touch -> create file 'New-Item <file name>'"
function Get-OpenExplorerHere {
if ($args) {
explorer $args
} else {
& explorer .
}
}
# todo, if args provided, use the args instead
New-Alias -Name e -Value Get-OpenExplorerHere
$i += "e -> open up explorer window in current directory"
function Get-OpenWexfs { & explorer \\wexfs\users\mmx\scripts }
New-Alias -Name w -Value Get-OpenWexfs
New-Alias -Name wex -Value Get-OpenWexfs
$i += "w, wex -> open up explorer to wexfs scripts directory"
function Get-OpenCodeHere { & code . }
New-Alias -Name c -Value Get-OpenCodeHere
$i += "c -> open up vs code in current directory"
function Get-OpenLuaMacros { & 'C:\Users\trrensha\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\LuaMacros.exe - load file.lnk' }
New-Alias -Name lua -Value Get-OpenLuaMacros
$i += "lua -> run Lua Macros with config file"
function Get-OpenVsHere { & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe" . }
New-Alias -Name vss -Value Get-OpenVsHere
$i += "vss -> open up visual studio"
function Get-OpenVs {
Write-Host Opening Visual Studio
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe" $args
}
New-Alias -Name vs -Value Get-OpenVs
New-Alias -Name visual-studio -Value Get-OpenVs
$i += "vs, visual-studio -> open up visual studio, arg for directory"
function Get-OpenAndroidStudio {
Write-Host Opening Android Studio
& "C:\Program Files\Android\Android Studio\bin\studio64.exe" $args
}
New-Alias -Name as -Value Get-OpenAndroidStudio
New-Alias -Name android-studio -Value Get-OpenAndroidStudio
$i += "as, android-studio -> open up android studio"
function Get-OpenStackOverflow {
Write-Host Opening Stack Overflow
$uri = [uri]::EscapeDataString($args);
& start chrome https://stackoverflow.com/search?q=$uri
}
New-Alias -Name so -Value Get-OpenStackOverflow
New-Alias -Name stackoverflow -Value Get-OpenStackOverflow
$i += "so, stackoverflow -> open up stack overflow with query"
function Get-OpenGoogle {
Write-Host Opening Google
$uri = [uri]::EscapeDataString($args);
& start chrome https://www.google.com/search?q=$uri
}
New-Alias -Name g -Value Get-OpenGoogle
New-Alias -Name google -Value Get-OpenGoogle
$i += "g, google -> open up google with query"
function Get-OpenGoogleFilterToStackOverflow {
Write-Host Opening Google to search Stack Overflow
$uri = [uri]::EscapeDataString($args + " site:stackoverflow.com");
& start chrome https://www.google.com/search?q=$uri
}
New-Alias -Name gs -Value Get-OpenGoogleFilterToStackOverflow
$i += "gs -> open up google with query filtered to stack overflow"
function Get-OpenDashboard {
Write-Host Opening Current Dashboard
& start chrome https://microsoft.visualstudio.com/DefaultCollection/OS/_sprints/taskboard/MMX_YourPhone%20Foundations/
}
New-Alias -Name d -Value Get-OpenDashboard
New-Alias -Name dash -Value Get-OpenDashboard
New-Alias -Name dashboard -Value Get-OpenDashboard
$i += "d, dash, dashboard -> open up current sprint dashboard"
function isAdmin() {
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# $arguments = "& '" + $myinvocation.mycommand.definition + "'"
# Start-Process powershell -Verb runAs -ArgumentList $arguments
# Break
return $false
}
return $true
}
function runAsAdmin() {
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$arguments = $myinvocation.mycommand.definition
# Write-Host "Running with args: $arguments"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
Write-Host "Finished, in admin role"
}
function Open-AdminPowershell {
Write-Host Opening admin window
Write-Host "$args"
& Start-Process pwsh -workingdirectory . -verb runas -argumentlist "$args"
}
New-Alias -Name admin -Value Open-AdminPowershell
$i += "admin -> open up admin powershell window"
function Toggle-SpotifyConnection {
param([switch] $block)
# For this one, make a rule on the windows defender firewall that blocks the spotify connection and disable it
# when you enabled this, it will enable blocking spotify
# Disable-NetFirewallRule -DisplayName "Spotify Music"
# Enable-NetFirewallRule -DisplayName "Spotify Music"
if (isAdmin) {
if ($args) {
Write-Host "Connecting Spotify to the internet"
Enable-NetFirewallRule -Name "{78E1CD88-49E3-476E-B926-580E596AD309}"
} else {
Write-Host "Disconnecting Spotify from the internet"
Enable-NetFirewallRule -Name "{78E1CD88-49E3-476E-B926-580E596AD309}"
}
} else {
Write-Host "Copy the following command in the new window, or run command again from there" -ForegroundColor DarkMagenta
if ($args) {
Write-Host "Connecting Spotify to the internet"
Write-Host ' Enable-NetFirewallRule -Name "{78E1CD88-49E3-476E-B926-580E596AD309}"' -ForegroundColor DarkBlue
} else {
Write-Host "Disconnecting Spotify from the internet"
Write-Host ' Enable-NetFirewallRule -Name "{78E1CD88-49E3-476E-B926-580E596AD309}"' -ForegroundColor DarkBlue
}
admin # open admin window to run command
}
}
New-Alias -Name spotify -Value Toggle-SpotifyConnection
New-Alias -Name ss -Value Toggle-SpotifyConnection
$i += "ss, spotify -> toggle spotify firewall rule on or off"
# function ss {
# write-host "ssss"
# write-host "$myinvocation.mycommand.definition"
# If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")){
# $arguments = "& '" + $myinvocation.mycommand.definition + "'"
# Start-Process powershell -Verb runAs -ArgumentList $arguments
# Break
# }
# }
function List-History {
$hash = GetHistory
$command = fShowMenu "Select command from history" $hash
write-host "history $command"
Invoke-Expression $command
# & git checkout $checkout
}
New-Alias -Name hi -Value List-History
New-Alias -Name lh -Value List-History
$i += "hi, lh -> get list of history of commands and execute selected again"
function GetHistory {
$history = history
$hash = @{ }
$history | foreach {
write-host $_.CommandLine
$hash.add($_.CommandLine, $_.CommandLine)
}
write-host $hash
return $hash
}
$i += '```'
$i += ""
$i += "## GIT ----------------------------------------------"
$i += '```'
# git status
# usage s
function GitStatus {
GitBranch
Blue("Changes")
& git status $args
}
New-Alias -Name s -Value GitStatus
$i += "s -> git status"
# git commit
# usage co "Commit message"
# c -> git add -A; git commit -am <commit message>
function GitCommit {
Write-Host "Git add -A; Git commit <message>"
& git add -A; git commit -am $args
}
New-Alias -Name co -Value GitCommit
New-Alias -Name commit -Value GitCommit
New-Alias -Name aa -Value GitCommit
$i += "co, commit, aa -> git add -A, git commit <message>"
# a -> git add -A
function GitAdd { & git add -A }
New-Alias -Name a -Value GitAdd
$i += "a -> git add -A"
# branch -> git branch
function GitBranch {
Blue("Branch")
& git branch
}
New-Alias -Name b -Value GitBranch
New-Alias -Name branch -Value GitBranch
$i += "b, branch -> git branch"
function GitBranchesToHashtable {
$branches = git branch
$hash = @{ }
$branches | foreach {
$value = $_.trim()
$displayName = $value.replace( '*', '').trim()
$hash.add($displayName, $value)
}
write-host $hash
return $hash
}
# branch -> git branch
function GitDeleteBranch {
$hash = GitBranchesToHashtable
$toDelete = fShowMenu "Delete Branch" $hash -highlight 4
& git branch -d $toDelete
}
New-Alias -Name db -Value GitDeleteBranch
New-Alias -Name delete -Value GitDeleteBranch
$i += "db, delete -> delete branch"
# nbranch -> git checkout -b <branch name>
function Git-CheckoutNewBranch { & git checkout -b $args }
New-Alias -Name nbr -Value Git-CheckoutNewBranch
New-Alias -Name nbranch -Value Git-CheckoutNewBranch
$i += "nbr, nbranch -> git checkout -b <branch name>"
# nbranch -> git checkout -b <branch name>
function Git-Checkout {
if ([string]::IsNullOrEmpty($args)) {
$hash = GitBranchesToHashtable
$checkout = fShowMenu "Checkout Branch" $hash
write-host "checkout $checkout"
& git checkout $checkout
} else {
& git checkout $args
}
}
New-Alias -Name check -Value Git-Checkout
New-Alias -Name checkout -Value Git-Checkout
$i += "check, checkout -> git checkout <branch name> | args, alternately use empty and checkout from menu"
# push -> set upstream and push
function GitPushSetUpstream {
& git push --set-upstream origin $(git branch --show-current)
}
New-Alias -Name push -Value GitPushSetUpstream
$i += "push -> git push set upstream"
# todo add way to checkout with find, takes in list of "git branch" then autocompletes
# todo add way to set automatically when pushing and I get this error git branch --set-upstream-to=origin/<branch> user/tren/syncRefactor
function GitClean { & git clean -fdx }
New-Alias -Name clean -Value GitClean
$i += "clean -> git clean -fdx, clears all non-tracked files in repo"
# dev -> git checkout development
function CheckoutDevelopment { & git checkout development }
New-Alias -Name dev -Value CheckoutDevelopment
$i += "dev -> git checkout development"
# dev -> git checkout development
function GitPull { & git pull }
New-Alias -Name p -Value GitPull
New-Alias -Name pull -Value GitPull
$i += "p, pull -> git pull"
function GitLog { & git log }
New-Alias -Name l -Value GitLog
New-Alias -Name log -Value GitLog
$i += "l, log -> git log"
function GitLogOneLine { & git log --oneline }
New-Alias -Name lo -Value GitLogOneLine
$i += "lo -> git log --oneline"
function GitSoft { & git reset --soft HEAD~ }
New-Alias -Name gitsoft -Value GitSoft
New-Alias -Name soft -Value GitSoft
$i += "soft, gitsoft -> git reset --soft HEAD~"
function GitResetToLastCommit {
Write-Host "Resetting git to last commit (git add -A; git reset --hard)"
& git add -A; git reset --hard
}
New-Alias -Name reset -Value GitResetToLastCommit
New-Alias -Name re -Value GitResetToLastCommit
$i += "re, reset -> git add -A; git reset --hard"
function GitStash {
Write-Host "Adding changes and stashing (git add -A; git stash $args)"
& git add -A; git stash $args
}
New-Alias -Name stash -Value GitStash
$i += "stash -> git add -A; git stash"
function GitDiff { & git diff }
New-Alias -Name di -Value GitDiff
$i += "di -> git diff"
$i += '```'
$i += ""
$i += "## Folders ------------------------------------------"
$i += '```'
function CdPr { & cd C:\Users\trrensha\code\PR_FOLDER\Shell.MMX }
New-Alias -Name pr -Value CdPr
$i += "pr -> cd to pr directory"
function CdFirst { & cd C:\Users\trrensha\code\Shell.MMX }
New-Alias -Name first -Value CdFirst
New-Alias -Name one -Value CdFirst
$i += "one, first -> cd to first code folder (C:\Users\trrensha\code\Shell.MMX)"
function CdSecond { & cd C:\Users\trrensha\code\DUPLICATE\Shell.MMX }
New-Alias -Name second -Value CdSecond
New-Alias -Name dup -Value CdSecond
New-Alias -Name two -Value CdSecond
$i += "two, second, dup -> cd to second code folder"
function CdThird { & cd C:\Users\trrensha\code\TRIPLICATE\Shell.MMX }
New-Alias -Name third -Value CdThird
New-Alias -Name trip -Value CdThird
New-Alias -Name three -Value CdThird
$i += "three, third, trip -> cd to third code folder"
function CdFourth { & cd C:\Users\trrensha\code\QUATERNARY\Shell.MMX }
New-Alias -Name fourth -Value CdFourth
New-Alias -Name quat -Value CdFourth
New-Alias -Name quad -Value CdFourth
New-Alias -Name four -Value CdFourth
$i += "four, fourth, quad -> cd to fourth code folder, also quat works"
# go to code base directory
function CdCode { & cd C:\Users\trrensha\code }
New-Alias -Name cdc -Value CdCode
New-Alias -Name cc -Value CdCode
$i += "cc, cdc -> cd to base code folder"
function CdData { & cd C:\Users\trrensha\code\data }
New-Alias -Name dat -Value CdData
$i += "dat -> cd to data repo"
function CdCDP { & cd C:\Users\trrensha\code\cdp }
New-Alias -Name cdp -Value CdCDP
$i += "cdp -> cd to cdp repo"
function CdAppManager { & cd C:\Users\trrensha\code\YourPhoneCompanion }
New-Alias -Name appManager -Value CdAppManager
New-Alias -Name ypc -Value CdAppManager
$i += "ypc, appManager -> cd to YPC repo"
function CdDownloads { & cd C:\Users\trrensha\Downloads }
New-Alias -Name down -Value CdDownloads
New-Alias -Name download -Value CdDownloads
New-Alias -Name downloads -Value CdDownloads
$i += "down, download/s -> cd to downloads folder"
function CdDocuments { & cd C:\Users\trrensha\Documents }
New-Alias -Name docs -Value CdDocuments
New-Alias -Name documents -Value CdDocuments
New-Alias -Name doc -Value CdDocuments
$i += "doc/s, documents -> cd to documents folder"
# go to code base directory
function See-MyBranches {
$loc = Get-Location
"First"
cd C:\Users\trrensha\code\Shell.MMX; git branch
"Dup"
cd C:\Users\trrensha\code\DUPLICATE\Shell.MMX; git branch
"Trip"
cd C:\Users\trrensha\code\TRIPLICATE\Shell.MMX; git branch
"Quat"
cd C:\Users\trrensha\code\QUATERNARY\Shell.MMX; git branch
"PR"
cd C:\Users\trrensha\code\PR_FOLDER\Shell.MMX; git branch
& cd $loc
}
New-Alias -Name lb -Value See-MyBranches
New-Alias -Name branches -Value See-MyBranches
$i += "lb, branches -> see what branches my repos are in"
$i += '```'
$i += "## Functions ----------------------------------------"
$i += '```'
function Blue() {
Write-Host
Write-Host $args -ForegroundColor DarkBlue
}
$i += "blue() -> print out string with blue foreground"
$i += "he, macro-help -> print out this information, add -raw or other flag to print out md to console"
function Get-MacroHelp {
if ($args){
write-host "Printing out raw format"
}
& Write-Host Macro usage, file found:
$PSCommandPath
foreach ($item in $i) {
# -or $item[0] -eq '#'
if (!$args -and ($item[0] -eq '`') ){
# write-host "Don't print"
} else {
Write-Host $item
}
}
# clear
}
New-Alias -Name he -Value Get-MacroHelp
New-Alias -Name macro-help -Value Get-MacroHelp
$i += '```'
he # print out on load

MACROS -------------------------------------------

edit                -> open up powershell profile to edit macros
t, touch            -> create file 'New-Item <file name>'
e                   -> open up explorer window in current directory
w, wex              -> open up explorer to wexfs scripts directory
c                   -> open up vs code in current directory
lua                 -> run Lua Macros with config file
vss                 -> open up visual studio
vs, visual-studio   -> open up visual studio, arg for directory
as, android-studio  -> open up android studio
so, stackoverflow   -> open up stack overflow with query
g, google           -> open up google with query
gs                  -> open up google with query filtered to stack overflow
d, dash, dashboard  -> open up current sprint dashboard
admin               -> open up admin powershell window
ss, spotify         -> toggle spotify firewall rule on or off
hi, lh              -> get list of history of commands and execute selected again

GIT ----------------------------------------------

s                   -> git status
co, commit, aa      -> git add -A, git commit <message>
a                   -> git add -A
b, branch           -> git branch
db, delete          -> delete branch
nbr, nbranch        -> git checkout -b <branch name>
check, checkout     -> git checkout <branch name> | args, alternately use empty and checkout from menu   
push                -> git push set upstream
clean               -> git clean -fdx, clears all non-tracked files in repo
dev                 -> git checkout development
p, pull             -> git pull
l, log              -> git log
lo                  -> git log --oneline
soft, gitsoft       -> git reset --soft HEAD~
re, reset           -> git add -A; git reset --hard
stash               -> git add -A; git stash
di                  -> git diff

Folders ------------------------------------------

pr                  -> cd to pr directory
one, first          -> cd to first code folder (C:\Users\trrensha\code\Shell.MMX)
two, second, dup    -> cd to second code folder
three, third, trip  -> cd to third code folder
four, fourth, quad  -> cd to fourth code folder, also quat works
cc, cdc             -> cd to base code folder
dat                 -> cd to data repo
cdp                 -> cd to cdp repo
ypc, appManager     -> cd to YPC repo
down, download/s    -> cd to downloads folder
doc/s, documents    -> cd to documents folder
lb, branches        -> see what branches my repos are in

Functions ----------------------------------------

blue()              -> print out string with blue foreground
he, macro-help      -> print out this information, add -raw or other flag to print out md to console     
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment