Skip to content

Instantly share code, notes, and snippets.

View mikemackintosh's full-sized avatar
🍏
Working on the next big thing

Mike Mackintosh mikemackintosh

🍏
Working on the next big thing
View GitHub Profile
import (
"encoding/base64"
"strings"
)
func decodeJWT(jwt string) ([]byte, error) {
// Split the JWT into its three parts
parts := strings.Split(jwt, ".")
if len(parts) != 3 {
return nil, errors.New("invalid JWT format")
project
├ web/
│ ├ build/
│ ├ public/
│ ├ src/
│ ├ package.json
│ └ yarn.lock
├ Dockerfile
├ main.go
├ go.mod
FROM node:16-alpine3.11 as build-node
RUN apk --no-cache --virtual build-dependencies add \
python \
make \
g++
WORKDIR /workdir
COPY web/ .
RUN yarn install
RUN yarn build
function cd () {
local DOTENV="\033[1;38;5;220m[\033[0;38;5;214md\033[0;38;5;215mo\033[0;38;5;216mt\033[0;38;5;217me\033[0;38;5;218mn\033[0;38;5;219mv\033[1;38;5;220m]\033[0m"
if [[ -f .env ]]; then
echo "${DOTENV} Unscoping \033[38;5;243m.env\033[0m configuration"
unset $(cat .env | cut -d'=' -f1)
fi
builtin cd "$@"
if [[ -f .env ]]; then
set -o allexport
echo "${DOTENV} Sourcing environment from \033[38;5;243m.env\033[0m"
package main
// #cgo LDFLAGS: -framework CoreFoundation -framework SystemConfiguration -framework IOKit
// #include <CoreFoundation/CoreFoundation.h>
// #import <SystemConfiguration/SystemConfiguration.h>
// #import <arpa/inet.h>
// #include <IOKit/IOKitLib.h>
//
// CFArrayRef
// createInterface()
for f in $HOME/.private/*.sh; do
source $f;
done
$ addsecret MYLITTLEPONY unicorn8
$ set_mylittlepony_token
$ [ ! -z $HAS_MYLITTLEPONY_TOKEN ] && echo "🦄"
# addsecret - Helps manage secrets stored in a users environment within
# $HOME/.private. This function takes two arguments, `service` and `secret`.
#
# To debug, run with DEBUG=true addsecret [options]
#
# Usage:
# $ addsecret oauth_service f07s84d9a219acc8f69a8af9bd
# To access secret, run: set_oauth_secret
# -> creates $HOME/.private/oauth_service.sh
# -> source's $HOME/.private/oauth_service.sh
@mikemackintosh
mikemackintosh / addsecret.sh
Created February 3, 2020 21:52
Adds a secret helper to your bash environment
# addsecret - Helps manage secrets stored in a users environment within
# $HOME/.private. This function takes two arguments, `service` and `secret`.
#
# To debug, run with DEBUG=true addsecret [options]
#
# Usage:
# $ addsecret oauth_service f07s84d9a219acc8f69a8af9bd
# To access secret, run: set_oauth_secret
# -> creates $HOME/.private/oauth_service.sh
# -> source's $HOME/.private/oauth_service.sh
<?php
/************************************
*
* arguments:
* $method is the requested method of the cURL,
* default GET
* $route is the URL to access
* default is blank
* $body is the body of the request for POST/PATCH/PUT, etc
* default is NULL