Skip to content

Instantly share code, notes, and snippets.

View rodde177's full-sized avatar

rodde177

  • sthlm
View GitHub Profile
@rodde177
rodde177 / PdfOrErrorController.java
Created November 17, 2021 11:49 — forked from jonikarppinen/PdfOrErrorController.java
Example of using ExceptionHandler in Spring Boot: a controller method that returns either binary data or error JSON
package com.company.project.controllers;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Random;
@rodde177
rodde177 / openssl-notes.txt
Created November 12, 2021 15:43 — forked from tsaarni/openssl-notes.txt
Generate self-signed certs with different key types
*** RSA
# Generate self-signed certificate with RSA 4096 key-pair
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout rsakey.pem -out rsacert.pem
# print private and public key
openssl rsa -in rsakey.pem -text -noout
# print certificate
openssl x509 -in rsacert.pem -text -noout
@rodde177
rodde177 / README MongoDB Podman
Created October 16, 2020 08:20 — forked from jfear/README MongoDB Podman
Setting up mongod using podman
1. Create podman container using the docker mongo image: docker.io/library/mongo:latest
`sudo podman run -d --name mongod -p 27017:27017 -v /var/lib/mongodb:/data/db:Z mongo`
2. Create service file `/etc/systemd/system/mongod.service` to run container:
```
[Unit]
Description=MongoDB Podman container
After=network.target firewalld.service
Wants=network.target
@rodde177
rodde177 / kcdo
Created October 16, 2019 01:19 — forked from mnadel/kcdo
Exec Across (Some, All) Pods in Kubernetes
#!/usr/bin/env bash
PROGNAME=$(basename $0)
function usage {
echo "usage: $PROGNAME [-n NAMESPACE] [-m MAX-PODS] -s SERVICE -- COMMAND"
echo " -s SERVICE K8s service, i.e. a pod selector (required)"
echo " COMMAND Command to execute on the pods"
echo " -n NAMESPACE K8s namespace (optional)"
echo " -m MAX-PODS Max number of pods to run on (optional; default=all)"
@rodde177
rodde177 / vcl-regex-cheat-sheet
Created October 4, 2019 17:36 — forked from dimsemenov/vcl-regex-cheat-sheet
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"
@rodde177
rodde177 / Caddyfile
Created April 8, 2019 10:21 — forked from molotovbliss/Caddyfile
Caddyfile for Magento 2.2.x+ for Caddy web server
# source: https://caddy.community/t/using-caddy-on-a-fresh-magento-2-2-3-ce-install/3708/8
https://example.com {
root /var/www/magento2/pub
gzip {
ext .txt .css .less .js .jsonp .json .xml .rss .svg .svgz .html
level 6
min_length 1100
}
tls [email protected]
log stdout

[POLL] Custom attributes in Magento GraphQL Schema

Magento GraphQL endpoints must support EAV entities such as Products. GraphQL specification requires all complex types eventually to be represented as structures of scalar types. Mixed/any types are not supported.

We have couple options to choose from and would be glad to hear your opinion on that.

Option 1: Custom attributes container

Schema

@rodde177
rodde177 / delete_git_submodule.md
Created January 26, 2019 18:03 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@rodde177
rodde177 / sync_prod_to_stage.sh
Created January 21, 2019 11:28 — forked from erikhansen/sync_prod_to_stage.sh
Magento 2 script to push DB and `pub/media` changes from prod>stage
#!/bin/bash
# stop on errors
set -e
# turn on debugging if you're running into issues
#set -x
#########################
# Overview
#########################
# Magento 2 script to push DB and pub/media changes from prod>stage
@rodde177
rodde177 / multi-git-win.md
Created December 3, 2018 13:37 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)