Skip to content

Instantly share code, notes, and snippets.

View retgits's full-sized avatar
💻
Writing awesome code

Leon Stigter retgits

💻
Writing awesome code
View GitHub Profile
@retgits
retgits / keybase.md
Created June 23, 2021 20:51
keybase.md

Keybase proof

I hereby claim:

  • I am retgits on github.
  • I am retgits (https://keybase.io/retgits) on keybase.
  • I have a public key ASAbmI4wU0_g_V2ImYpjMs91uDvxGBpl-86XFL3Z0GCXGgo

To claim this, I am signing this object:

@retgits
retgits / .zshrc
Created March 24, 2020 21:50
PowerLevel 9K custom prompt element to show the Pulumi project and stack you're working on
## Set the name of the function, foreground, and background color
POWERLEVEL9K_CUSTOM_PULUMI_STACK="zsh_pulumi_stack"
POWERLEVEL9K_CUSTOM_PULUMI_STACK_FOREGROUND="black"
POWERLEVEL9K_CUSTOM_PULUMI_STACK_BACKGROUND="221"
POWERLEVEL9K_CUSTOM_PULUMI_PROJECT="zsh_pulumi_project"
POWERLEVEL9K_CUSTOM_PULUMI_PROJECT_FOREGROUND="white"
POWERLEVEL9K_CUSTOM_PULUMI_PROJECT_BACKGROUND="056"
## zsh_pulumi_stack and zsh_pulumi_project are custom additions for PowerLevel9K that checks whether the current directory
## contains a Pulumi.yaml file. If the file exists, you're likely working on a Pulumi project and so it adds an element to
@retgits
retgits / main.go
Created October 4, 2019 23:47
A quick snippet for a Gin middleware to validate whether messages actually come from Slack
// Complete workflow from: https://api.slack.com/docs/verifying-requests-from-slack
package main
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"fmt"
"strconv"
@retgits
retgits / script.sh
Last active October 1, 2018 03:27
Listing globally installed NPM packages and version #nodejs
npm list -g --depth=0
@retgits
retgits / main.go
Created August 27, 2018 04:25
Get the current date in Go
// Original source: https://gistpages.com/posts/go-lang-get-current-date
// Go playground: https://play.golang.org/p/gBO8rdKI6UF
// time.Format should use the layout, Mon Jan 2 15:04:05 MST 2006 to show the pattern
package main
import (
"fmt"
"time"
)
@retgits
retgits / main.go
Created August 7, 2018 05:01
A Flogo app written in Go that connects to PubNub
//go:generate go run $GOPATH/src/github.com/TIBCOSoftware/flogo-lib/flogo/gen/gen.go $GOPATH
package main
import (
"context"
"github.com/TIBCOSoftware/flogo-contrib/activity/log"
"github.com/TIBCOSoftware/flogo-lib/core/data"
"github.com/TIBCOSoftware/flogo-lib/engine"
"github.com/TIBCOSoftware/flogo-lib/flogo"
@retgits
retgits / install-minikube-openfaas-ec2.sh
Created July 25, 2018 18:48
Script to install Minikube and OpenFaas on Amazon EC2
###
# References
# http://dreamcloud.artark.ca/docker-hands-on-guide-docker-and-minikube-on-aws-ec2/
# https://github.com/robertluwang/docker-hands-on-guide/blob/master/minikube-none-installation.md
# https://github.com/openfaas/faas/blob/master/guide/deployment_k8s.md
#
# Last update: Feb 2, 2018
###
### Prerequisites
@retgits
retgits / main.go
Created July 12, 2018 21:14
Function to check whether a received webhook event actually comes from GitHub
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"fmt"
"strings"
"github.com/aws/aws-lambda-go/events"
var express = require('express');
var router = express.Router();
var url = require('url');
router.get('/api', function(req, res, next) {
var err = "this is error";
var data = { data: "Succuss"}
if (err) {
var error = Error (err)