Skip to content

Instantly share code, notes, and snippets.

@NathanTheGr8
NathanTheGr8 / .bash_profile
Created January 29, 2016 20:59 — forked from stephenll/.bash_profile
.bash_profile file on Mac OS X
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases.
# Much of this was originally copied from:
# http://natelandau.com/my-mac-osx-bash_profile/
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# sysDig Test Cases
# Test Case 1
# A grabs a lock
# B opens same file, tries to grab a lock
# Contention
# 0 = succesfull, 1 or more = number of contentions
test1_result=1
test1(){
exec 3>foo.bar
@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 "============================================"
@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
##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")){
@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
@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 / 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

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.