Skip to content

Instantly share code, notes, and snippets.

View rodde177's full-sized avatar

rodde177

  • sthlm
View GitHub Profile
@rodde177
rodde177 / PULL_REQUEST_TEMPLATE.md
Created November 24, 2018 16:06
PULL REQUEST TEMPLATE
@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 / stalkers.md
Last active January 26, 2021 08:51
Github Stalkers
@rodde177
rodde177 / xdebug-cron.md
Last active January 15, 2021 23:34
Running Xdebug with cron jobs

Preconditions:

In command line, run following command first time (with same server name as configured in PHPStorm):

export PHP_IDE_CONFIG="serverName=localhost.tld" export XDEBUG_CONFIG="idekey=PHPSTORM"

@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 / nginx.conf
Created August 21, 2019 11:52
NGINX logging
log_format main '$http_x_forwarded_for - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent"' ;
log_format json_combined escape=json
'{'
'"time_local":"$time_local",'
'"remote_addr":"$http_x_forwarded_for",'
'"remote_user":"$remote_user",'
'"request":"$request",'
@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 webmaster@example.com
log stdout