Skip to content

Instantly share code, notes, and snippets.

@jasonrush
jasonrush / class.spiceworks.php
Last active Jun 3, 2021
A quick PHP class to get information about open tickets on Spiceworks Cloud HelpDesk.
View class.spiceworks.php
<?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;
@jasonrush
jasonrush / Jasons Upwork Stuff.user.js
Last active Mar 8, 2021
Jason's GreaseMonkey script for highlighting client info on job pages I often miss
View Jasons Upwork Stuff.user.js
// ==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 / Get-Diff.ps1
Created Jan 9, 2021
PowerShell Diff implementation
View Get-Diff.ps1
<#
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 / Create-WordPressAdmin.sql
Created Sep 17, 2020
Create WordPress Administrator account
View Create-WordPressAdmin.sql
/* 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 / InstallOrUpgradePester.ps1
Last active May 14, 2020
Install or upgrade Pester (including PowerShell 2.0 on Windows 7 and Server 2008 r2)
View InstallOrUpgradePester.ps1
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 / TestLocalCredential.ps1
Created Jan 24, 2020
Test credentials for local computer (update arg 2 on line 40 from $null to domain name for domain auth). Slightly modified from Ansible.
View TestLocalCredential.ps1
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
{
View 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: