Skip to content

Instantly share code, notes, and snippets.

View arnaudgeiser's full-sized avatar

Arnaud Geiser arnaudgeiser

View GitHub Profile
❯ python3
INFO:kafka.consumer.subscription_state:Updating subscribed topics to: ('demo-topic2',)
Start consuming
INFO:kafka.conn:<BrokerConnection node_id=bootstrap-0 <connecting> [IPv4 ('', 21701)]>: connecting to [('', 21701) IPv4]
INFO:kafka.conn:<BrokerConnection node_id=bootstrap-0 <handshake> [IPv4 ('', 21701)]>: Loading SSL CA from /home/arnaudgeiser/ca.pem
INFO:kafka.conn:<BrokerConnection node_id=bootstrap-0 <handshake> [IPv4 ('', 21701)]>: Loading SSL Cert from /home/arnaudgeiser/test-kafka_cert.pem
INFO:kafka.conn:<BrokerConnection node_id=bootstrap-0 <handshake> [IPv
❯ mvn test
[INFO] Scanning for projects...
[WARNING] Some problems were encountered while building the effective model for ch.hearc:projet-cafheg-mykeli:war:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for org.junit.jupiter:junit-jupiter:jar is either LATEST or RELEASE (both of them are being deprecated) @ org.example:workshop-fp:1.0-SNAPSHOT, /home/arnaudgeiser/temp/pom.xml, line 25, column 16
[WARNING] 'parent.relativePath' of POM ch.hearc:projet-cafheg-mykeli:1.0-SNAPSHOT (/home/arnaudgeiser/temp/projet-cafheg-mykeli/pom.xml) points at org.example:workshop-fp instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 15, column 13
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
Compiling 5 source files to /home/arnaudgeiser/code/aleph/target/classes
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning
Reflection warning, /tmp/form-init974355719809278585.clj:1:9585 - reference to field deleteOnExit can't be resolved.
nREPL server started on port 45361 on host localhost - nrepl://localhost:45361
;; Connected to nREPL server - nrepl://localhost:45361
;; CIDER 1.3.0 (Ukraine), nREPL 0.9.0
;; Clojure 1.11.0, Java
;; Docs: (doc function-name)
;; (find-doc part-of-name)
(require '[next.jdbc :as jdbc])
(import '[org.dbunit.database DatabaseConnection QueryDataSet])
(import '[org.dbunit.dataset.xml FlatXmlDataSet])
(let [db-conn (DatabaseConnection. (jdbc/get-connection db-spec))
dataset (QueryDataSet. db-conn)]
(.addTable dataset "RESTAURANTS" "SELECT * FROM Restaurants")
(.addTable dataset "LIKES" "SELECT * FROM Likes WHERE FK_REST IN (SELECT NUMERO FROM Restaurants)")
(.addTable dataset "COMMENTAIRES" "SELECT * FROM Commentaires WHERE FK_REST IN (SELECT NUMERO FROM Restaurants)")
(.addTable dataset "NOTES" "SELECT * FROM Notes WHERE fk_comm IN (SELECT NUMERO FROM Commentaires WHERE FK_REST IN (SELECT NUMERO FROM Restaurants))")
arnaudgeiser / export.clj
Last active March 13, 2023 17:41
(require '[ :as io])
(require '[ :as xml])
(require '[next.jdbc.sql :as sql])
(require '[next.jdbc.result-set :as rs])
(def db-spec
"Database connection"
{:dbtype "oracle:thin"
:host "localhost"
:user "system"
arnaudgeiser / sse.clj
Last active January 27, 2023 22:44
Server Sent Events
(defn- streaming-handler
(let [body (s/stream)]
(dotimes [i 10]
(s/put! body (format "data: %s \n\n" i))
(Thread/sleep 200))
(s/close! body))
{:status 200
:headers {"Content-Type" "text/event-stream"}
❯ curl -v -s -H "Cookie: session=<REDACTED> 2>&1 | head -100
* Trying
* Connected to ( port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
arnaudgeiser / gist:fba6d60a3daf37f162462d3449fcdc9a
Last active April 27, 2022 12:26
Aleph vs Donkey vs Reitit
## Aleph
"fortune": {},
"plaintext": {
"aleph": [
"latencyAvg": "9.26ms",
"latencyMax": "83.60ms",
"latencyStdev": "7.71ms",
"totalRequests": 5288692,
arnaudgeiser /
Created April 11, 2022 12:06
Maps and classes
class Etudiant {
public final String nom;
public final String prenom;
public final double note1;
public final double note2;
public final double note3;
public Etudiant(String nom, String prenom, double note1, double note2, double note3) {
this.nom = nom;
this.prenom = prenom;
public class OrderService {
private final EmailService emailService;
public OrderService(EmailService emailService) {
this.emailService = emailService;
public void createOrder(Order order) {
// ...