]> us-delaporte.pagekite.me Git - dotfiles.git/blob - Microsoft.PowerShell_profile.ps1
VSCode workspace color set.
[dotfiles.git] / Microsoft.PowerShell_profile.ps1
1
2
3 ## Setup reminder:
4 # code $profile
5 # Set-ExecutionPolicy RemoteSigned
6 # . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1
7
8
9 Import-Module posh-git
10 # Courtesty of MKletz
11 # Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process {
12 # $Path = Split-Path -Path $_.Directory -Parent
13 # $env:PSModulePath = $env:PSModulePath + ";$($Path)"
14 #}
15 $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'')
16
17 # Kali linux env
18 $ENV:PATH +=":/home/delaport/development/flutter/bin" # Flutter in Kali under WSL
19
20 # Some Paths that are annoying to find/restore if the installer fails
21 $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all
22 $ENV:PATH+=";C:\Program Files\Python38\Scripts\;C:\Program Files\Python38\" # Python latest as of 2019 December
23 $ENV:PATH+=";C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin" # Docker for R Studio and Jupyter
24 $ENV:PATH+=";C:\Program Files (x86)\Common Files\Oracle\Java\javapath" # Don't remember why I still care about Java.
25 $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice.
26 $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice.
27 $ENV:PATH+=";C:\Program Files\nodejs" # KataKoda wants to add tools via npm
28 $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in.
29
30
31
32 function Start-Vault() {
33 consul agent -dev # Run in Dev Mode
34 vault sever -config c:\src\dotfiles\vaultconfig.hcl -address=http://127.0.0.1:8200 # Use local dev Consul as storage
35 }
36
37 function New-DockerRStudio() {
38 docker run --name=rpython -Pit -p 8888:8888 -p 8787:8787 -p 8022:22 -p 6006:6006 -v c:\src\data:/mnt/data datascienceschool/rpython
39 }
40 function Start-DockerRStudio() {
41 docker start rpython
42 jupyter notebook list
43 Write-Host "R Studio is running at http://localhost:8787/"
44 Write-Host "Jupyter is running at http://localhost:8888/"
45 }
46
47 function Start-DockerOWASPZap() {
48 Param(
49 [string]$URL
50 )
51 # https://github.com/zaproxy/zaproxy/wiki/Docker
52 docker run owasp/zap2docker-stable
53 docker run -i owasp/zap2docker-stable zap-cli quick-scan --self-contained --start-options '-config api.disablekey=true' $URL
54 Write-Host "https://github.com/zaproxy/zaproxy/wiki/Docker"
55 }
56
57
58 function Start-DockerWebGoat() {
59 docker pull webgoat/webgoat-8.0
60 docker run -p 8080:8080 -t webgoat/webgoat-8.0
61 Write-Host "Vulnerable Webgoat running on 8080"
62 }
63
64 function Start-DockerJuiceShop() {
65 docker pull bkimminich/juice-shop
66 docker run --rm -p 3000:3000 bkimminich/juice-shop
67 Write-Host "Vulnerable Juice Shop running on 3000"
68 }
69
70 function Start-DockerGrafana() {
71 docker run --rm -d --name=grafana -p 3001:3001 -user $ID --volume "C:\src\data:/var/lib/grafana" grafana/grafana
72 Write-Host "Grafana running on 3001"
73 }
74
75 # Import some home grown PowerShell modules, if they are installed.
76 $modPaths = @("C:\src\dotfiles\ToyBox\toybox.psm1")
77 $modPaths | ForEach-Object {
78 $_ | Format-Table
79 if(Test-Path -Path $_) {
80 Import-Module $_
81 Write-Host "Loaded $_"
82 }
83 }
84
85 function Start-DockerPython3Bash {
86 docker run -it python /bin/bash
87 }
88
89 function Start-DockerPython2Bash {
90 docker run -it python:2-buster /bin/bash
91 }
92
93 function Stop-Docker {
94 docker stop $(docker ps -a -q)
95 }
96
97 function New-DockerAirflow {
98 docker run -v ./:/etc/myscripts apache/airflow /bin/bash /etc/myscripts/airflow.sh
99
100 }
101
102 function Start-DockerAirflow {
103 docker run airflow -f webserver
104 }
105
106 function Start-DockerFindSecrets {
107 # docker run -v "$((Get-Item .).FullName)":/etc/src dxa4481/trufflehog /bin/bash
108 # Write-Host "Current folder mounted as /etc/src"
109 docker run -v /c/src:/etc/src dxa4481/trufflehog /etc/src/SecOps-Tools
110 }
111
112
113 #requires -version 5.1
114 #ConvertTo-ASCIIArt.ps1
115
116 <#
117 font list at https://artii.herokuapp.com/fonts_list
118 font names are case-sensitive
119
120 invoke-restmethod https://artii.herokuapp.com/fonts_list
121
122 #>
123
124 <#
125 .SYNOPSIS
126 Output strings as ASCII art fonts.
127
128 .EXAMPLE
129 cart "Testing"-Font cursive
130
131 .NOTES
132 From https://jdhitsolutions.com/blog/powershell/7278/friday-fun-powershell-ascii-art/
133 #>
134 Function ConvertTo-ASCIIArt {
135 [cmdletbinding()]
136 [alias("cart")]
137 [outputtype([System.String])]
138 Param(
139 [Parameter(Position = 0, Mandatory, HelpMessage = "Enter a short string of text to convert", ValueFromPipeline)]
140 [ValidateNotNullOrEmpty()]
141 [string]$Text,
142 [Parameter(Position = 1,HelpMessage = "Specify a font from https://artii.herokuapp.com/fonts_list. Font names are case-sensitive")]
143 [ValidateNotNullOrEmpty()]
144 [string]$Font = "big"
145 )
146
147 Begin {
148 Write-Verbose "[$((Get-Date).TimeofDay) BEGIN] Starting $($myinvocation.mycommand)"
149 } #begin
150
151 Process {
152 Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Processing $text with font $Font"
153 $testEncode = [uri]::EscapeDataString($Text)
154 $url = "http://artii.herokuapp.com/make?text=$testEncode&font=$Font"
155 Try {
156 Invoke-Restmethod -Uri $url -DisableKeepAlive -ErrorAction Stop
157 }
158 Catch {
159 Throw $_
160 }
161 } #process
162 End {
163 Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)"
164 } #end
165 }
166
167
168 #### User Configuraable Variables ####
169 ## https://github.com/techservicesillinois/Powershell-SupportApp
170
171 # Customize the title bar of your console.
172 [string]$SA_title="PowerShell Support App for U of I"
173 # Path to a text editor
174 [string]$SA_TextEditor="C:\Program Files (x86)\Notepad++\notepad++.exe"
175 $SA_Config_base=$true
176 import-module .\PowerShellSupportAppV2\PowerShellSupportAppV2.psm1