This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func fullURL(r *http.Request, overridePath ...string) string { | |
scheme := "http" | |
if r.TLS != nil { | |
scheme = "https" | |
} | |
if len(overridePath) != 0 { | |
return fmt.Sprintf("%s://%s%s", scheme, r.Host, overridePath[0]) | |
} | |
return fmt.Sprintf("%s://%s%s?%s#%s", scheme, r.Host, r.URL.Path, r.URL.RawQuery, r.URL.Fragment) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JIT session error: Symbols not found: [ _OBJC_CLASS_$_NSWorkspace, _NSWorkspaceDidWakeNotification ] | |
Failed to materialize symbols: { (main, { __swift_FORCE_LOAD_$_swiftObjectiveC_$_watch_for_lock_unlock, _got.$sSY8rawValuexSg03RawB0Qz_tcfCTq, _$sSo18NSNotificationNameaSYSCMA, __swift_FORCE_LOAD_$_swiftos_$_watch_for_lock_unlock, _got.$s8RawValueSYTl, _got.$ss20_SwiftNewtypeWrapperPSYTb, _$s10Foundation12NotificationVIeghn_So14NSNotificationCIeyBhy_TR, _symbolic _____ 21watch_for_lock_unlock18ScreenLockObserverC, _got.$ss20_SwiftNewtypeWrapperMp, _$s21watch_for_lock_unlock18ScreenLockObserverCMn, _$sSo18NSNotificationNameaABSYSCWL, _$s21watch_for_lock_unlock18ScreenLockObserverCMm, _got.$s15_ObjectiveCTypes01_A11CBridgeablePTl, _associated conformance So18NSNotificationNameaSHSCSQ, _associated conformance So18NSNotificationNameas20_SwiftNewtypeWrapperSCSY, _$sSo18NSNotificationNameaABs35_HasCustomAnyHashableRepresentationSCWl, _$sSo18NSNotificationNameas20_SwiftNewtypeWrapperSCMc, _$sS2Ss21_ObjectiveCBridgeab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export DOCKER_BUILDKIT=1 | |
GPC_PROJECT_ID=hkraft-iot | |
SERVICE_NAME=defibrilator-registry | |
CONTAINER_NAME=europe-west1-docker.pkg.dev/$(GPC_PROJECT_ID)/cloud-run/$(SERVICE_NAME) | |
.PHONY: * | |
run: build | |
docker run -it -p 8080:8080\ | |
-e CLIENT_ID=$$(gopass hjertestarterregisteret.no/client-id)\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello world!") | |
}) | |
port := os.Getenv("PORT") | |
if port == "" { | |
port = "8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1-alpine as builder | |
RUN apk update | |
RUN apk add --no-cache ca-certificates git | |
WORKDIR /app | |
# Fetch dependencies first; they are less susceptible to change on every build | |
# and will therefore be cached for speeding up the next build. | |
COPY go.* . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global init.defaultBranch main | |
git config --global alias.clone 'clone' | |
git config --global alias.br 'branch' | |
git config --global alias.st 'status' | |
git config --global alias.co 'checkout' | |
git config --global alias.ci 'commit' | |
git config --global alias.pr 'pull --rebase' | |
git config --global alias.pa 'pull --abort' | |
git config --global alias.rc 'rebase --continue' | |
git config --global alias.rs 'rebase --skip' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var subscription Subscription | |
err := json.NewDecoder(r.Body).Decode(&subscription) | |
if err != nil { | |
http.Error(w, err.Error(), http.StatusBadRequest) | |
return | |
} | |
defer r.Body.Close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
import socketserver | |
from http import HTTPStatus | |
import os | |
class Handler(http.server.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(HTTPStatus.OK) | |
self.end_headers() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
if ! [ $# -eq 1 ] ;then | |
echo "Ha mappen du vil ha backup av som argument" | |
exit 1 | |
fi | |
echo "Navn på backupen:" | |
read name | |
echo "Passord:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on https://github.com/isfonzar/filecrypt/blob/master/filecrypt.go | |
func encryptAES(password, plaintext string) (string, error) { | |
key := []byte(password) | |
nonce := make([]byte, 12) | |
// Randomizing the nonce | |
if _, err := io.ReadFull(rand.Reader, nonce); err != nil { | |
return "", fmt.Errorf("io.ReadFull(...): %w)", err) | |
} |
NewerOlder