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 June 26, 2024 15:28
Separate the musical instruments from a song and make an instrumental
@Integralist
Integralist / Vim for beginners.md
Created June 5, 2024 06:01
[Vim beginner notes] #vim #beginner

There are many 'motions' and things you can do but I would probably say there are some essential motions you'll use a lot...

  • :<LINE_NUMBER> to jump to a specific line number (e.g. :10)
  • gg to go to the top of the file (G to go to the bottom)
  • Ctrl+d to go down half a page (Ctrl+u to go up half a page)
  • { and } to jump back and forth between paragraphs
  • f<CHARACTER> to jump forward on the current line to a specific character (use F to search backwards in the line).
  • ^ to go to the start of the line (0 if you want to specifically go back to the zero column)
  • $ to go to the end of the line
  • / to search for text in the current buffer (see https://www.vimregex.com/ or use \v flag to make regexes a bit more sane, e.g. `/\v
@Integralist
Integralist / filerename.sh
Created May 22, 2024 08:17
[Rename files matching specific pattern] #shell #bash #macos #files #rename
#!/bin/bash
# Iterate over each MP4 file in the current directory
for file in *.mp4; do
# Check if the file matches the pattern: MMDDYYYY <NAME>.mp4
if [[ "$file" =~ ^([0-9]{2})([0-9]{2})([0-9]{4})\ (.*)\.mp4$ ]]; then
# Extract the parts of the filename
MM="${BASH_REMATCH[1]}"
DD="${BASH_REMATCH[2]}"
YYYY="${BASH_REMATCH[3]}"
@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"]