Skip to content

Instantly share code, notes, and snippets.

View jonfriesen's full-sized avatar
🪐
hey there!

Jon Friesen jonfriesen

🪐
hey there!
View GitHub Profile
@jonfriesen
jonfriesen / totp.ps1
Last active March 17, 2024 19:44
TOTP Client for PowerShell
#requires -version 2
<#
.SYNOPSIS
Time-base One-Time Password Algorithm (RFC 6238)
.DESCRIPTION
This is an implementation of the RFC 6238 Time-Based One-Time Password Algorithm draft based upon the HMAC-based One-Time Password (HOTP) algorithm (RFC 4226). This is a time based variant of the HOTP algorithm providing short-lived OTP values.
.NOTES
Version: 1.0
@jonfriesen
jonfriesen / template.bat
Created February 6, 2018 00:40
A simple bat file template
@::!/dos/rocks
@echo off
goto :init
:header
echo %__NAME% v%__VERSION%
echo This is a sample batch file template,
echo providing command-line arguments and flags.
echo.
goto :eof
listener 8080 0.0.0.0
protocol websockets
allow_anonymous true
log_dest stderr
log_type error
log_type warning
log_type notice
log_type information
@jonfriesen
jonfriesen / deepMerge.js
Created December 10, 2021 00:36
Opinionated deepmerge
/**
* deepMerge takes two objects and overwrites the values with
* incoming values, if they are empty, undefined, or missing,
* the default values will be used.
*
* In the case of arrays, the first value in the object set
* will be used as the template and applied to all values
* in the incoming set.
*/
function deepMerge(defaultSet, incomingSet) {

Quick Start with Go

Overview

In this developer guide we are going to cover the considerations, strategies, and pitfalls to optimally host your Go app on App Platform. If you come across something that isn't covered in this guide ask a community question.

Before you start

We make the assumption that you've already have a Go app. To get start with Go checkout the official Getting Started with Go documentation.

To deploy a Go app on App Platform, you will need a couple things:

@jonfriesen
jonfriesen / main.go
Created August 19, 2021 20:44
Example function to proxy a PDF from one URL to a http handler func
package main
import (
"fmt"
"io"
"net"
"net/http"
"time"
)
<script>
export let component;
export let config;
export let items;
export let component_id;
let idIncrement = 0;
$items.forEach((item) => {
item.__id = idIncrement;
@jonfriesen
jonfriesen / .travis.yml
Last active March 20, 2021 08:23 — forked from ryboe/.travis.yml
Example .travis.yml for Golang with CodeCov.io integration
language: go
# Only the last two Go releases are supported by the Go team with security
# updates. Any versions older than that should be considered deprecated.
# Don't bother testing with them. tip builds your code with the latest
# development version of Go. This can warn you that your code will break
# in the next version of Go. Don't worry! Later we declare that test runs
# are allowed to fail on Go tip.
go:
- 1.9
@jonfriesen
jonfriesen / main.go
Created March 17, 2020 17:43
Generate SSH key pair in Go
// Note: There were a couple blogposts I used to write this but for the life of me can't seem to find them. Will update with references if I do.
// generateSSHKeyPair creates a private & public key pair
func generateSSHKeyPair(bitSize int) (privateKey []byte, publicKey []byte, err error) {
// generate private key
pKey, err := generatePrivateKey(keySize)
if err != nil {
return nil, nil, errors.Wrap(err, "failed to create private key")
}
[connection]
id=DO - NYC3
uuid=<COPY_FROM_DUMMY>
type=vpn
autoconnect=false
metered=2
permissions=user:<YOUR_LINUX_USERNAME>:;
timestamp=1581433754
[vpn]