Skip to content

Instantly share code, notes, and snippets.

Function Get-ADGroupsDifference {
<#
.SYNOPSIS
PowerShell function intended to compare group membership for two Active Directory users.
.DESCRIPTION
Using this function you can compare groups membership for two users Active Directory users.
The first is reference user, the second is compared with it and as the result groups different for both users will be displayed.
@NathanTheGr8
NathanTheGr8 / nginxproxy.md
Created May 28, 2017 02:53 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@NathanTheGr8
NathanTheGr8 / ufw home media server app profile.md
Last active January 23, 2021 10:36 — forked from andrey-str/ufw plexmediaserver app profile.md
Plex Media Server, Sonarr, Radarr, Deluge, NzbGet UFW rule
[plexmediaserver]
title=Plex Media Server
description=The Plex Media Server is smart software that makes playing Movies, TV Shows and other media on your computer simple
ports=32400/tcp|1900/udp|32469/udp|5353/udp

[sonarr]
title=Sonarr
description=Sonarr is a PVR for Usenet and BitTorrent users
ports=8989/tcp|8989/udp
@NathanTheGr8
NathanTheGr8 / boxstarter.txt
Created April 18, 2017 19:15
Just a Box Starter script
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
cinst googlechrome
cinst jre8
cinst firefox
cinst flashplayerplugin
cinst tor-browser
cinst 7zip
cinst chocolatey-core.extension
@NathanTheGr8
NathanTheGr8 / Get-Freq-User.ps1
Last active March 21, 2017 22:45
returns the most frequent , recent user of this computer
function get-freq-user
{
$newest = 20
$ComputerName = $env:computername
$UserProperty = @{ n = "User"; e = { ((New-Object System.Security.Principal.SecurityIdentifier $_.ReplacementStrings[1]).Translate([System.Security.Principal.NTAccount])).ToString() } }
$logs = Get-EventLog System -Source Microsoft-Windows-Winlogon -ComputerName $ComputerName -newest $newest | select $UserProperty
$logs = $logs | Group-Object user | Sort Count | Select -First 1 | Select-Object -Property Name | Out-String
$index = $logs.indexOf("\") + 1
##Add extension reg
$chromepath32 = "HKLM:\Software\Google\Chrome\Extensions"
$chromepath64 = "HKLM:\Software\Wow6432Node\Google\Chrome\Extensions"
$extension_id = "haiffjcadagjlijoggckpgfnoeiflnem"
if ($is64bit) {
if (-not(Test-Path "HKLM:\Software\Wow6432Node\Google")){
New-Item "HKLM:\Software\Wow6432Node" -Name "Google"
}
if (-not(Test-Path "HKLM:\Software\Wow6432Node\Google\Chrome")){
#archive_dir = "C:\Outlook Archives"
$network_share = "\\some\server"
<#
Gets a list of the last 20 logins/outs. Then counts the actions by each user. Returns the user with the highiest count.
Also purge domain\ from username and any spaces
#>
function get-freq-user
{
$newest = 20
@NathanTheGr8
NathanTheGr8 / docker-spigot.sh
Created September 26, 2016 22:58
docker command to start https://github.com/nimmis/docker-spigot with the flags I want
docker run -d -p 25565:25565 -e EULA=true --name spigot -v ./mc-srv:/minecraft nimmis/spigot
@NathanTheGr8
NathanTheGr8 / docker-compose.yml
Last active December 29, 2016 20:58
Docker Compose File for Wordpress
version: '2'
services:
db:
image: mysql:5.7
volumes:
- "./data/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
@NathanTheGr8
NathanTheGr8 / wp_install.sh
Last active April 14, 2016 18:01
A wordpress install script for installing wordpress on a freshly image raspberry pi
#!/bin/bash -e
dir="/var/www/html"
dbname="wordpress"
dbuser="root"
dbpass="sshs"
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"