Skip to content

Instantly share code, notes, and snippets.

@maggie44
maggie44 / gist:98d870da0961b61c32f6e55407697f76
Last active February 3, 2025 10:17
Example: Running `docker compose up` in Golang
// Note: Docker Compose is not a library and not officially supported for use this way. However, a number of us
// have found a need to use it in this way and below is the pooled knowledge of how to do so.
// See https://github.com/docker/compose/issues/12513#issuecomment-2630164655 for more info.
package main
import (
"context"
"fmt"
"log/slog"
@maggie44
maggie44 / gist:189b2536e39f4660f12f3b92235ca3fc
Created December 15, 2024 18:06
Nebula gVisor API Request Forwarder
func startHTTPReverseProxy(ctx context.Context, svc *service.Service) error {
mux := http.NewServeMux()
server := &http.Server{
Addr: ":3399",
Handler: mux,
}
// Create a custom transport with the custom dial context
transport := &http.Transport{
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
@maggie44
maggie44 / golang_udp_relay.go
Created April 8, 2023 19:34
Golang UDP to UDP relay
package udp_relay
import (
"net"
log "github.com/sirupsen/logrus"
)
var (
// Max buffer size for the socket io
@maggie44
maggie44 / electron-sign-process.md
Last active January 20, 2025 00:35
Apple and Windows Electron signing and notarising via Electron Builder and GitHub Actions.

Electron Builder Signing and Notarising Process via GitHub Actions (Apple and Windows)

This gist provides details of how to build, sign and notarize Electron apps for macOS and Windows using Electron Builder via a GitHub Action.

Step 1: Add Electron Builder aftersign process

Electron Builder takes care of a lot of the signing process. But part of the process to notarize the app with Apple involves submitting the app to Apple for review. This is done through the electron-notarize package. Add the following code to your repository as afterSignHook.js.

"use strict";
@maggie44
maggie44 / gist:186e067ab9c97fc446978718bff640c5
Last active February 1, 2025 16:18
Rough Python Supervisor approach
# Flask:
class supervisor_device(Resource):
def get(self):
response = curl(method="get", path="/v1/device?apikey=")
return response.json(), response.status_code
##