Skip to content

Instantly share code, notes, and snippets.

View nshores's full-sized avatar
🏠
Working from home

Nick Shores nshores

🏠
Working from home
View GitHub Profile
@nshores
nshores / ps_robocopy.ps1
Created May 21, 2018 18:58
ps_robocopy.ps1
#Requires -Version 4
## Robocopy Script for multiple data sources
## Created for Grupe File Server Migration
# Run this script on the target server (where file shares are getting migrated to)
$LogFile = "$PSScriptRoot\logs\Migrate-FileShares_$SourceServer-$(Get-Date -format yyyy-MM-dd_hh-mm-sstt).txt"
$RoboLog = "$PSScriptRoot\logs\Robo-Migrate-FileShares_$SourceServer-$(Get-Date -format yyyy-MM-dd_hh-mm-sstt).txt"
@nshores
nshores / .zshrc
Created November 1, 2022 00:25
.zshrc
# Enabl/ Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@nshores
nshores / pulse_secure_update.ps1
Last active June 16, 2022 23:09
pulse_secure_update
#Script for updating Pulse Secure network connection profiles on Windows clients.
#Any active profiles will be wiped during script execution and replaced with the target configuration.
#The script will also check for active VPN connections and copy the pulse configuration locally before proceeding.
#Make sure to update $connection_profile to match your environment location.
#Pulse 5.3 and above is required for connection delete support.
#Nick Shores - 12/11/18
$connection_profile = '\\wra-fileserver.wra.local\Fileserver\Support\wra.pulsepreconfig'
write-host "Configuration Location:" `n$connection_profile `n
#!/bin/bash
# Example usage: ./find_misconfigured_autoscaler.sh -p autogrid-dev -r us-east-2
# Your kubeconfig needs to have all of the AG clusters in it, and the names context must match AWS
# set the F flag to true to fix ASG tagging (brute force method)
while getopts p:r:c:f: flag
do
case "${flag}" in
p) AWS_PROFILE=${OPTARG};;
r) REGIONS=${OPTARG};;
c) CLUSTER_TARGET=${OPTARG};;
#!/bin/bash
#This script will generate a list of various subnet attributes from an input value of a list of aws profile's. Each profile will be used to crawl the region for all available subnets, and output details to CSV.
#Example input: ./generate_aws_subnet_list_.sh "autogrid-dev autogrid-prod"
AWS_PROFILE=$1
echo "Current AWS_PROFILE: $AWS_PROFILE"
for profile in $AWS_PROFILE; do
echo "Changing Profile to $profile"
export AWS_PROFILE=$profile
#Get regions if we haven't already
@nshores
nshores / update_ssh_host_key.yml
Created November 3, 2021 04:54
update_ssh_host_key.yml
- hosts: all
gather_facts: false
become: yes
vars:
target_host: target.host.enterprise.com
target_user: /home/targetuser/.ssh/known_hosts
separator: /
@nshores
nshores / vmdk_dupes.ps1
Created October 5, 2021 00:04
vmdk_duptes.ps1
#https://blog.milla-online.de/duplicate-disk-uuids-and-how-to-get-rid-of-it-hopefully
# get all hard disks
Write-Host "Get all hard disks... " -NoNewline
$alldisks = Get-VM | Get-HardDisk
Write-Host ("Found " + $alldisks.Count)
# filter disks for duplicate uuids and show the "disk.enableUUID" parameter
Write-Host "Filter for duplicate uuids... " -NoNewline
$diskswithduplicateuuids = $alldisks | Select-Object -Property Parent,Name,@{N="Disk-Uuid";E={$_.ExtensionData.Backing.Uuid}} | Group-Object -Property Disk-Uuid | Where-Object -FilterScript { $_.Count -ne 1 } | Select-Object -ExpandProperty Group
@nshores
nshores / sysmon.sh
Created July 27, 2021 23:17
sysmon
#!/bin/bash
#hahriar Shovon
#@Github https://github.com/shovon8/sysmon
printf "%-10s%-15s%-15s%s\n" "PID" "OWNER" "MEMORY" "COMMAND"
function sysmon_main() {
RAWIN=$(ps -o pid,user,%mem,command ax | grep -v PID | awk '/[0-9]*/{print $1 ":" $2 ":" $4}')
for i in $RAWIN
do
@nshores
nshores / tinder.py
Created July 8, 2021 18:46
tinder prep.py
string = "Horse Apple Cake"
print(string)
#Find check if a substring is contained
#The find method returns -1 if no match, and the index where the substring starts otherwise
word = 'hello'
search = (word.find('ll'))
if (word.find('ll') != -1):
@nshores
nshores / get_az_vm.py
Created July 1, 2021 18:42
get_az_vm.py
#!/usr/bin/env python
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient
import json
from json2html import *
# Tenant ID for your Azure subscription
TENANT_ID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'