Skip to content

Instantly share code, notes, and snippets.

View kurtisdunn's full-sized avatar

Kurtis Dunn kurtisdunn

View GitHub Profile
@kurtisdunn
kurtisdunn / demo.js
Created April 24, 2024 06:08
demo.js
if (input.value) {
realmName = customConnection; //'Custom-DB'
} if else {
realmName = ADConnection;
} else {
realmName = databaseConnection;
}
webAuth.login(
{
<script>
// Overview.
//
// This script is used to listen for clicks on table rows with a data-uid attribute.
// It also listens for new rows being added to the table and attaches the event listener to the new rows.
// Then it redirects the user to the form page with the correct ID to prefill the form
//
// But first we need to poll the DOM for the table container because the table is loaded asynchronously.
//
// The script is added to the page via a script editor web part.
@kurtisdunn
kurtisdunn / headers.js
Last active July 20, 2023 22:58
AWS Headers
const headers = {
"Access-Control-Allow-Origin": "<URL>",
"Content-Type": "application/json",
"Strict-Transport-Security": "max-age=31536000",
"Access-Control-Allow-Origin": "<URL>",
"x-frame-options": "DENY"
}
return {
statusCode: 200,
@kurtisdunn
kurtisdunn / react.js
Created February 2, 2021 05:41
React Component Cheat Sheet.
static getDerivedStateFromProps(props, current_state) {
console.log(props)
if (current_state.data !== props.data) {
return [{
id: props.id,
data: props.data
}]
}
return null
}
@kurtisdunn
kurtisdunn / index.html
Created January 14, 2021 04:00
Ping time Chart
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blank Template</title>
</head>
<body>
<div class="container">
<canvas id="chart1" width="800" height="450"></canvas>
</div>
{
"delta": {"ops":[{"insert":"sdf\"But I must explain to you how all this mistaken idea of denouncing pleasure and praisinasdfg pain dsfwas born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that profdsaduces no resultant pleasure?\"zx bx
@kurtisdunn
kurtisdunn / O365.md
Created August 13, 2019 04:08
Connect to O365 exchange console.
# Set User details
$UserCredential = Get-Credential

# Create session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

# Import PS Sesion
Import-PSSession $session
@kurtisdunn
kurtisdunn / crontab.md
Last active June 1, 2019 02:56
Backup Remote MySQL CRONTAB(5)

Backup Remote MySQL CRONTAB(5)

Once an hour on the hour.

DATEVAR=date +%Y%m%d_%H%M%S
0 * * * * /usr/local/bin/mysqldump -u <USER> --password="<PASSWORD>" -h remote.host.com -P <PORT> db > /PATH/TO/BACKUP/db_$($DATEVAR).sql
@kurtisdunn
kurtisdunn / newwUserActiveDirectory.md
Created May 28, 2019 23:05
Powershell AD New User
# New user script


#write title
Write-Host "New User Creator 1.0"

#import the active directory module
Import-Module ActiveDirectory
@kurtisdunn
kurtisdunn / nginx-php-mariadb-centos7.md
Created May 26, 2019 23:08
Install LEMP stack (Nginx, MariaDB, PHP-FPM) on CentOS7

Install LEMP stack (Nginx, MariaDB, PHP-FPM) on CentOS7

Install Nginx

Nginx is a fast web server compared to Apache and becomes more popular these days. In order to install Nginx on CentOS 7, we need to add the EPEL repository using the following command. EPEL stands for Extra Packages for Enterprise Linux.

sudo yum install epel-release -y