Skip to content

Instantly share code, notes, and snippets.

View mikeharty's full-sized avatar
🚀

Mike Harty mikeharty

🚀
View GitHub Profile
@mikeharty
mikeharty / HttpExecutable.rb
Created December 16, 2023 22:40
Customized version of GraphQL::Stitching::HttpExecutable
module Supergraph
# Custom HttpExecutable
# - Uses RestClient instead of Net::HTTP
# - Adds Authenticator
# - Adds Guard
# - Adds pre and post processing hooks
# - Handles multipart form file uploads
class HttpExecutable < GraphQL::Stitching::HttpExecutable
attr_accessor :uri, :headers
@mikeharty
mikeharty / Clrzr.rb
Last active October 13, 2023 21:13
Clrzr.rb
# == Clrzr
# A static class for colorizing terminal output
# in Ruby scripts. I was learning Ruby ¯\_(ツ)_/¯
class Clrzr
private_class_method :new
class << self
CLR = {
:black => 30,
:bright_black => 90,
@mikeharty
mikeharty / token-flow.rb
Last active December 11, 2023 21:14
Token Flow - OAuth2 CLI utility
require 'optparse'
require 'net/http'
require 'json'
require 'jwt'
require 'time'
def flow
env_opts
combine_opts
validate_opts
@mikeharty
mikeharty / envy.sh
Last active September 26, 2023 17:12
ENVY - A poor man's dotenv
#!/bin/sh
usage="\e[44;1m ENVY \e[0m A poor man's dotenv for POSIX shells\n\n"
usage+="This script will \"source\" the provided .env file within a subshell, and then\n"
usage+="run the commands you pass within that subshell. This is a simple but effective way\n"
usage+="to get the basic advantages of dotenv in a shell. It uses a naive regexp to parse\n"
usage+="the provided .env, so it is not a full dotenv implementation.\n\n"
usage+="Usage: ./envy <dotenv> <commands>\n\n"
usage+="Options: \n"