Skip to content

Instantly share code, notes, and snippets.

View dainiusjocas's full-sized avatar
:octocat:
editing status

Dainius Jocas dainiusjocas

:octocat:
editing status
View GitHub Profile
@michael-simons
michael-simons / Movie.java
Created October 25, 2023 08:00
An example how to run integration tests as GraalVM native image.
package demo;
import java.util.Map;
import java.util.stream.Collectors;
import org.neo4j.driver.Driver;
public record Movie(String id, String title) {
public static final class Repository {
First of all I am not very familiar with Elasticsearch settings,
but fairly familiar with what stock Lucene does.
I haven't any experience of NRTDirectory...
Lucene simply writes immutable segments files.
The NRTDirectory does not sync, in order to minimize the cost of commit.
The OS will eventually flush these pages to disk.
On the read side, the file is mapped into memory.
On first access, the OS will experience a page fault.
@ertugrulcetin
ertugrulcetin / repo-search.clj
Last active March 15, 2021 08:28
GitHub Clojure code search with unified repository results - Clojure, Babashka
#!/usr/bin/env bb
(require '[babashka.curl :as curl])
(require '[clojure.java.io :as io])
(require '[cheshire.core :as json])
(defn- call [q page]
(-> (curl/get "https://api.github.com/search/code"
{:headers {"Accept" "application/vnd.github.previe"}
:query-params {"q" (str q " language:Clojure")
@borkdude
borkdude / api_diff_bb.clj
Created January 8, 2021 10:13
Print API breakage warnings
#!/usr/bin/env bb
;; Example usage:
;; api_diff_bb.clj org.clojure/clojure "1.9.0" "1.10.1"
;; Output:
;; clojure/core_deftype.clj:587:1: warning: Arity 4 of clojure.core/emit-method-builder was removed.
;; clojure/core/reducers.clj:24:1: warning: clojure.core.reducers/compile-if was removed.
(require '[babashka.pods :as pods])
@jackrusher
jackrusher / AAA-README.md
Created October 16, 2020 12:02
Clojure + FUSE

Meld

A minimal example of creating a (mostly) working FUSE filesystem using Clojure. NOTE: I have only tested this with OSX, and it assumes you have already installed libfuse.

Trying it out

Create an empty directory at /tmp/meld to serve as your mount point, put these files in a directory called meld, then:

@dainiusjocas
dainiusjocas / kafka_delete_topics.sh
Created May 4, 2020 09:10
Delete kafka topics by pattern
./bin/kafka-topics.sh --zookeeper localhost:2181 --list | grep my_pattern | while read topic; do ./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic $topic; done
@vvvvalvalval
vvvvalvalval / gist:c6c2d991bdc96cce4c14
Last active February 11, 2024 19:34
Asynchronous map function with clojure.core.async
(require '[clojure.core.async :as a])
(defn- seq-of-chan "Creates a lazy seq from a core.async channel." [c]
(lazy-seq
(let [fst (a/<!! c)]
(if (nil? fst) nil (cons fst (seq-of-chan c)) ))))
(defn map-pipeline-async "Map for asynchronous functions, backed by clojure.core.async/pipeline-async .
From an asynchronous function af, and a seq coll, creates a lazy seq that is the result of applying the asynchronous function af to each element of coll.