Skip to content

Instantly share code, notes, and snippets.

View felickz's full-sized avatar
:octocat:
ALL YOUR REBASE ARE BELONG TO US.

Chad Bentz felickz

:octocat:
ALL YOUR REBASE ARE BELONG TO US.
View GitHub Profile
@felickz
felickz / GlimpseExpandMarklet.url
Last active September 8, 2015 02:51
Glimpse bookmarklet to expand all collapse-able elements
javascript:(function(){var expandElts = document.getElementsByClassName('glimpse-expand'); [].forEach.call(expandElts, function (elt) { if(elt.className.indexOf('glimpse-collapse') <= 0){ elt.click(); } }); })();
@felickz
felickz / Stop-WebAppPoolSafely.ps1
Created August 7, 2015 00:13
Stops an appPool and waits until it has entered the stopped state. By default the poll period is 1 second. This commandlet may take an AppPool object from the pipeline.
Import-Module WebAdministration
function Stop-WebAppPoolSafely
{
<#
.SYNOPSIS
Stops an appPool and waits until it has entered the stopped state
.DESCRIPTION
Stops an appPool and waits until it has entered the stopped state. By default the poll period is 1 second. This commandlet may take an AppPool object from the pipeline.
.EXAMPLE
@felickz
felickz / Notepad.url
Created September 8, 2015 02:50
Notepad Bookmarklet
data:text/html,<html contenteditable ><head><title>Notepad +++</title></head></html>
@felickz
felickz / IISLogsByUTCDateRange.LPS
Created November 3, 2015 13:32
LogParserStudio - IISLogsByUTCDateRange + AM/PM
/* LogParserStudio - IISLogsByUTCDateRange + AM/PM */
SELECT TOP 1000 to_timestamp(date,time) as stamp-UTC, *
FROM '[LOGFILEPATH]'
WHERE to_timestamp(date,time) between timestamp('2015/10/23 07:46:00 AM', 'yyyy/MM/dd hh:mm:ss tt') and timestamp('2015/10/23 07:59:00 PM', 'yyyy/MM/dd hh:mm:ss tt')
ORDER BY time ASC
@felickz
felickz / RunAsDifferentUser.ps1
Last active April 4, 2016 14:47
Powershell command to open powershell as a different user
#http://powershell.com/cs/blogs/tips/archive/2010/10/28/running-programs-as-different-user.aspx
Start-Process powershell -LoadUserProfile -Credential (Get-Credential)
@felickz
felickz / JsonPointerPropertyExtractionRule.cs
Last active October 12, 2016 12:18 — forked from LockTar/JsonPropertyExtractionRule.cs
An RFC 6901 JSON Pointer extraction rule for Visual Studio webtest that extracts a value from a JSON response
using Microsoft.VisualStudio.TestTools.WebTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.ComponentModel;
using Tavis;
namespace Extensions.ExtractionRules
{
/// <summary>
@felickz
felickz / SoftwareInventory.ps1
Created February 23, 2017 19:50
Software inventory for Windows
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | where { -not [str
ing]::IsNullOrEmpty($_.DisplayName) }
@felickz
felickz / Get-TeslaApiToken.ps1
Last active August 8, 2019 17:14
PowerShell script to get an AT / RT from the Tesla authorization server
$uri = 'https://owner-api.teslamotors.com/oauth/token'
$email = "a@b.com"
$pw = "pw123!"
$json = @{
grant_type = "password"
client_id = "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384"
client_secret = "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3"
email = "$email"
password = "$pw"
@felickz
felickz / postman-oauth-token-decode.js
Created August 8, 2019 17:11
Postman Test syntax to decode and validate an Application JWT token from Azure AD with Scopes(roles)
function jwtDecode(t) {
let token = {};
token.raw = t;
token.header = JSON.parse(atob(t.toString().split('.')[0]));
token.payload = JSON.parse(atob(t.toString().split('.')[1]));
return (token);
}
console.log("JWT Decode");
var jwt = jwtDecode(pm.response.json().access_token);
@felickz
felickz / fix-wsl2-dns-resolution
Last active October 5, 2020 15:43 — forked from coltenkrauter/fix-wsl2-dns-resolution
Fix DNS resolution in WSL2
1. Create a file: /etc/wsl.conf.
2. Put the following lines in the file in order to ensure the your DNS changes do not get blown away
[network]
generateResolvConf = false
3. In a cmd window, run wsl --shutdown
4. Restart WSL2
5. Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file: `rm /etc/resolv.conf`
6. Put the following line in the file