Navigation Menu

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
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 / 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]
@jonfriesen
jonfriesen / auto-update-vscode.sh
Created August 11, 2019 19:53
script to auto update vs code
#!/bin/bash
wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.deb
sudo dpkg -i /tmp/code_latest_amd64.deb
@jonfriesen
jonfriesen / docker-compose.yml
Created March 13, 2019 20:08
Spins up PostgreSQL & pgAdmin4 (username: pgadmin4@pgadmin.org password:admin)
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
PGDATA: /data/postgres
@jonfriesen
jonfriesen / mongo-status-checker.docker-compose.yml
Created July 25, 2018 18:15
Shows how to create a docker mongo status checker and run command after it connects successfully
version: '3.0'
services:
mongo:
image: mongo
ports:
- "27017:27017"
- "28017:28017"
environment:
MONGO_INITDB_ROOT_USERNAME: mongoadmin
MONGO_INITDB_ROOT_PASSWORD: secret