Skip to content

Instantly share code, notes, and snippets.

View jebeaudet's full-sized avatar

Jacques-Etienne Beaudet jebeaudet

  • Coveo
  • Quebec, Canada
View GitHub Profile
FROM maven:3.8.1-openjdk-11-slim
RUN addgroup --gid 1001 jenkins
RUN adduser --uid 1001 --gid 1001 --disabled-password --gecos '' jenkins
RUN mkdir -p /usr/share/maven/lib/ext/redisson/
RUN sed -i '/.*${maven.conf}\/logging/a load ${maven.home}/lib/ext/redisson/*.jar' usr/share/maven/bin/m2.conf
RUN apt update
RUN apt install -y wget
@jebeaudet
jebeaudet / gist:e7fedbf1aa3f0b8f5c17f7a739a75526
Last active August 28, 2020 12:21
kubectl list all resources in the current namespace [k8s] [kubernetes]
kubectl api-resources -o name | xargs -I {} kubectl get {} --show-kind --ignore-not-found
@jebeaudet
jebeaudet / messageTray.js
Last active August 19, 2020 19:36
dismiss notification on right click linux mint
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Atk = imports.gi.Atk;
const Lang = imports.lang;
from PIL import Image
import sys
import requests
from bs4 import BeautifulSoup
if len(sys.argv) <= 3:
print "Please provide the filename of the picture as first argument and the cookie of slack as second argument and the prefix"
exit(1)
max_width_or_height = 3840
@jebeaudet
jebeaudet / non-server.py
Created January 14, 2020 19:04
Form resubmission bug in chrome part 2
import http.server
import socketserver
PORT = 8000
auto_submit_html = """
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
</head>
<body onload="document.forms[0].submit()">
@jebeaudet
jebeaudet / server.py
Created January 14, 2020 19:00
Form resubmission bug in chrome
import http.server
import socketserver
PORT = 8000
auto_submit_html = """
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
</head>
<body onload="document.forms[0].submit()">
@jebeaudet
jebeaudet / gist:f2fbd78e8b771f1d3c3924c9ccd73fbb
Created December 11, 2019 18:27
Map PID from Host to docker container
PID from the threads/process will be different from the host that from inside the container.
This makes reading thread dump tricky as the thread dump will show the nid of inside the container however you might be checking CPU usage from the host!
To find the mapping of the two, it's easy. Find the PID of the thread/process on the host.
After this, run `cat /proc/{PID}/status |grep NSpid`. Example :
```
NSpid: 31144 83
```
@jebeaudet
jebeaudet / gist:03d4c33acadb7b89ad9b119fe6db6ab9
Last active July 6, 2021 15:22
Decrypt jenkins encrypted value
Go to https://jenkinsurl.com/script and run :
println(hudson.util.Secret.decrypt("{encrypted_value}"))
To get the encrypted_value, go to the credential page, click on update and after do inspect element on the password field. Take the "value" property of the field. It should be between curly braces.
To get ALL the credentials :
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
Jenkins.instance,
null,
@jebeaudet
jebeaudet / gist:25bddb4e36653cbba3f0c83b34eff414
Last active February 1, 2019 20:29
Dump java docker heap
# install openjdk in the container
docker exec -it --user=root container_name sh
apk add openjdk8
docker exec -it <container_name> jmap -dump:format=b,file=/tmp/cheap.bin 1
# Also works
docker exec <container_name> jcmd 1 GC.heap_dump /tmp/docker.hprof
@jebeaudet
jebeaudet / gist:15b874372d8d7b70be9a8a4ce7fd3a98
Created October 31, 2017 18:49
How to trace live requests coming to a server using ngrep
ngrep -l -q -d eth0 -W byline -i "^GET|^POST|^HEAD|^DELETE|^PUT" tcp