Skip to content

Instantly share code, notes, and snippets.

View madchap's full-sized avatar

Fred Blaise madchap

  • Vaud, Switzerland
View GitHub Profile
@madchap
madchap / wg0.conf
Created November 20, 2022 13:55
Wireguard test
[Interface]
PrivateKey = 5jImAJsnYHHvKKhLWGM+w56Ah66TFhpcp0bQIOVcJGU=
Address = 192.168.123.107/32
[Peer]
PublicKey = SZYtyct8ZIl0whdevAbev1ZvHWVZdDv5GeAiSr3C7gk=
AllowedIPs = 192.168.1.0/24
Endpoint = 52.18.63.80:51820
PersistentKeepalive = 90
@madchap
madchap / semgrep-text4shell-test.yaml
Last active October 24, 2022 15:38
semgrep text4shell
rules:
- id: CVE-2022-42889
languages:
- java
options:
symbolic_propagation: true
severity: ERROR
message: Detected Text4Shell
metadata:
references:
@madchap
madchap / maven_dependency_version_enforcer.xml
Created December 16, 2021 15:38
maven dependency version enforcer
<!-- plug-in configuration to put into your parent POM for avoiding any usages of outdated log4j2 versions,
some of which are subject to the RCE CVE-2021-44228 ("Log4Shell") and CVE-2021-45046 -->
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>ban-bad-log4j-versions</id>
@madchap
madchap / Dockerfile
Created November 15, 2021 20:28
Hello gRPC server
FROM golang:1.17 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends git; \
rm -rf /var/lib/apt/lists/*
WORKDIR $GOPATH/src/helloworld
RUN git clone -b v1.41.0 https://github.com/grpc/grpc-go
WORKDIR grpc-go/examples/helloworld/greeter_server
RUN go mod init
RUN go get -d -v
RUN CGO_ENABLED=0 go build -o /go/bin/greeter_server
@madchap
madchap / JIRA field to screen checkbox.js
Created December 24, 2020 10:46
JIRA field to screen checkbox
document.querySelectorAll("input[name=associatedScreens]").forEach(input => input.checked = true)
[uwsgi]
socket = 0.0.0.0:3031
protocol = uwsgi
module = dojo.wsgi:application
py-autoreload = 1
lazy-apps
honour-stdin
threaded-logger
buffer-size = 4096
; log-encoder = json {"unix":${unix}, "msg":"${msgln}", "date":"${strftime:%%d/%%m/%%Y %%H:%%M:%%S}"}
@madchap
madchap / cancel_queued_builds.groovy
Created April 30, 2020 08:10
Cancel all Jenkins queued builds
import hudson.model.*
import jenkins.model.Jenkins
def q = Jenkins.instance.queue
q.items.findAll { it.task.name.startsWith('your_job_name') }.each { q.cancel(it.task) }
@madchap
madchap / graphql_github_pr_query.sh
Last active June 19, 2020 20:16
GitHub graphQL PR query
#!/usr/bin/env bash
set -e
set -o pipefail
OUTPUT=$(curl -s --location --request POST 'https://api.github.com/graphql' \
--header "Authorization: Bearer $GH_TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{"query":"{\n search(first: 50, query: \"repo:DefectDojo/django-DefectDojo is:pr is:merged created:2020-03-12..2020-04-11\", type: ISSUE) {\n nodes {\n ... on PullRequest {\n number\n title\n url\n author { login }\n }\n }\n }\n}","variables":{}}')
echo "$OUTPUT" | jq -r '.data.search.nodes[] | [.number, .author.login, .title, .url] |@csv' | tr -d \" | awk -v FS="," 'BEGIN{OFS="\n";}{printf "- %s @%s [#%i](%s)\n",$3,$2,$1,$4}'
@madchap
madchap / keybase.md
Created March 17, 2020 17:05
keybase.md

Keybase proof

I hereby claim:

  • I am madchap on github.
  • I am madchap (https://keybase.io/madchap) on keybase.
  • I have a public key ASAlthwCTKnzy30GgGsAMvJaascIGYaSb2CgFQSJQwV7tgo

To claim this, I am signing this object:

@startuml
!pragma teoz true
== Release ==
participant "Dev branch" as devbranch order 10 #LightBlue
participant "RC branch" as rcbranch order 20 #YellowGreen
participant "Master branch" as master order 30 #99FF99
participant "Hotfix branch" as hotbranch order 40 #DarkSalmon
{startrc} devbranch -> rcbranch ++ #YellowGreen: Start release