]> 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 function Find-LargeFiles() {
32 Get-ChildItem c:\ -r| sort -descending -property length | select -first 10 name, Length, Location
33 }
34
35
36 function Start-Vault() {
37 consul agent -dev # Run in Dev Mode
38 vault sever -config c:\src\dotfiles\vaultconfig.hcl -address=http://127.0.0.1:8200 # Use local dev Consul as storage
39 }
40
41 function New-DockerRStudio() {
42 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
43 }
44 function Start-DockerRStudio() {
45 docker start rpython
46 jupyter notebook list
47 Write-Host "R Studio is running at http://localhost:8787/"
48 Write-Host "Jupyter is running at http://localhost:8888/"
49 }
50
51 function Start-DockerOWASPZap() {
52 Param(
53 [string]$URL
54 )
55 # https://github.com/zaproxy/zaproxy/wiki/Docker
56 docker run owasp/zap2docker-stable
57 docker run -i owasp/zap2docker-stable zap-cli quick-scan --self-contained --start-options '-config api.disablekey=true' $URL
58 Write-Host "https://github.com/zaproxy/zaproxy/wiki/Docker"
59 }
60
61
62 function Start-DockerWebGoat() {
63 docker pull webgoat/webgoat-8.0
64 docker run -p 8080:8080 -t webgoat/webgoat-8.0
65 Write-Host "Vulnerable Webgoat running on 8080"
66 }
67
68 function Start-DockerJuiceShop() {
69 docker pull bkimminich/juice-shop
70 docker run --rm -p 3000:3000 bkimminich/juice-shop
71 Write-Host "Vulnerable Juice Shop running on 3000"
72 }
73
74 function Start-DockerGrafana() {
75 docker run --rm -d --name=grafana -p 3001:3001 -user $ID --volume "C:\src\data:/var/lib/grafana" grafana/grafana
76 Write-Host "Grafana running on 3001"
77 }
78
79 # Import some home grown PowerShell modules, if they are installed.
80 $modPaths = @("C:\src\dotfiles\ToyBox\toybox.psm1")
81 $modPaths | ForEach-Object {
82 $_ | Format-Table
83 if(Test-Path -Path $_) {
84 Import-Module $_
85 Write-Host "Loaded $_"
86 }
87 }
88
89 function Start-DockerPython3Bash {
90 docker run -it python /bin/bash
91 }
92
93 function Start-DockerPython2Bash {
94 docker run -it python:2-buster /bin/bash
95 }
96
97 function Stop-Docker {
98 docker stop $(docker ps -a -q)
99 }
100
101 function New-DockerAirflow {
102 docker run -v ./:/etc/myscripts apache/airflow /bin/bash /etc/myscripts/airflow.sh
103
104 }
105
106 function Start-DockerAirflow {
107 docker run airflow -f webserver
108 }
109
110 function Start-DockerFindSecrets {
111 # docker run -v "$((Get-Item .).FullName)":/etc/src dxa4481/trufflehog /bin/bash
112 # Write-Host "Current folder mounted as /etc/src"
113 docker run -v /c/src:/etc/src dxa4481/trufflehog /etc/src/SecOps-Tools
114 }
115
116
117 #requires -version 5.1
118 #ConvertTo-ASCIIArt.ps1
119
120 <#
121 font list at https://artii.herokuapp.com/fonts_list
122 font names are case-sensitive
123
124 invoke-restmethod https://artii.herokuapp.com/fonts_list
125
126 #>
127
128 <#
129 .SYNOPSIS
130 Output strings as ASCII art fonts.
131
132 .EXAMPLE
133 cart "Testing"-Font cursive
134
135 .NOTES
136 From https://jdhitsolutions.com/blog/powershell/7278/friday-fun-powershell-ascii-art/
137 #>
138 Function ConvertTo-ASCIIArt {
139 [cmdletbinding()]
140 [alias("cart")]
141 [outputtype([System.String])]
142 Param(
143 [Parameter(Position = 0, Mandatory, HelpMessage = "Enter a short string of text to convert", ValueFromPipeline)]
144 [ValidateNotNullOrEmpty()]
145 [string]$Text,
146 [Parameter(Position = 1,HelpMessage = "Specify a font from https://artii.herokuapp.com/fonts_list. Font names are case-sensitive")]
147 [ValidateNotNullOrEmpty()]
148 [string]$Font = "big"
149 )
150
151 Begin {
152 Write-Verbose "[$((Get-Date).TimeofDay) BEGIN] Starting $($myinvocation.mycommand)"
153 } #begin
154
155 Process {
156 Write-Verbose "[$((Get-Date).TimeofDay) PROCESS] Processing $text with font $Font"
157 $testEncode = [uri]::EscapeDataString($Text)
158 $url = "http://artii.herokuapp.com/make?text=$testEncode&font=$Font"
159 Try {
160 Invoke-Restmethod -Uri $url -DisableKeepAlive -ErrorAction Stop
161 }
162 Catch {
163 Throw $_
164 }
165 } #process
166 End {
167 Write-Verbose "[$((Get-Date).TimeofDay) END ] Ending $($myinvocation.mycommand)"
168 } #end
169 }
170
171
172 #### User Configuraable Variables ####
173 ## https://github.com/techservicesillinois/Powershell-SupportApp
174
175 # Customize the title bar of your console.
176 [string]$SA_title="PowerShell Support App for U of I"
177 # Path to a text editor
178 [string]$SA_TextEditor="C:\Program Files (x86)\Notepad++\notepad++.exe"
179 $SA_Config_base=$true
180 import-module .\PowerShellSupportAppV2\PowerShellSupportAppV2.psm1