Skip to content

Instantly share code, notes, and snippets.

View maxp's full-sized avatar

Maxim Penzin maxp

View GitHub Profile

Recommendations

Repository

В репозитории содержится программный код, ресурсные файлы, сопутствующая документация и другие файлы, необходимые для разработки/сборки/тестирования приложения.

README.md

Основные секции:

@maxp
maxp / gitignore
Last active April 21, 2023 01:44
generic gitignore
#
# generic .gitignore
#
## no hiddens in scm
.*
## editor backups
*~
*.bak
(def translit-table-ru-en
(apply array-map [\a "a"
\b "b"
\c "c"
\d "d"
\e "e"
\f "f"
\g "g"
\h "h"
\i "i"
@maxp
maxp / grouped-dec.clj
Created February 8, 2022 18:12
grouped decimal number formatter
(defn grouped-dec [decimal-number]
;; NOTE: handle sign separately
(when decimal-number
(let [s (str decimal-number)
[deci fract] (str/split s #"\.")
grouped
(->> deci
(reverse)
(partition 3 3 nil)
(map #(apply str %))
@maxp
maxp / remove-nils.clj
Last active March 10, 2021 00:59
remove nil values from map
(let [data {:a :b :c nil :d 1}]
(->> data
(remove (comp nil? second))
(into {})))
;; {:a :b, :d 1}
-- postgresql 13 default
-- ubuntu, core i5, ssd
create table t1 (i bigint, c varchar(20), t text);
create table t2 (i bigint, c varchar(20), t text);
insert into t1 (i,c,t)
select random() * 1000000, '', '12345678912345678912345678900'
from generate_series(0,1000000);
@maxp
maxp / bmk.core.clj
Created August 23, 2020 07:09
babashka maker library
(ns bmk.core
(:import
[java.time ZonedDateTime]
[java.time.format DateTimeFormatter])
(:require
[clojure.string :refer [split]]
[clojure.java.shell :refer [sh]]))
;=
@maxp
maxp / bmk.clj
Created August 23, 2020 07:07
babashka based maker
#!/usr/bin/env bb
(require 'babashka.classpath)
(babashka.classpath/add-classpath "./tools")
(ns bmk.main
(:require
[bmk.core :refer [print-lines cmd sh-c]]))
;=
@maxp
maxp / clojure-16068307781756836851.edn
Created July 24, 2020 04:01
antq: slf4j-simple crash
{:clojure.main/message
"Execution error (ClassCastException) at unilog.config/start-logging! (config.clj:354).\nclass org.slf4j.impl.SimpleLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.impl.SimpleLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')\n",
:clojure.main/triage
{:clojure.error/class java.lang.ClassCastException,
:clojure.error/line 354,
:clojure.error/cause
"class org.slf4j.impl.SimpleLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.impl.SimpleLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')",
:clojure.error/symbol unilog.config/start-logging!,
:clojure.error/source "config.clj",
:clojure.error/phase :execution},
@maxp
maxp / build.clj
Created May 10, 2019 03:11
cljs node repl
(ns build
(:require [cljs.build.api :as b]))
(b/build "src"
{:output-to "main.js"
:output-dir "target"
:optimizations :simple
:target :nodejs
:main 'your-project.core})