Skip to content

Instantly share code, notes, and snippets.

View dcaponi's full-sized avatar

Dominick Caponi dcaponi

View GitHub Profile
@dcaponi
dcaponi / apps_test.go
Created May 2, 2020 22:13
tf test example
package onelogin
import (
"testing"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)
func TestAccApp_crud(t *testing.T) {
base := GetFixture("onelogin_app_example.tf", t)
@dcaponi
dcaponi / provider_test.go
Created May 2, 2020 22:17
tf provider test
package onelogin
import (
"errors"
"os"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)
@dcaponi
dcaponi / main.tf
Last active May 4, 2020 14:53
example hcl
provider "onelogin" {
client_id = "xxxxxxxxxxxxxxxxxxxx"
client_secret = "xxxxxxxxxxxxxxxxxxxx"
url = "https://api.us.onelogin.com"
}
resource "onelogin_saml_apps" "aws-sample-1"{
connector_id = 50534
name = "AWS Multi Role - Terraform change"
description = "AWS Multi Role app created via Terraform"
@dcaponi
dcaponi / remove_tags.bash
Created May 15, 2020 18:27
Reset all tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@dcaponi
dcaponi / linux_commands.md
Created May 15, 2020 18:28
Linux Commands

#Linux Commands

Simple Stuff

grep - search for a string

search for word "stuff" in a file called filename and returns all lines with the word "stuff"

grep "stuff" filename.ext

@dcaponi
dcaponi / release.yml
Created June 7, 2020 21:34
Multi-Platform Go Ship with GH Action
on:
push:
tags:
- '*'
name: Release
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
@dcaponi
dcaponi / ship.sh
Created June 7, 2020 21:35
Builds go binaries, adds some literature, and compresses the folder for Mac, Linux, and Windows
#!/usr/bin/env bash
package=$1
if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi
package_split=(${package//\// })
package_name=${package_split[${#package_split[@]}-1]}
@dcaponi
dcaponi / PKCE_login_page.js
Last active June 1, 2023 13:37
Prototype of OIDC PKCE Flow in React
import React, { Component } from 'react';
import axios from 'axios';
import qs from "qs";
import * as base64 from 'base64-js'
import SubmitButton from '../../ui_components/buttons/submit_button';
import AppWrapper from '../../ui_components/app_wrapper/app_wrapper'
import Popup from '../../ui_components/popup/popup';
class LoginOIDCPage extends Component {
@dcaponi
dcaponi / pkce_code_challenge.js
Created January 1, 2021 19:55
Takes a code_verifier string and makes a legal code_challenge out of it
const createCodeChallenge = ( codeVerifier ) => {
if ( typeof window !== 'undefined' && !!( window.crypto ) && !!( window.crypto.subtle ) ) {
return new Promise( ( resolve, reject ) => {
let codeVerifierCharCodes = textEncodeLite( codeVerifier );
crypto.subtle
.digest( 'SHA-256', codeVerifierCharCodes )
.then(
hashedCharCodes => resolve( urlSafe( new Uint8Array(hashedCharCodes) ) ),
error => reject( error )
);
@dcaponi
dcaponi / code_verifier.js
Created January 1, 2021 19:56
Creates a legal code_verifier based on the OAuth Spec
const createCodeVerifier = ( size ) => {
const charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~';
const charsetIndexBuffer = new Uint8Array( size );
for ( let i = 0; i < size; i += 1 ) {
charsetIndexBuffer[i] = ( Math.random() * charset.length ) | 0;
}
let randomChars = [];
for ( let i = 0; i < charsetIndexBuffer.byteLength; i += 1 ) {