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
@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 / 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 / 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()">
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 / 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;
@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
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
mvn compile -Dsisu.debug
TRACE: Sisu - Add publisher: com.google.inject.internal.InjectorImpl@4a11eb84
-----[explicit bindings]-------------------------------------------------------
0. InstanceBinding{key=Key[type=com.google.inject.Stage, annotation=[none]], source=[unknown source], instance=DEVELOPMENT}
1. ProviderInstanceBinding{key=Key[type=com.google.inject.Injector, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Injector>}
2. ProviderInstanceBinding{key=Key[type=java.util.logging.Logger, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Logger>}
3. InstanceBinding{key=Key[type=org.codehaus.plexus.context.Context, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:831), instance={plexus=org.codehaus.plexus.DefaultPlexusContainer@7c1e2a2d}}
4. InstanceBinding{key=Key[type=org.eclipse.sisu.inject.MutableBeanLocator, annotation=[none]], source=org.codehaus.plex
tree $MAVEN_HOME
/usr/share/maven
├── LICENSE
├── NOTICE
├── README.txt
├── bin
│   ├── m2.conf
│   ├── mvn
│   ├── mvn.cmd
│   ├── mvnDebug
cat /usr/share/maven/bin/m2.conf
main is org.apache.maven.cli.MavenCli from plexus.core
set maven.conf default ${maven.home}/conf
[plexus.core]
load ${maven.conf}/logging
load ${maven.home}/lib/ext/redisson/*.jar
optionally ${maven.home}/lib/ext/*.jar
load ${maven.home}/lib/*.jar