Skip to content

Instantly share code, notes, and snippets.

View nddipiazza's full-sized avatar

Nicholas DiPiazza nddipiazza

View GitHub Profile
@nddipiazza
nddipiazza / spoidcrl.ps1
Last active January 9, 2024 17:59
Retrieve SPOIDCR cookie for SharePoint Online.
<#
.Synopsis
Retrieve SPOIDCR cookie for SharePoint Online.
.Description
Authenticates to the sts and retrieves the SPOIDCR cookie for SharePoint Online.
Will use the custom IDP if one has been setup.
Optionally, can use integrated credentials (when integrated is set to true) with ADFS using the windowsmixed endpoint.
Results are formattable as XML, JSON, KEYVALUE, and by line.
Makes global variables avaiable at the end of the run.
@nddipiazza
nddipiazza / KafkaTest.java
Created July 18, 2022 19:16
Test with Kafka + TestContainers
import java.time.Duration;
import java.util.Collections;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
@nddipiazza
nddipiazza / grpc-ssl-setup.sh
Last active July 18, 2022 00:18
Simple bash script that sets up test certs for grpc
CN_NAME=localhost
# Certificate Authority
echo Generate CA key:
openssl genrsa -passout pass:1111 -des3 -out ca.key 4096
echo Generate CA certificate:
openssl req -passin pass:1111 -new -x509 -days 365 -key ca.key -out ca.crt -subj "/CN=${CN_NAME}"
# Server side key
echo Generate server key:
@nddipiazza
nddipiazza / TikaPipesKafkaTest.java
Created July 11, 2022 14:55
Kafka with Testcontainers
package org.apache.tika.pipes.kafka.tests;
import java.io.File;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@nddipiazza
nddipiazza / setup-fusion-cluster.sh
Last active August 18, 2021 18:39
Install a Fusion cluster
# Run this script to install a Fusion cluster locally.
#
# In the working directory you are in, it will create fusion-1, fusion-2, etc... directories.
#
# You will then take those directories and either run them from the same machine, or you can copy the directories to separate instances.
#
# There are two optional command line properties:
#
# --no-download Do not download Fusion from https://download.lucidworks.com instead use the tar.gz file in this directory already.
# -v Verbose mode.
package spauth;
import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import org.w3c.dom.Document;
import org.xml.sax.*;
public class LoginManager {
<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="14.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="33" ObjectPathId="32"/><Query Id="34" ObjectPathId="32"><Query SelectAllProperties="false"><Properties/></Query><ChildItemQuery SelectAllProperties="false"><Properties><Property Name="Users" SelectAll="true"><Query SelectAllProperties="false"><Properties/></Query></Property><Property Name="Id" ScalarProperty="true"/><Property Name="LoginName" ScalarProperty="true"/><Property Name="PrincipalType" ScalarProperty="true"/><Property Name="Title" ScalarProperty="true"/></Properties></ChildItemQuery></Query></Actions><ObjectPaths><Property Id="32" ParentId="3" Name="SiteGroups"/><Property Id="3" ParentId="1" Name="Web"/><StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current"/></ObjectPaths></Request>
@nddipiazza
nddipiazza / disable-cookie-validation.patch
Created March 8, 2018 15:38
Changes to apply to firefox in order to allow web driver to add cookies before navigating to a page (Universal diff format)