Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / playground.go
Created Jan 16, 2023
[Go Playground multiple files] #go #golang #playground
View playground.go
package main
import (
"play.ground/foo"
)
func main() {
foo.Bar()
}
@Integralist
Integralist / Publishing packages for multiple languages.md
Created Dec 9, 2022
[Publishing packages for multiple languages] #publish #package #ruby #php #python #go #golang #js #javascript #rust
View Publishing packages for multiple languages.md
@Integralist
Integralist / Getting JS module published.md
Created Dec 9, 2022
[Getting JS module published] #js #javascript #npm #module
View Getting JS module published.md
  • Run tag="v3.0.0" && git tag -s $tag -m $tag && git push origin $tag
  • Run npm login and follow instructions
  • Run npm publish --dry-run and check there are no errors
  • Run npm publish to publish the module to https://www.npmjs.com/package/fastly
@Integralist
Integralist / Getting Go package documentation published.md
Created Dec 9, 2022
[Getting Go package documentation published] #go #pkg #docs
View Getting Go package documentation published.md
@Integralist
Integralist / example.bash
Created Dec 1, 2022
[Write to a variable multiple times before writing to disk] #bash #shell #performance
View example.bash
function bar {
example=$(echo "$example" | rg $1 \
--case-sensitive \
--type go \
--type md \
--color never \
--no-line-number \
--passthru \
--replace $2)
}
@Integralist
Integralist / RipGrep inline file replacements.sh
Last active Nov 29, 2022
[RipGrep inline file replacements] #riggrep #rg #sed #replacement #bash #shell
View RipGrep inline file replacements.sh
#!/bin/bash
# DESCRIPTION:
# Replaces all instances where...
#
# `Id` should be `ID`
# `Acl` should be `ACL`
# `Http` should be `HTTP`
#
# DEPENDENCIES:
@Integralist
Integralist / example.go
Created Nov 24, 2022
[CLI Device Authorization Flow with Auth0] #auth #auth0 #device #cli
View example.go
package authenticate
// https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow
// https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-the-device-authorization-flow
import (
"encoding/json"
"fmt"
"io"
"net/http"
@Integralist
Integralist / authenticate-auth0.go
Last active Jan 13, 2023
[CLI PKCE with Auth0 or KeyCloak] #auth #auth0 #pkce #cli #keycloak
View authenticate-auth0.go
// Demonstrated with a proof-of-concept developed for the Fastly CLI.
package authenticate
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
@Integralist
Integralist / OAuth2 and OIDC (OpenID Connect).md
Last active Nov 24, 2022
[OAuth2 and OIDC (OpenID Connect)] #OAuth #OIDC
View OAuth2 and OIDC (OpenID Connect).md

Reference video: https://www.youtube.com/watch?v=5th6CSQTdpM

OAuth2

OAuth is about "authorization" and not "authentication".

Authentication vs Authorization

  • Authentication is the process of verification that an individual, entity or website is who it claims to be.
  • Authorization is the function of specifying access rights to resources.
@Integralist
Integralist / Makefile
Created Oct 4, 2022
[Makefile prompt for user input] #make #shell
View Makefile
TEST?=$$(go list ./... |grep -v 'vendor')
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
WEBSITE_REPO=github.com/hashicorp/terraform-website
PKG_NAME=fastly
FULL_PKG_NAME=github.com/fastly/terraform-provider-fastly
VERSION_PLACEHOLDER=version.ProviderVersion
VERSION=$(shell git describe --tags --always)
VERSION_SHORT=$(shell git describe --tags --always --abbrev=0)
DOCS_PROVIDER_VERSION=$(subst v,,$(VERSION_SHORT))