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