Skip to content

Instantly share code, notes, and snippets.

@ryanvgates
ryanvgates / output.sh
Created July 5, 2023 20:11
Terraform staying current
Planning stack1
Plan: 1 to add, 2 to change, 3 to destroy.
Planning stack2
Plan: 4 to add, 5 to change, 6 to destroy.
@ryanvgates
ryanvgates / create_policy.sh
Created June 30, 2023 20:37
Vault CLI Create Policy
┌─[ryan@host] - [~] - [Thu Jun 22, 14:13]
└─[$] <> cat new-policy.hcl
path "secrets/data/env1/app1/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}
path "secrets/data/env2/app2/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}
┌─[ryan@host] - [~] - [Thu Jun 22, 14:13]
@ryanvgates
ryanvgates / reinstall_pipenv.sh
Created October 13, 2022 19:50
Pipenv Null Markers - Reinstall pipenv
┌─[ryan@host] - [~] - [Wed Oct 05, 16:58]
└─[$] <> pip install pipenv
Collecting pipenv
Downloading pipenv-2022.10.4-py2.py3-none-any.whl (3.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 8.9 MB/s eta 0:00:00
Requirement already satisfied: virtualenv-clone>=0.2.5 in ./.pyenv/versions/3.9.6/lib/python3.9/site-packages (from pipenv) (0.5.7)
Requirement already satisfied: setuptools>=36.2.1 in ./.pyenv/versions/3.9.6/lib/python3.9/site-packages (from pipenv) (57.5.0)
Requirement already satisfied: certifi in ./.pyenv/versions/3.9.6/lib/python3.9/site-packages (from pipenv) (2022.6.15)
Requirement already satisfied: virtualenv in ./.pyenv/versions/3.9.6/lib/python3.9/site-packages (from pipenv) (20.15.0)
Requirement already satisfied: filelock<4,>=3.2 in ./.pyenv/versions/3.9.6/lib/python3.9/site-packages (from virtualenv->pipenv) (3.7.1)
@ryanvgates
ryanvgates / uninstall_pipenv.sh
Created October 13, 2022 19:49
Pipenv Null Markers - Solution Uninstall pipenv
┌─[ryan@host] - [~] - [Wed Oct 05, 16:58]
└─[$] <> pip uninstall pipenv
Found existing installation: pipenv 2022.9.20
Uninstalling pipenv-2022.9.20:
Would remove:
/Users/ryan/.pyenv/versions/3.9.6/bin/pipenv
/Users/ryan/.pyenv/versions/3.9.6/bin/pipenv-resolver
/Users/ryan/.pyenv/versions/3.9.6/lib/python3.9/site-packages/pipenv-2022.9.20.dist-info/*
/Users/ryan/.pyenv/versions/3.9.6/lib/python3.9/site-packages/pipenv/*
Proceed (Y/n)? Y
@ryanvgates
ryanvgates / output.sh
Created October 13, 2022 19:48
Pipenv Null Markers - Problem
(my-app) ┌─[ryan@host] - [~/Documents/git/my-repo] - [Wed Oct 05, 14:29]
└─[$] pipfile2req Pipfile.lock > requirements.txt
Traceback (most recent call last):
File "/Users/ryan/.local/share/virtualenvs/my-app-g5SfM111/bin/pipfile2req", line 8, in
sys.exit(main())
File "/Users/ryan/.local/share/virtualenvs/my-app-g5SfM111/lib/python3.9/site-packages/pipfile2req/init.py", line 112, in main
lines = convert_pipfile_or_lock(
File "/Users/ryan/.local/share/virtualenvs/my-app-g5SfM111/lib/python3.9/site-packages/pipfile2req/init.py", line 96, in convert_pipfile_or_lock
lines = [
File "/Users/ryan/.local/share/virtualenvs/my-app-g5SfM111/lib/python3.9/site-packages/pipfile2req/init.py", line 97, in
@ryanvgates
ryanvgates / solution.sh
Created July 27, 2022 20:00
Terraform Linting in CI
..[ryan@server] - [~/my-project] - [Wed May 11, 02:42]
..[$] <( (git)-[main]-)> terraform fmt -check -diff
tf_code.tf
--- old/tf_code.tf
+++ new/tf_code.tf
@@ -5,5 +5,5 @@
resource "aws_s3_bucket" "tf_course" {
bucket = "tf-course-20220511"
acl = "private"acl = "private"
@ryanvgates
ryanvgates / cyberArk_get_account.ps1
Last active May 23, 2022 20:59
PowerShell CyberArk Get Account
Write-Host "$((get-date).ToString()) - Attempting to retrieve account $username on platform $platformID, address $Address in safe $Safename on $CyberArkHost"
$Account_URI = "https://$CyberArkHost/PasswordVault/api/Accounts?search=$username $platformID $Safename"
$AccountHeader = @{'accept'='application/json';'content-type'='application/json';'Authorization'=$Token}
$getAccountResponse = Invoke-WebRequest -Uri $Account_URI -Method GET -Body $Account_Body -Headers $AccountHeader -UseBasicParsing
return $getAccountResponse
@ryanvgates
ryanvgates / cyberArk_create_account.ps1
Last active May 17, 2022 17:53
PowerShell CyberArk Add Account
Add-Type -AssemblyName System.Web
Write-Host "$((get-date).ToString()) - Attempting to create account $username on platform $platformID, address $Address in safe $Safename on $CyberArkHost"
$Account_URI = "https://$CyberArkHost/PasswordVault/api/Accounts"
$AccountHeader = @{'accept'='application/json';'content-type'='application/json';'Authorization'=$Token}
$Account_Body="{
""address"":""$address"",
@ryanvgates
ryanvgates / solution.ps1
Created April 13, 2022 20:57
CyberArk PowerShell Login
Add-Type -AssemblyName System.Web
$cred = Get-Credential -Message "Please enter the credentials for logging into CyberArk host cyberarkhost.com" -UserName $env:UserName
$AUTH_URI = "https://cyberarkhost.com/PasswordVault/API/auth/LDAP/Logon"
$Headers = @{'accept'='application/json';'content-type'='application/json'}
$body=@{
username = "$($cred.UserName)"
password= "$($cred.GetNetworkCredential().password)"
}
@ryanvgates
ryanvgates / error.txt
Created March 24, 2022 20:57
Mongo Gotcha: Unrecognized Field Snapshot - Problem
ld_db_name.collection to disk: error reading collection: Failed to parse: { find: "collection", skip: 0, snapshot: true, $db: "old_db_name" }. Unrecognized field 'snapshot'.