Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / main.go
Created February 13, 2023 17:06
[Golang spinner] #go #golang #spinner
package main
import (
"time"
"github.com/theckman/yacspin"
)
func main() {
spinner, _ := yacspin.New(yacspin.Config{
@Integralist
Integralist / main.go
Last active January 31, 2023 16:52
[Go recursively search for a file until reaching user's home directory] #go #golang #search #file #recursive
package main
import (
"errors"
"fmt"
"os"
"path/filepath"
)
func main() {
@Integralist
Integralist / playground.go
Created January 16, 2023 12:43
[Go Playground multiple files] #go #golang #playground
package main
import (
"play.ground/foo"
)
func main() {
foo.Bar()
}
@Integralist
Integralist / Publishing packages for multiple languages.md
Created December 9, 2022 13:59
[Publishing packages for multiple languages] #publish #package #ruby #php #python #go #golang #js #javascript #rust
@Integralist
Integralist / Getting JS module published.md
Created December 9, 2022 11:55
[Getting JS module published] #js #javascript #npm #module
  • 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 December 9, 2022 11:23
[Getting Go package documentation published] #go #pkg #docs
@Integralist
Integralist / example.bash
Created December 1, 2022 12:09
[Write to a variable multiple times before writing to disk] #bash #shell #performance
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 November 29, 2022 17:05
[RipGrep inline file replacements] #riggrep #rg #sed #replacement #bash #shell
#!/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 November 24, 2022 09:42
[CLI Device Authorization Flow with Auth0] #auth #auth0 #device #cli
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 April 6, 2023 13:35
[CLI PKCE with Auth0 or KeyCloak (inc code examples + sequence diagram)] #auth #auth0 #pkce #cli #keycloak
// Demonstrated with a proof-of-concept developed for the Fastly CLI.
package authenticate
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"