Skip to content

Instantly share code, notes, and snippets.

@devna13
devna13 / Enable-PIMGraph.ps1
Created September 7, 2023 15:38 — forked from arjancornelissen/Enable-PIMGraph.ps1
Enable PIM role via the Graph PowerShell Modules
# Connect via deviceauthentication and get the TenantID and User ObjectID
Connect-MgGraph -UseDeviceAuthentication
$context = Get-MgContext
$currentUser = (Get-MgUser -UserId $context.Account).Id
# Get all available roles
$myRoles = Get-MgRoleManagementDirectoryRoleEligibilitySchedule -ExpandProperty RoleDefinition -All -Filter "principalId eq '$currentuser'"
# Get SharePoint admin role info
$myRole = $myroles | Where-Object {$_.RoleDefinition.DisplayName -eq "SharePoint Service Administrator"}
@devna13
devna13 / PostmanDecodeJWT.js
Created June 22, 2023 19:52 — forked from jeff-heienickle/PostmanDecodeJWT.js
Decode, reuse, and visualize a JWT in Postman
var jsonData = pm.response.json();
pm.environment.set("jwt", jsonData.access_token);
function parseJwt (token,part) {
var base64Url = token.split('.')[part];
var words = CryptoJS.enc.Base64.parse(base64Url);
var jsonPayload = CryptoJS.enc.Utf8.stringify(words);
return JSON.parse(jsonPayload);
};
@devna13
devna13 / postman-pre-request.js
Created June 21, 2023 14:45 — forked from bcnzer/postman-pre-request.js
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@devna13
devna13 / git-branches-by-commit-date.sh
Created January 3, 2023 16:23 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@devna13
devna13 / wifi-passwords.ps1
Created November 16, 2022 15:47 — forked from willjobs/wifi-passwords.ps1
PowerShell script to show all wifi passwords saved in Windows
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -AutoSize
@devna13
devna13 / insomnia-azure.json
Created October 3, 2022 22:10 — forked from liyangau/insomnia-azure.json
This is a Insomnia collections for Azure AD authentication flows
{
"_type": "export",
"__export_format": 4,
"__export_date": "2022-03-01T01:35:30.864Z",
"__export_source": "insomnia.desktop.app:v2021.7.2",
"resources": [
{
"_id": "req_8d53c5e0a3b3487b9ae3b9b2e121a491",
"parentId": "wrk_aba5d4b0da6e46298cec551c288da364",
"modified": 1646098507189,
@devna13
devna13 / Program.cs
Created May 27, 2022 20:48 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@devna13
devna13 / handbrake_cli.md
Created September 9, 2019 22:14 — forked from zulhfreelancer/handbrake_cli.md
How to compress video using Handbrake CLI?

Step 1

Download HandBrake CLI for your OS here.

Step 2

cd into the folder where you have the HandBrakeCLI file and run this inside it:

./HandBrakeCLI -i /path/to/input.mov -o /path/to/output.mp4 -e x264 -q 28 -r 15 -B 64 -X 1280 -O
@devna13
devna13 / deleteAmazonSavedItems.js
Created September 6, 2019 16:03 — forked from MichaelLawton/deleteAmazonSavedItems.js
Removes all Amazon saved for later items on the cart page. It will only remove visible items. You might want to scroll first to make more items visible. To use paste code in developer console (Ctrl+Shift+J or Cmd+Opt+J in Chrome) then press enter.
function deleteSavedItems() {
var query = document.querySelectorAll("#sc-saved-cart input[value=Delete]")
if (query.length) {
query[0].click();
}
if (query.length > 1) {
setTimeout(deleteSavedItems,100);
}
else {
console.log('Finished');
@devna13
devna13 / understanding-word-vectors.ipynb
Created May 2, 2019 22:50 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.