From 69305155601a1f962147cbcf3dd0d05355c90589 Mon Sep 17 00:00:00 2001 From: Edward Delaporte Date: Fri, 11 Sep 2020 10:16:35 -0500 Subject: [PATCH] Move install scripts together. --- .gitignore | 6 +++- .vscode/settings.json | 3 +- Microsoft.PowerShell_profile.ps1 | 11 +++++- bootstrap.ps1 | 21 ++--------- cheatsheets/github.py | 58 +++++++++++++++++++++++++++++++ cheatsheets/requirements.txt | 9 +++++ cheatsheets/setup.ps1 | 1 + install_art.sh => install/art.sh | 2 +- install/dev.ps1 | 20 +++++++++++ this.code-workspace | 6 ++-- vaultconfig.hcl | 9 ----- vscode-extensions.txt | Bin 0 -> 1878 bytes 12 files changed, 110 insertions(+), 36 deletions(-) create mode 100644 cheatsheets/github.py create mode 100644 cheatsheets/requirements.txt create mode 100644 cheatsheets/setup.ps1 rename install_art.sh => install/art.sh (83%) mode change 100755 => 100644 create mode 100644 install/dev.ps1 delete mode 100644 vaultconfig.hcl create mode 100644 vscode-extensions.txt diff --git a/.gitignore b/.gitignore index dde2b51..54d8b36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ *.log -DONE.md \ No newline at end of file +DONE.md +.github_access_token +env/* +*.json +OneTrust.ipynb \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 4a059b8..d84e3d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,6 @@ "titleBar.inactiveBackground": "#21573299", "titleBar.inactiveForeground": "#e7e7e799" }, - "peacock.color": "#215732" + "peacock.color": "#215732", + "python.pythonPath": "c:\\src\\dotfiles\\env\\Scripts\\python.exe" } \ No newline at end of file diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index 02abc31..7f54a1d 100644 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -29,7 +29,11 @@ $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in. function Find-LargeFiles() { - Get-ChildItem c:\ -r| sort -descending -property length | select -first 10 name, Length, Location + Get-ChildItem c:\ -r| sort -descending -property length | select -first 10 name, Length, FullName +} + +function List-DriveSpace() { + Get-PSDrive C | Select-Object Used,Free } @@ -113,6 +117,11 @@ function Start-DockerFindSecrets { docker run -v /c/src:/etc/src dxa4481/trufflehog /etc/src/SecOps-Tools } +function Export-VSCodeExtensions { + code --list-extensions | Out-File -FilePath /src/dotfiles/vscode-extensions.txt + Get-Content -Path /src/dotfiles/vscode-extensions.txt +} + #requires -version 5.1 #ConvertTo-ASCIIArt.ps1 diff --git a/bootstrap.ps1 b/bootstrap.ps1 index b297d75..807826c 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -19,18 +19,6 @@ if(! $profileContents -contains $sourceMeLine) { # TODO Install Chocolatey -# PoshGit -PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force - - -if($false) { - choco install docker-desktop -} - -if($false) { - choco install gnupg - gpg --full-generate-key -} # Install Python3 and Pip # Install Stub PowerShell Profile that sources the one from DotFiles @@ -56,10 +44,6 @@ if($false) { choco install zap } -# Install GNU Make for Windows -if($false) { - choco install make -} ## TODO: Can I set this via command line: chrome://flags/#enable-force-dark if($doBootStrap) { @@ -72,6 +56,5 @@ if($false) { choco install archi } -if($false) { - choco install powershell-core -} \ No newline at end of file +# Install dev tools +./install/dev.ps1 \ No newline at end of file diff --git a/cheatsheets/github.py b/cheatsheets/github.py new file mode 100644 index 0000000..dab4849 --- /dev/null +++ b/cheatsheets/github.py @@ -0,0 +1,58 @@ +""" +Recently Updated Open GitHub Issues +""" + +import http.client + +conn = http.client.HTTPSConnection("api.github.com") + +payload = "" +token = open('./.github_access_token').read() +headers = { 'authorization': "token {}".format(token), + 'User-Agent': 'Python Jupyter Notebook'} +conn.request("GET", "/issues?state=open&sort=updated", payload, headers) + +res = conn.getresponse() +data = res.read() + +results = data.decode("utf-8") + +data_file = 'gh_open.json' +f = open(data_file, "w") +f.write(results) +f.close() +print("Updated {} with {} length".format(data_file, len(results))) + +import pandas + +pdata = pandas.read_json(data_file) +# print(pdata.title.head(3)) + +from simple_rest_client import api + +token = open('./.github_access_token').read() +headers = { 'authorization': "token {}".format(token), + 'User-Agent': 'Python Jupyter Notebook'} +gh = api.API(api_root_url="https://api.github.com", headers=headers, + append_slash=False, + json_encode_body=True) + +gh.add_resource(resource_name='issues') +gh.issues.actions + +results = gh.issues.list(params=query) +titles = list(map(lambda t : t["title"], results.body)) + +from simple_rest_client import api + +token = open('./.github_access_token').read() +headers = { 'authorization': "token {}".format(token), + 'User-Agent': 'Python Jupyter Notebook'} +gh = api.API(api_root_url="https://api.github.com", headers=headers, + append_slash=False, + json_encode_body=True) + +gh.add_resource(resource_name='issues') +gh.issues.actions + +titles = list(map(lambda t : t["title"], results.body)) \ No newline at end of file diff --git a/cheatsheets/requirements.txt b/cheatsheets/requirements.txt new file mode 100644 index 0000000..357b0d2 --- /dev/null +++ b/cheatsheets/requirements.txt @@ -0,0 +1,9 @@ +PyGitHubcertifi==2020.6.20 +chardet==3.0.4 +Deprecated==1.2.10 +idna==2.10 +PyGithub==1.53 +PyJWT==1.7.1 +requests==2.24.0 +urllib3==1.25.11 +wrapt==1.12.1 \ No newline at end of file diff --git a/cheatsheets/setup.ps1 b/cheatsheets/setup.ps1 new file mode 100644 index 0000000..fd68d89 --- /dev/null +++ b/cheatsheets/setup.ps1 @@ -0,0 +1 @@ +py -m venv env diff --git a/install_art.sh b/install/art.sh old mode 100755 new mode 100644 similarity index 83% rename from install_art.sh rename to install/art.sh index caa2c83..905dfd8 --- a/install_art.sh +++ b/install/art.sh @@ -5,4 +5,4 @@ if [ ! -f ~/.installed/gimp ]; then touch ~/.installed/gimp fi -ls -al ~/.installeear +ls -al ~/.installed diff --git a/install/dev.ps1 b/install/dev.ps1 new file mode 100644 index 0000000..53d4877 --- /dev/null +++ b/install/dev.ps1 @@ -0,0 +1,20 @@ +if(-Not(Test-Path -Path ~/.installed)) { + New-Item -ItemType Directory -Path ~/.installed +} + +if(-Not(Test-Path -Path ~/.installed/dev)) { + choco install docker-desktop + choco install powershell-core + choco install make # Install GNU Make for Windows + choco install act-cli # GitHub action runner + # PowerShell git aware prompt + PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force + New-Item -ItemType File -Path ~/.installed/dev +} + +if(-Not(Test-Path -Path ~/.ssh/id_rsa.pub)) { + choco install gnupg + gpg --full-generate-key +} + +Get-ChildItem -Path ~/.installed \ No newline at end of file diff --git a/this.code-workspace b/this.code-workspace index a63f297..f3c688b 100644 --- a/this.code-workspace +++ b/this.code-workspace @@ -2,9 +2,6 @@ "folders": [ { "path": "." - }, - { - "path": ".." } ], "settings": { @@ -24,6 +21,7 @@ "titleBar.inactiveBackground": "#42b88399", "titleBar.inactiveForeground": "#15202b99" }, - "peacock.color": "#42b883" + "peacock.color": "#42b883", + "python.dataScience.jupyterServerURI": "local" } } \ No newline at end of file diff --git a/vaultconfig.hcl b/vaultconfig.hcl deleted file mode 100644 index fa135b0..0000000 --- a/vaultconfig.hcl +++ /dev/null @@ -1,9 +0,0 @@ -storage "consul" { - address = "127.0.0.1:8500" - path = "vault/" -} - -listener "tcp" { - address = "127.0.0.1:8200" - tls_disable = 1 -} \ No newline at end of file diff --git a/vscode-extensions.txt b/vscode-extensions.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3a7ef28cac0d28acef7d223ac3dbd40fde3be29 GIT binary patch literal 1878 zcmb7_TXNb!5Jl%ZRawet6G@e`0B?YYco_tdL>#>MBIs??=Js?(NFo7QQWR;f>4)0Z^G+N2G;6MU*P!(-2?P8o~-dVOcz5|Pt4cIWI? zd=IwS+4eur1zCS0BQ(Hui<}z?VF2u$_3^Yxtf)zXYpjFc7JGxI9t%9CW!Kp->w&k1m3bkZwmsk|KzPMdgXWhtY-Bk z{mFz~s9Lb}MBEWuj{--mOMGN#U^25Zb0Bd}WTKV`TiVw?k? z+Zd;EQl>#YjIiq&F-}XIVl}CFCS-5u#&daHV@I{j?i(G5RqXcatuscbI)m;}%g6&A z%Xr)v*KZe}OHNT#^mRPP4HFY6#`Q$ABd_Py4lZxvw_bnl$}DkuKAY#2xVTI2BP%e< zR%CakhI=CcSj{|EE~TO0rY literal 0 HcmV?d00001 -- 2.47.3