Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / README.md
Created May 15, 2024 09:10
[Proxy HTTP requests through a SSH connection via SOCKS5 proxy] #ssh #proxy #tunnel

https://www.linkedin.com/pulse/proxying-web-traffic-via-ssh-mark-el-khoury

Essentially your local machines creates a SOCK5 proxy which connects to a remote server via SSH (using either username/password or SSH PKI Cert/Key combination).

The SOCK5 proxy handles sending the HTTP request via the SSH tunnel.

The remote server will automatically process the HTTP request and handle sending it to its intended destination.

The upstream (i.e. the endpoint being requested) will see the request coming from the SSH server and presume that's where it originated.

@Integralist
Integralist / README.md
Created May 13, 2024 15:10
[Highligh notes and warnings in Markdown] #gist #github #notes
@Integralist
Integralist / .editorconfig
Created May 8, 2024 13:44
[Example Editor Config] #editorconfig
root = true
[*]
indent_size = 2
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
@Integralist
Integralist / Different Testing Styles.md
Created April 29, 2024 09:03
[Different Testing Styles] #tests #terminology #system

Unit test

Specify and test one point of the contract of single method of a class. This should have a very narrow and well defined scope. Complex dependencies and interactions to the outside world are stubbed or mocked.

Integration test

Test the correct inter-operation of multiple subsystems. There is whole spectrum there, from testing integration between two classes, to testing integration with the production environment.

Acceptance test

@Integralist
Integralist / 1. middleware.go
Last active March 27, 2024 12:03
[Go basic middleware abstraction] #go #golang #middleware
// THIS IS THE REDESIGNED VERSION (see 3. middleware.go for my original approach)
package middleware
import (
"net/http"
)
// Decorator is a middleware function.
type Decorator func(http.Handler) http.Handler
@Integralist
Integralist / OSI.md
Created March 25, 2024 10:30
[OSI] #OSI

@Integralist
Integralist / README.md
Last active March 14, 2024 13:52
[Docker Go Image with mounted files] #docker #go #golang #image #container #mount

Start with a Dockerfile:

FROM golang:latest

RUN apt-get update -y && apt-get install git -y

CMD ["/bin/bash"]
@Integralist
Integralist / main.go
Created March 7, 2024 10:26
[Go convert JSON types when unmarshalling] #go #golang #json #unmarshal
package main
import (
"encoding/json"
"fmt"
)
func main() {
var jsonBlob = []byte(`[
{"str": "Foo", "num": "1", "bool": "true", "its": 3},
@Integralist
Integralist / Makefile
Created March 1, 2024 10:48
[Check if Makefile target is called with a required input arg] #Makefile #make
# Check that given variables are set and all have non-empty values,
# die with an error otherwise.
#
# PARAMS:
# 1. Variable name(s) to test.
# 2. (optional) Error message to print.
#
# EXAMPLE:
# @:$(call check_defined, ENV_REGION, you must set ENV_REGION=usc1|awsuse2)
#
@Integralist
Integralist / Install Windows on macOS with VirtualBox.md
Created February 29, 2024 10:42
[Install Windows on macOS with VirtualBox] #virtualbox #vm #windows