Skip to content

Instantly share code, notes, and snippets.

View jasonrush's full-sized avatar

Jason Rush jasonrush

View GitHub Profile
@jasonrush
jasonrush / keybase.md
Created December 5, 2017 04:38
keybase.md

Keybase proof

I hereby claim:

  • I am jasonrush on github.
  • I am jasonrush (https://keybase.io/jasonrush) on keybase.
  • I have a public key ASBM8nnkxSIOP_7xKxCgO1lcVqH4CYcxIQPzwf6D4AphSQo

To claim this, I am signing this object:

@jasonrush
jasonrush / InstallOrUpgradePester.ps1
Last active May 14, 2020 03:02
Install or upgrade Pester (including PowerShell 2.0 on Windows 7 and Server 2008 r2)
Write-Output "=== Checking if Pester module is installed ==="
if ( (get-module -ListAvailable pester).count -gt 0 ) {
write-Output "`tPester is installed. Checking version(s)..."
if ( (get-module -ListAvailable pester | where-object { $_.version.Major -ge 4} ).count -eq 0 ) {
write-Output "`tReinstalling latest version of Pester"
$module = "C:\Program Files\WindowsPowerShell\Modules\Pester"
takeown /F $module /A /R
icacls $module /reset
icacls $module /grant "*S-1-5-32-544:F" /inheritance:d /T
Remove-Item -Path $module -Recurse -Force -Confirm:$false
@jasonrush
jasonrush / Create-WordPressAdmin.sql
Created September 17, 2020 23:36
Create WordPress Administrator account
/* Get a list of possible prefixes */
SELECT TRIM( TRAILING "usermeta" FROM TABLE_NAME) as PrefixesFound FROM information_schema.TABLES WHERE TABLE_NAME LIKE "%usermeta%";
/*
This will autodetect the first table prefix.
NOTE: ONLY USE IF THERE IS ONLY ONE PREFIX FOUND
*/
SET @TablePrefix = (SELECT TRIM( TRAILING "usermeta" FROM TABLE_NAME) as PrefixesFound FROM information_schema.TABLES WHERE TABLE_NAME LIKE "%usermeta%" LIMIT 1);
SELECT @TablePrefix;
@jasonrush
jasonrush / Get-Diff.ps1
Created January 9, 2021 00:42
PowerShell Diff implementation
<#
Diff implementation based off of https://gist.github.com/adamnew123456/37923cf53f51d6b9af32a539cdfa7cc4
Written by Jason Rush (https://github.com/jasonrush)
Returns an arraylist of hashtables. Each hashtable has two properties.
The "Action" property will have a value of "Keep", "Insert", or "Remove".
The "Line" property will have the value originally passed via $a_lines or $b_lines.
While I haven't tested it, technically $a_lines and $b_lines should just be arrays
and the values should be able to be anything, not just strings from files as you would
@jasonrush
jasonrush / TestLocalCredential.ps1
Created January 24, 2020 20:28
Test credentials for local computer (update arg 2 on line 40 from $null to domain name for domain auth). Slightly modified from Ansible.
Function Test-Credential {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the Win32 call, also the source isn't a secure string to using that is just a waste of time/code")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
param([String]$Username, [String]$Password)
$platform_util = @'
using System;
using System.Runtime.InteropServices;
namespace TempNamespace
{
@jasonrush
jasonrush / Jasons Upwork Stuff.user.js
Last active March 8, 2021 20:17
Jason's GreaseMonkey script for highlighting client info on job pages I often miss
// ==UserScript==
// @name Jason's Upwork Stuff
// @namespace https://portfolio.jason-rush.com/
// @version 0.1
// @description Highlight important information about clients on job pages I often miss
// @author Jason Rush (hire@jason-rush.com)
// @match https://www.upwork.com/jobs/*
// @grant none
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
@jasonrush
jasonrush / class.spiceworks.php
Last active June 3, 2021 21:47
A quick PHP class to get information about open tickets on Spiceworks Cloud HelpDesk.
<?php
class spiceworks {
// Information used to log in and get ticket info.
private $loginURL = 'https://accounts.spiceworks.com/sign_in';
private $dataURLOpen = 'https://on.spiceworks.com/api/tickets?filter%5Bstatus%5D%5Beq%5D=open';
private $dataURLWaiting = 'https://on.spiceworks.com/api/tickets?filter%5Bstatus%5D%5Beq%5D=waiting';
private $cookiePath = '';
private $authToken = '';
private $isLoggedIn = false;