Skip to content

Instantly share code, notes, and snippets.

View nddipiazza's full-sized avatar

Nicholas DiPiazza nddipiazza

View GitHub Profile
@nddipiazza
nddipiazza / TestTimeout.java
Last active November 8, 2017 05:04
easier to see example of this
package test;
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@nddipiazza
nddipiazza / test-sharepoint-group-query.ps1
Last active October 23, 2017 18:30
This is a powershell script that can query sharepoint to get the Account and Name values for a group given the domain\username format of the user.
$sharepointSite = "http://102.15.12.153"
$loginUserName = "some-username"
$domain = "THEDOMAIN" # must be upper case
$groupNameToQueryFor = "GROUPNAME-TO-QUERY-FOR" # must be upper case
$passwordSecure = Read-Host "What is $loginUserName's password?" -AsSecureString
$credential = New-Object –TypeName "System.Management.Automation.PSCredential" –ArgumentList $loginUserName, $passwordSecure
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $loginUserName,$passwordSecure)))
$response = Invoke-RestMethod -Method Get -Uri "$sharepointSite/_vti_bin/listdata.svc/UserInformationList?`$filter=substringof(%27$domain%5C$groupNameToQueryFor%27%2Ctoupper(Name))%20eq%20true%20and%20ContentType%20eq%20%27DomainGroup%27" -Headers @{Authorization = "Basic $base64AuthInfo" } -Credential $credential -ContentType "text/xml"
$ns = @{d="http://schemas.microsoft.com/ado/2007/08/dataservices"}
@nddipiazza
nddipiazza / test-sharepoint-user-query.ps1
Created October 23, 2017 14:04
This is a powershell script that can query sharepoint to get the Account and Name values for a user given the domain\username format of the user.
$sharepointSite = "http://102.15.12.153"
$loginUserName = "some-username"
$domain = "THEDOMAIN" # must be upper case
$userNameToQueryFor = "USERNAME-TO-QUERY-FOR" # must be upper case
$passwordSecure = Read-Host "What is $loginUserName's password?" -AsSecureString
$credential = New-Object –TypeName "System.Management.Automation.PSCredential" –ArgumentList $loginUserName, $passwordSecure
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $loginUserName,$passwordSecure)))
$response = Invoke-RestMethod -Method Get -Uri "$sharepointSite/_vti_bin/listdata.svc/UserInformationList?`$filter=substringof(%27$domain%5C$userNameToQueryFor%27%2Ctoupper(Account))%20eq%20true%20and%20ContentType%20eq%20%27Person%27" -Headers @{Authorization = "Basic $base64AuthInfo" } -Credential $credential -ContentType "text/xml"
$ns = @{d="http://schemas.microsoft.com/ado/2007/08/dataservices"}
@nddipiazza
nddipiazza / javascript_timeout.html
Last active September 12, 2017 14:57
page that will hard loop in the <script> section.
<!DOCTYPE html>
<html>
<body>
<div id="container">Will never display</div>
<script>
while (true) {}
</script>
</body>
</html>
@nddipiazza
nddipiazza / RemoteToGeckoServerHeadlessFirefoxSeleniumExample.java
Last active September 12, 2017 14:58
GeckoDriverService + Selenium RemoteDriver + Firefox Marionette - Not timing out
package com.mozilla.example;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.GeckoDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.service.DriverService;
import org.openqa.selenium.support.ui.WebDriverWait;
@nddipiazza
nddipiazza / build.gradle
Created September 1, 2017 17:52
Gradle file for the headlessfirefox selenium example
group 'com.mozilla'
version '1.0'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
@nddipiazza
nddipiazza / HeadlessFirefoxSeleniumExample.java
Created September 1, 2017 17:51
Headless firefox (without xvfb) example
package com.mozilla.example;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import java.util.concurrent.TimeUnit;
@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.
@nddipiazza
nddipiazza / fusion-3node-cluster-setup.sh
Last active July 28, 2017 20:23
A simple bash script that can set up a Linux node for a 3 node cluster
#!/usr/bin/env bash
# Enter each private IP address of each node in this list
zkhost1=IPADDRESS1
zkhost2=IPADDRESS2
zkhost3=IPADDRESS3
zkhost=$zkhost1:9983,$zkhost2:9983,$zkhost3:9983
# Assign an ID to this node.
# This will be the only thing in this script that is unique on each node of the cluster.
# Use increasing IDs starting with 1, 2, 3, etc.
#!/usr/bin/env bash
set -eou pipefail
DIR=$(dirname "$0")
"$DIR/gradlew" --parallel --max-workers=8 -p "$DIR" compileJava compileTestJava