Skip to content

Instantly share code, notes, and snippets.

View AlainODea's full-sized avatar

Alain O'Dea AlainODea

View GitHub Profile
@AlainODea
AlainODea / Get-IdP-Settings-From-SP.ps1
Last active December 4, 2020 09:14
PowerShell scripts for pulling SAML IdP and SP settings from metadata, with AD FS and Okta examples. Get the last (or only) signing key from WS-Federation FederationMetadata.xml like AD FS publishes for signature certificate rollover (PowerShell)
# Get settings to enter on the Identity Provider (IdP) to allow authentication to Service Provider (SP)
function Get-IdP-Settings-From-SP($Metadata) {
[xml]$SPMetadata = $Metadata
$SPAssertionConsumerServiceURL = $SPMetadata.EntityDescriptor.SPSSODescriptor.AssertionConsumerService |
? {$_.Binding -eq "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"} |
% {$_.Location}
$SPIssuerURI = $SPMetadata.EntityDescriptor.entityID
$SPSignatureCertificate = $SPMetadata.EntityDescriptor.SPSSODescriptor.KeyDescriptor |
? {$_.use -eq "signing"} |
Select-Object -Last 1 |
@douglascayers
douglascayers / InvocableApexTemplate.cls
Created January 4, 2018 08:15
Example structure of an invocable apex class
public with sharing class InvocableApexTemplate {
@InvocableMethod(
label = 'Name as displayed in Process Builder'
description = 'Tooltip as displayed in Process Builder'
)
public static List<Response> execute( List<Request> requests ) {
List<Response> responses = new List<Response>();
@tfausak
tfausak / chrono-legionnaire.hs
Last active October 5, 2017 14:31
Adds the time to every line.
#!/usr/bin/env stack
-- stack --resolver ghc-8.2.1 script --package time
import Data.Time
import Data.IORef
import Text.Printf
main :: IO ()
main = do
start <- getCurrentTime
before <- newIORef start
@AlainODea
AlainODea / cabal-macros.h
Last active January 11, 2016 03:58
GHC 7.10.3 Test Failures on SmartOS
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package rts-1.0 */
#define VERSION_rts "1.0"
#define MIN_VERSION_rts(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 0 || \
(major1) == 1 && (major2) == 0 && (minor) <= 0)
/* package ghc-prim-0.4.0.0 */
@tonymorris
tonymorris / condenscension-police.md
Last active August 29, 2015 14:15
The Condenscension Police

CAUTION: this rant has not been proof-read to any extent at all

The condenscension police are here, with their double-standards and unquestionable claim to a moral high-ground. Persistently engaged in disgusting conduct, I ask, "do they ever look at themselves?"

I know the answer to this question. I tested it. At one point in time, I was concerned that the charge directed at me had merit. Were they right? Were they a bit wrong, but mostly right? I wanted to know the answer to this question. No, I really really wanted to know it. So I invested some effort toward answering

@AlainODea
AlainODea / WhatIsMyProxy.java
Created September 11, 2013 14:18
Java Proxy Verification - Output current proxy in use for a supplied URL (if any) with no dependencies outside JavaSE
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
public class WhatIsMyProxy
{
public static void main(String[] args)
{
String website = args[0];
Proxy proxy = ProxySelector.getDefault().select(URI.create(website)).iterator().next();
@AlainODea
AlainODea / GetURL.java
Last active February 3, 2019 05:39
Java Proxy Verfication - Simple URL Loader with no dependencies outside JavaSE
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.net.URL;
public class GetURL
{
public static void main(String[] args) throws Exception