Skip to content

Instantly share code, notes, and snippets.

💓
Loving Clojure

Jakub Holy holyjak

💓
Loving Clojure
Block or report user

Report or block holyjak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@holyjak
holyjak / X Fulcro mystery 2.md
Last active Feb 10, 2020
Fulcro mystery 2 - why isn't the initial state normalized in the DB?
View X Fulcro mystery 2.md

Solution

L14 is wrong, it should have been wrapped in {..} and thus a join: :query [{:people [(comp/get-query Person)]}]

@holyjak
holyjak / X Fulcro Mystery 1.md
Last active Feb 10, 2020
Fulcro mystery - why is initial state not normalized in the DB?
View X Fulcro Mystery 1.md

Solution

There are 2 problems:

  1. L14 should have been {:query [:people (comp/get-query Person)]
  2. L15 mixes the template and lambda forms; it should have been either
:initial-state (fn [_] {:people [(comp/get-initial-state Person {:id 0 :name "Sally" :city "Nowhere" :state "GA"})
                                 (comp/get-initial-state Person {:id 1 :name "Tom" :city "There" :state "OH"})]}
@holyjak
holyjak / s3_multipart_upload.py
Last active Jan 6, 2020 — forked from teasherm/s3_multipart_upload.py
boto3 S3 Multipart Upload with the ability to resume the upload after a failure
View s3_multipart_upload.py
#!/usr/bin/env python3
# See https://gist.github.com/teasherm/bb73f21ed2f3b46bc1c2ca48ec2c1cf5
import argparse
import os
import boto3
class S3MultipartUpload(object):
# AWS throws EntityTooSmall error for parts smaller than 5 MB
View klipse-issue.html
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-97603551-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
@holyjak
holyjak / clojure-5269077379395073972.edn
Created Dec 11, 2019
nrepl over drawbridge client error
View clojure-5269077379395073972.edn
{:clojure.main/message "Execution error (ClassCastException) at clj-http.client/parse-url (client.clj:175).\nclass java.net.Socket cannot be cast to class java.lang.String (java.net.Socket and java.lang.String are in module java.base of loader 'bootstrap')\n",
:clojure.main/triage {:clojure.error/class java.lang.ClassCastException,
:clojure.error/line 175,
:clojure.error/cause "class java.net.Socket cannot be cast to class java.lang.String (java.net.Socket and java.lang.String are in module java.base of loader 'bootstrap')",
:clojure.error/symbol clj-http.client/parse-url,
:clojure.error/source "client.clj",
:clojure.error/phase :execution},
:clojure.main/trace {:via [{:type java.lang.ClassCastException, :message "class java.net.Socket cannot be cast to class java.lang.String (java.net.Socket and java.lang.String are in module java.base of loader 'bootstrap')",
@holyjak
holyjak / blog.scss
Created Dec 10, 2019
Cryogen customization: autolink headings etc.
View blog.scss
#post a.anchor, #custom-page a.anchor {
float: left;
padding-right: 4px;
margin-left: -20px;
}
@holyjak
holyjak / clojure.spec.alpha.clj
Last active Oct 2, 2019
Override clojure.spec.alpha/gensub for friendly exceptions for failed such-that - see https://clojure.atlassian.net/browse/CLJ-2097
View clojure.spec.alpha.clj
;; Normally the exception thrown by such-that does not point to the failed spec, which makes it useless
;; Eval this to override it and include `path` to the spec (and `form`, not sure which better)
(in-ns 'clojure.spec.alpha)
(defn- gensub
[spec overrides path rmap form]
;;(prn {:spec spec :over overrides :path path :form form})
(let [spec (specize spec)]
(if-let [g (c/or (when-let [gfn (c/or (get overrides (c/or (spec-name spec) spec))
(get overrides path))]
(gfn))
@holyjak
holyjak / CloudWatchMetricsExportAutoConfiguration4SpringBoot1_5.groovy
Created Sep 13, 2019
CloudWatchMetricsExportAutoConfiguration for Spring Boot 1.5 (not supported out of the box)
View CloudWatchMetricsExportAutoConfiguration4SpringBoot1_5.groovy
package myapp.spring.micrometer.cloudwatch;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsync;
import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient;
import io.micrometer.cloudwatch.CloudWatchConfig;
import io.micrometer.cloudwatch.CloudWatchMeterRegistry;
import io.micrometer.core.instrument.Clock;
import io.micrometer.spring.autoconfigure.CompositeMeterRegistryAutoConfiguration;
import io.micrometer.spring.autoconfigure.MetricsAutoConfiguration;
@holyjak
holyjak / Beginner-friendly Clojure.md
Last active May 10, 2019
Beginner-friendly Clojure
View Beginner-friendly Clojure.md

Setup optimized for beginner friendliness.

BEWARE: Too many extra libraries can eventually cause problems of their own, with dependency conflicts etc.

Editor with REPL integration

...

  • Use Parinfer
@holyjak
holyjak / Issue-AWS_EKS_No_avail_zone.md
Last active May 2, 2019
Kubernetes resources on AWS EKS having the "no available volume zone" problem
View Issue-AWS_EKS_No_avail_zone.md

Resources for https://stackoverflow.com/questions/54439356/node-has-no-available-volume-zone-in-aws-eks

The eks-pod-no-avail-volume-zone.yml file is nearly the same as the one we use in prod, only difference is hostname and "prod" / "stage" so this file is most likely not the source of the problem.

The storage is defined and AWS console shows I do have a gp2 volume attached to each worker node.

One difference between stage (broken) and prod (working): the former runs Kubernetes 1.11, the latter 1.10.

Cause & Solution

You can’t perform that action at this time.