Skip to content

Instantly share code, notes, and snippets.

@mikeananev
mikeananev / symantec-error-codes.adoc
Last active July 22, 2022 10:09
Семантические коды ошибок

Семантические коды ошибок

@mikeananev
mikeananev / update_task_data_from_jira.clj
Last active July 20, 2022 13:25
Update Gantt EDN files by data from Jira
(ns update-task-data-from-jira
"Update task data in Gantt EDN-files by Jira data"
(:require [babashka.curl :as curl]
[babashka.fs :as fs]
[cheshire.core :as json]
[clojure.string :as string]
[rewrite-clj.zip :as z])
(:import (java.net URLEncoder)))
(def login (-> (System/getenv) (get "LOGNAME")))
@mikeananev
mikeananev / calc_days_between_two_dates.clj
Created July 19, 2022 19:11
Calculate difference in days between two dates.
(defn diff-between-days
"Calculate difference in days between two dates."
[date1 date2]
(let [df (DateTimeFormatter/ofPattern "yyyy-MM-dd'T'HH:mm:ss.SSSxxxx" Locale/ROOT)
d1 (if (string? date1) (ZonedDateTime/parse date1 df) date1)
d2 (if (string? date2) (ZonedDateTime/parse date2 df) date2)]
(.between ChronoUnit/DAYS d1 d2)))
@mikeananev
mikeananev / abc.svg
Created July 10, 2022 22:43
presentation template
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikeananev
mikeananev / jira-curl-example.txt
Created June 26, 2022 19:24
Jira basic auth with curl
curl -v -u username https://jira.mycompany.com/browse/PMR-50
curl -v -u username:password https://jira.mycompany.com/browse/PMR-50
echo -n username:password | base64
dXNlcm5hbWU6cGFzc3dvcmQ=
curl -D- -X GET -H "Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ==" -H "Content-Type: application/json" "https://jira.mycompany.com/browse/PMR-50
@mikeananev
mikeananev / command.txt
Last active June 26, 2022 17:11
Asciidoc Reveal.js presentation example
asciidoctor-revealjs ml-team.adoc
decktape -s 1900x1187 --slides 1-500 reveal "file:///Users/user/projects/ml-team.html?fragments=true" slides.pdf
@mikeananev
mikeananev / update_current_day_in_gantt.clj
Last active June 26, 2022 17:05
Babashka script for updating current day in Gantt EDN-files
(ns update-current-day-in-gantt
"Script for updating current day in Gantt EDN-files"
(:require [babashka.fs :as fs]
[rewrite-clj.node :as node]
[rewrite-clj.parser :as parser]
[rewrite-clj.zip :as z])
(:import (java.time LocalDate)
(java.time.temporal ChronoUnit)))
(defn diff-between-days
@mikeananev
mikeananev / virtual_threads.clj
Last active October 15, 2023 01:23
Java 19 virtual threads and Clojure
(ns user
(:import (java.util.concurrent Executors)))
;; Thread factory for virtual threads
(defn thread-factory [name]
(-> (Thread/ofVirtual)
(.name name 0)
(.factory)))
;; Define an executor which just produce a new virtual thread for every task
@mikeananev
mikeananev / swim.clj
Created March 30, 2022 09:00
test cli-extras
(ns org.rssys.swim
(:import (java.net DatagramPacket DatagramSocket SocketTimeoutException InetSocketAddress InetAddress)))
(def host "127.0.0.1")
(def port 5200)
(def socket (DatagramSocket. ^long port))
(def running (atom true))
(def buffer (make-array Byte/TYPE 1024))
{
:scale "900*1200" ;; размер картинки
:project-title "Бэклог на эпик или проект" ;; Название эпика или проекта
:project-header "План на 15-02-2022" ;; Дата обновления плана
:project-scale-zoom {:scale :daily :zoom 1}
:tasks-colors {:color/in-progress "GreenYellow/Red" ;; цвета задач
:color/completed "GreenYellow/Green"}