-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microsoft.PowerShell_profile.ps1
79 lines (63 loc) · 2 KB
/
Microsoft.PowerShell_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
71
72
73
74
75
76
77
78
79
#Import-Module posh-git
Import-Module 'C:\Users\User\code\posh-git\src\posh-git.psd1'
# PowerShell ReadLine enhancements
# https://github.com/lzybkr/PSReadLine
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadline
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadlineKeyHandler -Key Tab -Function Complete
}
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
function Docker-Connect {
$StatusOfDev = docker ps -a --filter "name=dev" --format "{{.Status}}"
if ($StatusOfDev.StartsWith("Exit")) {
docker start postgres
docker start dev
}
docker exec -t -i dev /bin/bash -c 'su - wherewolf'
}
function Docker-Run {
C:\Users\User\code\docker\postgres\run.ps1
C:\Users\User\code\docker\dev\run.ps1
}
function Docker-Root {
docker exec -t -i dev /bin/bash
}
function gits {
git status
}
function Maximise-All-Windows {
$dllInfo = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
Add-Type -MemberDefinition $dllInfo -name NativeMethods -namespace Win32
foreach($proc in Get-Process){
$hwnd = $proc.MainWindowHandle
# Restore window
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 3) | Out-Null
}
}
function Meld([string]$arg1, [string]$arg2) {
C:\Program` Files` `(x86`)\Meld\Meld.exe $arg1 $arg2
}
function reboot() {
shutdown -t 0 -r -f
}
function subl([string]$arg1) {
C:\Program` Files\Sublime` Text` 3\sublime_text.exe $arg1
}
function tig() {
if(-Not ($env:PATH.Contains("C:\cygwin64\bin"))) {
echo 'cygwin not in path, appending environment variable'
$env:PATH += ";C:\cygwin64\bin\";
}
iex -c 'C:\cygwin64\bin\bash.exe -c "/usr/bin/tig"';
}
Set-Location ~/code
Set-Alias dc Docker-Connect
Set-Alias dr Docker-Run