Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / 1. Example.sh
Last active May 24, 2023 08:12
[Golang stream new-line delimited JSON to Server] #go #golang #api #stream #json
View 1. Example.sh
./stream.sh 100000 | go run client.go
@Integralist
Integralist / Makefile
Last active May 23, 2023 12:20
[Makefile help output] #make #makefile #help #docs
View Makefile
# IMPORTANT: The help target requires variables to have whitespace stripped.
# But only for variables whose line ends with comment docs (e.g. ## ...)
# To strip whitespace use `$(strip $(VARIABLE_NAME))`
# Alternative was worse, i.e. remove space between value and doc comment.
# Then updating the last line of the help target to account for closed space.
# returns any tag associated with the given HEAD commit.
tag_check: ## A
@if [[ ! $$(git tag --points-at $$(git rev-parse --short HEAD)) ]]; then echo "no git tag found on HEAD commit"; exit 1; fi
@Integralist
Integralist / API Versioning Strategies.md
Created April 25, 2023 13:20
[API Versioning Strategies] #api #versioning
View API Versioning Strategies.md

Terraform Analysis

Terraform uses SDKs for interacting with provider APIs. There isn’t a distinction to be made for Terraform. You just bump the SDK version and it’s down to the individual provider APIs ‘under the covers’ to handle versioning. So in that case I looked at the top providers listed on https://registry.terraform.io/browse/providers which are AWS, Azure and Google Cloud Platform.

AWS

AWS versions its APIs using a versioning system based on the format “YYYY-MM-DD”. The YYYY-MM-DD format is based on the date of the API release. Each API has its own version number, which is incremented with each new release.

For example, an API released on January 1st, 2020, would have a version number of “2020-01-01”.

@Integralist
Integralist / OpenSSL Generate Certificate for Code Signing.md
Last active March 24, 2023 14:15
[OpenSSL Generate Certificate for Code Signing] #openssl #cert #codesign #AI
View OpenSSL Generate Certificate for Code Signing.md

NOTE: The explanation of the code was auto-generated by AI (so some of the explanations could be incorrect).

openssl genrsa -des3 -out rootCA.key 4096

This code generates a new RSA private key with a length of 4096 bits and encrypts it using the Triple DES algorithm with a passphrase. The private key is saved in a file named rootCA.key. This command is commonly used to generate a root certificate authority (CA) key, which is used to sign and issue digital certificates for other entities.

openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.crt
@Integralist
Integralist / changelog.bash
Last active March 30, 2023 12:49
[Generate change log between two tags] #changelog #git
View changelog.bash
#!/bin/bash
tags=$(git for-each-ref --sort=-creatordate --format '%(refname) %(creatordate)' refs/tags | grep -Eo 'client/rust@v?[^ ]+')
latest_tag=$(echo "$tags" | head -n 1)
second_tag=$(echo "$tags" | head -n 2 | tail -1)
release_version=$(echo "$latest_tag" | cut -d @ -f 2)
# echo "all tags for this language: $tags"
# echo "latest tag: $latest_tag"
# echo "second tag: $second_tag"
@Integralist
Integralist / extract-first-changelog-entry.md
Last active March 23, 2023 09:01
[AWK extract first changelog entry] #awk #changelog
View extract-first-changelog-entry.md

We want just the 'v1.0.0-beta.2' changelog block, not 'v1.0.0-beta.1'...

# Changelog

## [v1.0.0-beta.2](...)

**Bug fixes:**

- ...
@Integralist
Integralist / main.go
Created February 13, 2023 17:06
[Golang spinner] #go #golang #spinner
View main.go
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
View main.go
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
View playground.go
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
View Publishing packages for multiple languages.md