Skip to content

Instantly share code, notes, and snippets.

View mishok13's full-sized avatar

Andrii Mishkovskyi mishok13

View GitHub Profile
@mishok13
mishok13 / a-do-a-run-run-a-do-a-run.md
Created June 16, 2023 09:01 — forked from thaJeztah/a-do-a-run-run-a-do-a-run.md
Silly experiments with `RUN --mount`

Silly experiments with RUN --mount

relates to moby/moby#32507, moby/buildkit#442

Doing some silly experimenting with RUN --mount:

# syntax = docker/dockerfile:experimental

FROM alpine AS stage1
(set-env!
:source-paths #{"src"}
:dependencies
'[[yada "1.1.39" :exclusions [aleph manifold ring-swagger prismatic/schema]]
[aleph "0.4.2-alpha8"]
[manifold "0.1.6-alpha3"]
[metosin/ring-swagger "0.22.12"]
[prismatic/schema "1.1.3"]])
(task-options!
@mishok13
mishok13 / keybase.md
Created July 30, 2016 16:34
keybase.md

Keybase proof

I hereby claim:

  • I am mishok13 on github.
  • I am mishok13 (https://keybase.io/mishok13) on keybase.
  • I have a public key whose fingerprint is 3E65 4C10 1D2E 6AC0 E0D7 8FC5 9EFF 9E0D 2EF2 EC21

To claim this, I am signing this object:

@mishok13
mishok13 / steps.clj
Created July 30, 2015 11:52
Steps in
(defn from-to
"For two integers create a sequence [a, a+x, ..., b, b) where x may be 1 or -1"
[a b]
(let [step (if (pos? (- a b)) -1 1)]
(concat (range a b step) (repeat b))))
(defn from-to-seq
[x y]
(let [max-distance (->> (map - x y) (map #(Math/abs %)) (apply max))]
(->> (map from-to x y)
@mishok13
mishok13 / gist:8952f03ca99a67247896
Created December 11, 2014 13:55
Google is happy to make sure you spend an hour figuring out why your base64 encoding is not working correctly
;; From their doc at https://developers.google.com/accounts/docs/OAuth2ServiceAccount#authorizingrequests
;; You have to base64 a few parts of the request, including a so called "claim set"
;; This is what they claim to encode:
(def expected-claim "{\"iss\":\"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com\",\"scope\":\"https://www.googleapis.com/auth/prediction\",\"aud\":\"https://www.googleapis.com/oauth2/v3/token\",\"exp\":1328554385,\"iat\":1328550785}")
;; And this is what they put as "base64" encoded string:
(def expected-encoded "eyJpc3MiOiI3NjEzMjY3OTgwNjktcjVtbGpsbG4xcmQ0bHJiaGc3NWVmZ2lncDM2bTc4ajVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJzY29wZSI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL2F1dGgvcHJlZGljdGlvbiIsImF1ZCI6Imh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbS9vL29hdXRoMi90b2tlbiIsImV4cCI6MTMyODU1NDM4NSwiaWF0IjoxMzI4NTUwNzg1fQ")
;; Well, decode it and you get
(println (base64/decode expected-encoded))
;; "{\"iss\":\"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gservi
@mishok13
mishok13 / gist:d66156a6bf45f83c7247
Last active August 29, 2015 14:09
Banging my head, how to make this macro behave the same way regardless of what is passed?
user> (require '[plumbing.core :refer [fnk]])
nil
user> (defmacro fnk-creator
[args]
`(fnk [~@(map symbol (:params args))] [~@(map symbol (:params args))]))
#'user/fnk-creator
user> (def x {:params ["foo"]})
#'user/x
user> (macroexpand-1 '(fnk-creator x))
(plumbing.core/fnk [] [])
package io.screen6.cascading.redis;
import java.io.IOException;
import cascading.flow.FlowProcess;
import cascading.scheme.Scheme;
import cascading.scheme.SinkCall;
import cascading.scheme.SourceCall;
import cascading.tap.Tap;
import cascading.tuple.Fields;
import cascading.tuple.TupleEntry;
Exception in thread "main" java.lang.StackOverflowError
at com.esotericsoftware.kryo.Kryo.getRegistration(Kryo.java:429)
at com.esotericsoftware.kryo.util.DefaultClassResolver.writeClass(DefaultClassResolver.java:79)
at com.esotericsoftware.kryo.Kryo.writeClass(Kryo.java:472)
at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:565)
at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:86)
at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:17)
at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:501)
at com.esotericsoftware.kryo.serializers.FieldSerializer$ObjectField.write(FieldSerializer.java:564)
at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:213)
@mishok13
mishok13 / core.clj
Created April 14, 2014 15:14
Simple C3P0 passing to mapfn fails.
(ns weird.core
(:require
[cascalog.api :refer [hfs-textline ?- stdout <- defmapfn]]
[cascalog.cascading.conf :refer [with-serializations *JOB-CONF*]]
[honeysql.helpers :as sql]
[honeysql.core :as sql.eng])
(:import
[com.esotericsoftware.kryo Kryo]
[com.esotericsoftware.kryo.serializers.JavaSerializer]
[com.mchange.v2.c3p0 ComboPooledDataSource])
Exception in thread "main" java.lang.StackOverflowError
at com.esotericsoftware.kryo.util.ObjectMap.get(ObjectMap.java:265)
at com.esotericsoftware.kryo.util.DefaultClassResolver.getRegistration(DefaultClassResolver.java:61)
at com.esotericsoftware.kryo.Kryo.getRegistration(Kryo.java:429)
at com.esotericsoftware.kryo.util.DefaultClassResolver.writeClass(DefaultClassResolver.java:79)
at com.esotericsoftware.kryo.Kryo.writeClass(Kryo.java:472)
at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:565)
at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:86)
at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:17)
at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:501)