-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.ps1
70 lines (63 loc) · 2.06 KB
/
profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Set-Theme Paradox
# Git helpers
Function st { git st $args }
Function stand { git stand $args }
Function ci { git ci $args }
Function cia { git ci --amend $args }
Function lol { git lol $args }
Function rsh { git reset --hard $args }
Function p { git pr $args }
Function ri { git rebase -i $args }
Function sd { npm run start:devserver }
Function nr { npm run $args }
Function dn { dotnet watch $args }
Function sncu { ncu "/^$args[1]-.*$/" $args[2] }
Function gconf { code ~/.gitconfig }
Function c { code --disable-gpu }
Function yd { youtube-dl $args }
Function dr {
cd ..
dotnet watch run
}
function Edit-ProfileFile{
code 'C:\projects\dotfiles\powershell\profile.ps1'
}
Set-Alias epf Edit-ProfileFile
Function getProjectRootPath { git rev-parse --show-toplevel }
Function gitemail { git config user.email "[email protected]" }
function dam {
git branch --merged |
ForEach-Object { $_.Trim() } |
Where-Object { $_ -NotMatch "^\*" } |
Where-Object { -not ( $_ -Like "*master" ) } |
ForEach-Object { git branch -d $_ }
}
# refresh env vars without restarting process
# pasted from here: http://stackoverflow.com/a/22670892/1715138
function rvars {
foreach ($level in "Machine", "User") {
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
# For Path variables, append the new values, if they're not already in there
if ($_.Name -match 'Path$') {
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -split ';' | Select -unique) -join ';'
}
$_
} | Set-Content -Path { "Env:$($_.Name)" }
}
}
function bjl {
Write-Host "backing up jump-location file"
cp ~\jump-location.txt ~\jump-location.bak.txt
}
function fixjl {
Write-Host "fixing jump-location file"
cp ~\jump-location.bak.txt ~\jump-location.txt
rm ~\jump-location.txt.tmp
}
#For deleting dir/files with really long paths
function scrub {
mkdir empty_temp
robocopy empty_temp $args /s /mir /NFL /NDL /NJH /NJS /nc /ns /np
rmdir empty_temp
rmdir $args
}