Skip to content

Instantly share code, notes, and snippets.

View nickadam's full-sized avatar

Nick Vissari nickadam

View GitHub Profile
@nickadam
nickadam / cya_encrypt_decrypt_example.ps1
Last active November 3, 2023 13:52
Leverage CYA internals for generic encrypting or decrypting of files with a password
# Running this script will install CYA if not already installed,
# load the necessary functions from the private modules directory,
# and finally creates three sample files in the current working directory.
# Install CYA if not installed
if (-not (Get-Module -ListAvailable -Name CYA)) {
Install-Module CYA -Repository PSGallery
}
# Load CYA's private functions from the Modules directory
@nickadam
nickadam / get-switch-macs.py
Last active August 26, 2023 17:34
Get switch interface mac addresses via snmp (tested with aruba os, aruba cx, aruba wireless controllers, and cisco)
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher
from pysnmp.carrier.asyncore.dgram import udp
from pyasn1.codec.ber import encoder, decoder
from pysnmp.proto.api import v2c
from pysnmp.proto import api
from time import time
from collections import OrderedDict
import copy
import json
import re
@nickadam
nickadam / duo_phone_setup.md
Created August 16, 2023 14:31
Duo phone setup

Duo phone setup

graph TD
  A[Go to Manage Duo in S/SAM] --> B{Is the toggle greyed out\nor duo not required?}
  B -- Yes --> C[Setup/restore the phone]
  B -- No --> D{Are there MFA methods?}
  D -- Yes --> E{Is one of the methods\nthe hcpss device\nbeing replaced?}
  D -- No --> F[Begin phone setup/restore,\nstop at home screen]
  F --> G{Is the duo app\non the new phone?}
 G -- No --> H[Wait longer\nor install manually]
@nickadam
nickadam / spotify_delay_play.js
Created July 27, 2023 17:48
Tampermonkey script for Spotify delay play for Quest 2 VR
// ==UserScript==
// @name Spotify delay play for Quest 2 VR
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hits the play button after a delay so you can listen to spotify on Oculus Quest 2. You can sideload firefox android app with sidequest, add the tampermonkey add-on, add this script, and open spotify in desktop mode in firefox, move it to a sidepanel, start playing what you want, pause it, hit "Play in 15s", open your VR game of choice.
// @author Nick Vissari
// @match *://open.spotify.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=spotify.com
// @grant none
// ==/UserScript==
@nickadam
nickadam / Get-GitHubRepos.ps1
Created July 18, 2023 16:11
List Org Repos and Contributors
$org = "Your Org"
$api_key = "Your PAT"
function Get-GitHubApi(){
param($Url)
$Headers = @{Authorization = "Bearer $api_key"}
$wr = Invoke-WebRequest -UseBasicParsing -Headers $Headers $Url
$wr.Content | ConvertFrom-Json -Depth 100
if([string]($wr.Headers.link -split "," -match 'rel="next"') -match "https[^>]+"){
Get-GitHubApi $matches[0]
@nickadam
nickadam / Get-AwsPolicies.ps1
Last active April 20, 2023 03:56
Get AWS policy contents for attached and inline policies associated with Users, Roles, and Groups
Write-Progress -Activity "IAM List (1/2)" -Status ("0% AttachedPolicies") -PercentComplete 0
$AttachedPolicies = & aws iam list-policies --only-attached | ConvertFrom-Json | Select-Object -ExpandProperty Policies
Write-Progress -Activity "IAM List (1/2)" -Status ("25% Users") -PercentComplete 0
$Users = & aws iam list-users | ConvertFrom-Json | Select-Object -ExpandProperty Users
Write-Progress -Activity "IAM List (1/2)" -Status ("50% Roles") -PercentComplete 0
$Roles = & aws iam list-roles | ConvertFrom-Json | Select-Object -ExpandProperty Roles
Write-Progress -Activity "IAM List (1/2)" -Status ("75% Groups") -PercentComplete 0
$Groups = & aws iam list-groups | ConvertFrom-Json | Select-Object -ExpandProperty Groups
$t = ($AttachedPolicies.Length + $Users.Length + $Roles.Length + $Groups.Length)
@nickadam
nickadam / Get-AOVPNSessions.ps1
Created April 5, 2023 13:38
Get session data from Always On VPN
# Connect to windows internal database, remote access account database, and get relevant information for all active sessions
$ConnectionString = 'server=\\.\pipe\MICROSOFT##WID\tsql\query;database=RaAcctDb;trusted_connection=true;'
$SQLConnection= New-Object System.Data.SQLClient.SQLConnection($ConnectionString)
$SQLConnection.Open()
$SQLCommand = $SQLConnection.CreateCommand()
$SQLCommand.CommandText = 'SELECT * FROM dbo.ConnectionTable JOIN dbo.SessionTable ON dbo.ConnectionTable.ConnectionId = dbo.SessionTable.ConnectionId WHERE SessionState = 1'
$SqlDataReader = $SQLCommand.ExecuteReader()
$SQLDataResult = New-Object System.Data.DataTable
$SQLDataResult.Load($SqlDataReader)
$SQLConnection.Close()
@nickadam
nickadam / Secret_Server_Launch_List.js
Last active December 19, 2023 12:36
Tampermonkey script for secret server launch list
// ==UserScript==
// @name Secret Server Launch List
// @namespace http://tampermonkey.net/
// @version 1.0.1
// @description Add a list of hosts your can choose from the secret server launcher UI
// @author nickadam
// @match https://*.secretservercloud.com/app/
// @icon https://www.google.com/s2/favicons?sz=64&domain=secretservercloud.com
// @grant none
// ==/UserScript==
@nickadam
nickadam / install-ucarp-vip.sh
Created November 13, 2022 19:04
Install service to manage virtual IP using ucarp
#!/bin/bash
test -z "$1" || HOST_IP=$1
test -z "$2" || VIP=$2
test -z "$3" || VHID=$3
test -z "$4" || PASSWORD="${4}"
# set default VHID and PASSWORD if not set
test ! -z "$VHID" || VHID=20
test ! -z "$PASSWORD" || PASSWORD=ucarp
@nickadam
nickadam / google_edu_tos.txt
Created September 28, 2022 14:21
Google Workspace for Education Terms of Service
Google Workspace for Education Terms of Service
Last modified: September 20, 2022
For translations of this Agreement into other languages, please click here.
If you signed an offline variant of this Agreement for use of the Google Workspace for Education Services under the same Google Workspace for Education Account, the terms below do not apply to you and your offline terms govern your use of the Google Workspace for Education Services.
If your billing account is in Brazil, please review these Terms of Service, which apply to your use of Google Workspace for Education.
Se a sua conta para faturamento é no Brasil, por gentileza veja o Termos de Serviço, que será o Termo aplicável à sua utilização da Google Workspace for Education.