Skip to content

Instantly share code, notes, and snippets.

View jbfriedrich's full-sized avatar
👨‍💻
Learning more Python 🐍

Jason Friedrich jbfriedrich

👨‍💻
Learning more Python 🐍
View GitHub Profile
@jbfriedrich
jbfriedrich / add_ip_whitelist_vmw_fwrules.ps1
Last active August 29, 2015 14:04
Add whitelisted IPs to VMware firewall rules
##
# Powershell script to add whitelisted IPs to VMware vSphere and VMware vCenter firewall rules.
# Also adding a rule to fix the web console problem in vSphere Web Client
##
# Set execution policy
# AllSigned : Every script must bear a valid signature
# RemoteSigned : Must be signed by a trusted publisher (for example Microsoft)
# Unrestricted : No restrictions whatsoever, every script can run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
@jbfriedrich
jbfriedrich / enable_whitelisted_rdp.ps1
Created July 31, 2014 21:11
Only allow RDP from whitelisted IPs
# Set execution policy
# AllSigned : Every script must bear a valid signature
# RemoteSigned : Must be signed by a trusted publisher (for example Microsoft)
# Unrestricted : No restrictions whatsoever, every script can run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
# Whitelisted IPs which are allowed to use the services on this host
$whitelistIPs = "8.8.8.8", "127.0.0.1"
# DisplayNames for the firewall rules for Remote Desktop
@jbfriedrich
jbfriedrich / find_orphaned_VMDKs.ps1
Created January 28, 2015 19:15
Find orphaned VMDKs in VMware vSphere 5.x (found on the VMware forums)
$report = @()
$arrUsedDisks = Get-View -ViewType VirtualMachine | % {$_.Layout} | % {$_.Disk} | % {$_.DiskFile}
$arrDS = Get-Datastore | Sort-Object -property Name
foreach ($strDatastore in $arrDS) {
Write-Host $strDatastore.Name
$ds = Get-Datastore -Name $strDatastore.Name | % {Get-View $_.Id}
$fileQueryFlags = New-Object VMware.Vim.FileQueryFlags
$fileQueryFlags.FileSize = $true
$fileQueryFlags.FileType = $true
$fileQueryFlags.Modification = $true
@jbfriedrich
jbfriedrich / list_rdm_vms.ps1
Created January 28, 2015 19:20
List VMs with Raw Device Mappings (RDMs) in VMware vSphere 5.x
# LIst VMs with Raw Device Mappings (RMDs) in VMWare vSphere 5.x
# More info at VMware KB: http://kb.vmware.com/kb/2001823
Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName | fl
@jbfriedrich
jbfriedrich / list_vm_iops.ps1
Last active August 29, 2015 14:21
Powershell script to create a list with read and write IOPS for every Virtual Machine (average and peak values)
##
# Get a list with average and peak IOPS from all VMs
# Found at: https://www.linkedin.com/grp/post/3992597-5937675088978534402
##
Get-VM | Sort | Select @{N="Name"; E={$_.Name}}, @{N="AvgWriteIOPS"; E={[math]::round((Get-Stat $_ -stat "datastore.numberWriteAveraged.average" -RealTime | Select -Expand Value | measure -average).Average, 1)}}, @{N="PeakWriteIOPS"; E={[math]::round((Get-Stat $_ -stat "datastore.numberWriteAveraged.average" -RealTime | Select -Expand Value | measure -max).maximum, 1)}}, @{N="AvgReadIOPS"; E={[math]::round((Get-Stat $_ -stat "datastore.numberReadAveraged.average" -RealTime | Select -Expand Value | measure -average).Average, 1)}}, @{N="PeakReadIOPS"; E={[math]::round((Get-Stat $_ -stat "datastore.numberReadAveraged.average" -RealTime | Select-Expand Value | measure -max).maximum, 1)}} | Format-Table -autosize | Out-File iops.txt
@jbfriedrich
jbfriedrich / hosts
Created June 18, 2016 14:13
Hosts file to make the Internet not suck as much
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#
# See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# [email protected]
@jbfriedrich
jbfriedrich / VeeamBackup.ps1
Last active April 5, 2020 09:51
Create Backups with Start-VBRZip in Powershell (Veeam Backup Free Edition)
################################################################################
## SMB Backup Space Credentials
################################################################################
$DriveName = "BackupSpace"
$UserName = "u123456"
$SecretPass = ConvertTo-SecureString "My Super Secret Password" -AsPlainText -Force
# Creating Credential Object to use with PSDrive
$Creds = New-Object System.Management.Automation.PSCredential($UserName, $SecretPass)
# Using PSDrive to create the drive
New-PSDrive -Name $DriveName -Credential $Creds -Root "\\backup.space\backup\Veeam" -PSProvider FileSystem
@jbfriedrich
jbfriedrich / nsmb.conf
Last active October 30, 2024 06:21
macOS 11.2 NSMB configuration
# /etc/nsmb.conf - macOS 11.3 - 2021-04-29
#------------------------------------------------------------------------------
# SMB configuration for macOS 11.3 <-> Synology
#------------------------------------------------------------------------------
# Additional information:
# -----------------------
# https://support.apple.com/de-de/HT211927
# https://support.apple.com/en-us/HT208209
# https://apple.stackexchange.com/questions/309016/smb-share-deadlocks-since-high-sierra
# https://photographylife.com/afp-vs-nfs-vs-smb-performance
@jbfriedrich
jbfriedrich / thelounge4.css
Last active May 14, 2021 21:45
The Lounge 4.2.0 Custom Stylesheet
/* Bigger CSS Input Field */
#user-specified-css-input {
height: 400px;
}
#sidebar {
width: 180px;
}
.channel-list-item.active .close-tooltip {
@jbfriedrich
jbfriedrich / do_firewall.sh
Last active January 7, 2024 22:52
DigitalOcean Firewall Scripts
#!/bin/bash
################################################################################
# DigitalOcean Droplet Firewall Script
#===============================================================================
# This Firewall script is supposed to be used with DigitalOcean Droplets. It
# uses eth0 as external, and eth1 (if present) as internal network interface.
# It automatically detects IP addresses and blocks all traffic but SSH from a
# list of safe IP addresses.
# Two white lists can be defined, one for internal IPv4 IP addresses and one
# for public IPv4 addresses.