Skip to content

Instantly share code, notes, and snippets.

View brdloush's full-sized avatar

Tomáš Brejla brdloush

  • Česká republika
View GitHub Profile
@brdloush
brdloush / idos.clj
Created July 27, 2022 09:26
mobile IDOS.cz route search script for clojure
(ns idos
(:require [clojure.string :as str]
[hickory.select :as s]
[hickory.core :as h]
[org.httpkit.client :as http]
[clojure.tools.logging :refer [debug]])
(:import [javax.net.ssl SSLEngine SSLParameters SNIHostName]
[java.net URI URLEncoder]))
(defn sni-configure
@brdloush
brdloush / translate.clj
Last active March 22, 2022 11:25
babashka script for translating from english to multiple languages
#!/usr/bin/env bb
(ns translate
(:require [clojure.java.shell :refer [sh]]
[clojure.string :as str]))
(def langs ["en" "cs" "de" "it" "ro" "hu" "ru"])
(defn translate [s langs]
(let [langs-arg (str ":" (str/join "+" langs))
@brdloush
brdloush / triggerJmx.clj
Last active November 30, 2021 22:32
Clojure CLI utility for simple execution of operations via JMX of local java process
#!/bin/sh
#_(
DEPS='
{:deps {org.clojure/java.jmx {:mvn/version,"1.0.0"}}}
'
exec clojure $OPTS -Sdeps "$DEPS" -M "$0" "$@"
)
(ns user
(:require [clojure.java.jmx :as jmx]
@brdloush
brdloush / simplify_junit_json_testreport.clj
Last active August 30, 2021 20:37
Babashka script for turning JSON test report into a CSV file containing 100 slowest tests and their basic stats
;; babashka script for turning JSON test report into a simple CSV file containing 100 slowest tests
;; and their basic stats (duration, number of methods, avg per-method duration).
;;
;; (JSON report can typically be downloaded by appending `/api/json` to the testReport page URL, for example:
;; `https://jenkins.somecompany.io/job/SOME-PROJECT-build/job/master/4892/testReport/api/json`
;;
;; Usage:
;;
;; 1) download the json file
;; 2) execute `bb simplify_junit_json_testreport.clj input.json output.csv`
@brdloush
brdloush / triggerJob.clj
Last active June 22, 2021 10:00
Standalone CLI utility that triggers a quartz job via QuartzScheduler JMX Bean. Requires clojure + JDK (openjdk 8,11,15 were succesfully tested).
#!/bin/sh
#_(
DEPS='
{:deps {org.clojure/java.jmx {:mvn/version,"1.0.0"}}}
'
exec clojure $OPTS -Sdeps "$DEPS" -M "$0" "$@"
)
(ns jmx.core
(:require [clojure.java.jmx :as jmx]
@brdloush
brdloush / gist:38c615732acfb5828b51
Created November 4, 2015 16:49
performance difference between thymeleaf 3.0.0.BETA01 vs 3.0.0-SNAPSHOT
git clone [email protected]:brdloush/thymeleaf-perf-issue.git
1) 3.0.0-BETA01:
mvn -Dthymeleaf=3.0.0.BETA01 clean test
-------------------------------------------------------
T E S T S
-------------------------------------------------------
@brdloush
brdloush / gist:cf9824ba2e2bf5c0f31a
Created April 18, 2015 18:20
winterbe/spring-react-example modified to work in multithreaded environment
package com.winterbe.react;
import jdk.nashorn.api.scripting.NashornScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List;