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