Skip to content

Instantly share code, notes, and snippets.

View kirillsalykin's full-sized avatar

Kirill Salykin kirillsalykin

  • Netherlands, Utrecht
View GitHub Profile
@kirillsalykin
kirillsalykin / graph.clj
Created February 19, 2024 16:04 — forked from xfthhxk/graph.clj
DFS & BFS in clojure
(ns graph)
(def graph
{:A {:children #{:E :B}
:population 200
:id :A}
:B {:children #{:A :C :E}
:population 300
:id :B}
:C {:children #{:B :D}
@kirillsalykin
kirillsalykin / PDFTableStripper.java
Created October 31, 2023 13:55 — forked from beldaz/PDFTableStripper.java
Class to extract tabular PDF text using PDFBox
/*
* Copyright 2017 Beldaz (https://github.com/beldaz)
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@kirillsalykin
kirillsalykin / nerd_fonts.sh
Created February 17, 2023 21:38 — forked from davidteren/nerd_fonts.md
Install Nerd Fonts via Homebrew [updated & fixed]
# Nerd Fonts for your IDE
# https://www.nerdfonts.com/font-downloads
brew tap homebrew/cask-fonts && brew install --cask font-3270-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-fira-mono-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-go-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-lgc-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-monofur-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-overpass-nerd-font
@kirillsalykin
kirillsalykin / build.sbt
Created November 23, 2022 14:21 — forked from azolotko/build.sbt
Generating a scratch-based container image with a GraalVM static native-image binary (via sbt-native-packager's GraalVMNativeImagePlugin and DockerPlugin)
enablePlugins(
GraalVMNativeImagePlugin,
DockerPlugin
)
GraalVMNativeImage / containerBuildImage := Some("ghcr.io/graalvm/native-image")
GraalVMNativeImage / graalVMNativeImageOptions += "--static"
GraalVMNativeImage / packageBin := (GraalVMNativeImage / packageBin).map { f =>
/Users/kirill/playground/zio-quickstart-graphql-webservice/src/main/scala/dev/zio/quickstart/ExampleApi.scala:45:6
Cannot find a Schema for type dev.zio.quickstart.ExampleData.CharactersArgs =>
zio².URIO[dev.zio.quickstart.ExampleService.ExampleService,
List[dev.zio.quickstart.ExampleData.Character]
]
where: zio is a package in package dev
zio² is a package
.
@kirillsalykin
kirillsalykin / README.md
Created January 10, 2022 13:18 — forked from ryu1kn/README.md
Getting GCP access token from a service account key JSON file

Getting GCP access token from a service account key

Use your service account's key JSON file to get an access token to call Google APIs.

Good for seeing how things work, including the creation of JWT token.

To create a JWT token, you can replace create-jwt-token.sh script with tools like step.

If you just want to get an access token for a service account,

SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
-- WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
--
SELECT pg_terminate_backend(__pid__);
@kirillsalykin
kirillsalykin / lint.clj
Created November 5, 2021 10:59 — forked from borkdude/lint.clj
Code Quality report for Clojure projects in Gitlab using babashka and clj-kondo.
#!/usr/bin/env bb
(ns script
"Make a 'Code Quality' report from clj-kondo for use in GitLab CI.
JSON issue format:
https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
Usage:
Add the following job in .gitlab-ci.yml:
@kirillsalykin
kirillsalykin / A.synopsis.md
Created September 20, 2021 14:22 — forked from rauhs/A.synopsis.md
Configure logback at runtime without XML but using hiccup

Synopsis

So logback uses a configuration framework called Joran. Upon JVM startup it loads the logback.xml file and shoves the XML into the Joran configurator. (See: https://logback.qos.ch/manual/onJoran.html )

This gist does nothing else but:

  1. Take the hiccup, which uses the exact same nodes/attributes as the XML file
  2. Generate XML from it
  3. Shove the entire thing into Joran.
@kirillsalykin
kirillsalykin / sorting-transducer.clj
Created December 25, 2020 21:12 — forked from matthewdowney/sorting-transducer.clj
Clojure Sorting Transducer
(defn xf-sort
"A sorting transducer. Mostly a syntactic improvement to allow composition of
sorting with the standard transducers, but also provides a slight performance
increase over transducing, sorting, and then continuing to transduce."
([]
(xf-sort compare))
([cmp]
(fn [rf]
(let [temp-list (java.util.ArrayList.)]
(fn