Skip to content

Instantly share code, notes, and snippets.

View janherich's full-sized avatar

Jan Herich janherich

View GitHub Profile
@janherich
janherich / printer.cfg
Created February 20, 2021 20:20
QQS-Pro Klipper config
# This file contains a configuration for the "Flsun QQ-S" delta
# printer (using the MKS Robin Mini electronics). To use this config,
# the firmware should be compiled for the STM32F103xE and MKS Robin mini.
# See the example.cfg file for a description of available parameters.
[stepper_a]
step_pin: PE3
dir_pin: PE2
enable_pin: !PE4
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@janherich
janherich / tokens.clj
Last active February 12, 2020 12:47
syslogin
(:require [net.cgrand.enlive-html :as enlive]
[vurderings-api.rest.assertion :as assertion]
[vurderings-api.rest.shared :as shared])
(defn syslogin-assertion->tokens
"Takes XML response from non-interactive ADFS login, returns map with `:access-token`, `:refresh-token` and `:access-token-exp` keys"
[syslogin-response-xml jwt-sign-secret response-ip]
(let [xml-nodes (enlive/xml-resource (java.io.StringReader. syslogin-response-xml))
assertion-str (apply str (enlive/emit* (first (enlive/select xml-nodes [:Assertion]))))
assertion (assertion/parse-saml-assertion (shared/stream->obj assertion-str))]
11-02 08:17:04.363 E/AndroidRuntime( 1832): java.lang.RuntimeException: Unable to instantiate application im.status.ethereum.MainApplication: java.lang.ClassNotFoundException: Didn't find class "im.status.ethereum.MainApplication" on path: DexPathList[[zip file "/data/app/im.status.ethereum.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/im.status.ethereum.debug-1/lib/x86, /data/app/im.status.ethereum.debug-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
11-02 08:17:04.363 E/AndroidRuntime( 1832): at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
11-02 08:17:04.363 E/AndroidRuntime( 1832): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5377)
11-02 08:17:04.363 E/AndroidRuntime( 1832): at android.app.ActivityThread.-wrap2(ActivityThread.java)
11-02 08:17:04.363 E/AndroidRuntime( 1832): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
11-02 08:17:04.363 E/AndroidRuntime( 1832): at android.os.Handler.dispatchMessage(Handler.java:102)
11-02 08
{meta {:name "Collectibles"
:description "Demonstration of collectible command"
:documentation ""}
views/preview
(let [{{{symbol :symbol token :token tx-hash :tx-hash} :params} :content outgoing :outgoing timestamp-str :timestamp-str} @properties]
(let [collectible-token (query [:get-collectible-token symbol token])]
[view {:flex-direction :column
:align-items :flex-start}
[nft-token collectible-token]
@janherich
janherich / functional_proposal.clj
Last active May 30, 2018 12:40
Purely functional proposal
;; Rather then relying on macros, I propose to have `merge-fx` helper exposed as function
;; taking variable number of arguments (where the first one is always cofx, second one could
;; be initial effects map and then variable number of effects producing functions, with the
;; all of them with the same form as now:
(defn effects-fn [arg1 arg2 {:keys [db] :as cofx}]
{:db (update db :some-key arg1)
:http-call ...})
(defn final-effects-fn [cofx]
(merge-fx cofx
@janherich
janherich / current_situation.clj
Last active May 29, 2018 22:40
Current situation
;; All our model functions adhere to simple interface, taking any number of arguments,
;; but always the `:cofx` map as an last argument and producing map of effects (or nothing)
;; as result:
(defn effects-fn [arg1 arg2 {:keys [db] :as cofx}]
{:db (update db :some-key arg1)
:http-call ...})
;; We have both `merge-fx` macro and `merge-effect` functions at our disposal
;; Whenever we do static merging of effects, we use the former:
(defn final-effects-fn [cofx]
@janherich
janherich / example.clj
Last active April 20, 2018 06:23
Extension - events
;; examples of public functions provided by us
(defn add-http-request [{:keys [url method payload]}]
(fn [_]
{:http {:method method
:url url
:payload payload}}))
(defn set-in [{:keys [path value]}]
(fn [_]
{:db (set-in db path value)}))
@janherich
janherich / response.clj
Last active March 21, 2018 10:53
response.clj
[{:id "0f7c65277f916ff4379fe520b875082a56e587eb3ce1c1567d9ff94206bdb05ba167c52272f20f634cd1ebdec5d9dfeb393018bfde1595d8e64a717c8b46692f", :name "Geth/v1.7.3-stable/linux-amd64/go1.9.2", :caps ["eth/62" "eth/63" "les/1" "les/2" "shh/5"], :network {:localAddress "172.20.10.6:51863", :remoteAddress "51.15.54.150:30303"}, :protocols {:shh "unknown"}} {:id "12d52c3796700fb5acff2c7d96df7bbb6d7109b67f3442ee3d99ac1c197016cddb4c3568bbeba05d39145c59c990cd64f76bc9b00d4b13f10095c49507dd4cf9", :name "Geth/v1.7.3-stable/linux-amd64/go1.9.2", :caps ["eth/62" "eth/63" "les/1" "les/2" "shh/5"], :network {:localAddress "172.20.10.6:51860", :remoteAddress "51.15.63.110:30303"}, :protocols {:shh "unknown"}} {:id "482484b9198530ee2e00db89791823244ca41dcd372242e2e1297dd06f6d8dd357603960c5ad9cc8dc15fcdf0e4edd06b7ad7db590e67a0b54f798c26581ebd7", :name "Geth/v1.7.3-stable/linux-amd64/go1.9.2", :caps ["eth/62" "eth/63" "les/1" "les/2" "shh/5"], :network {:localAddress "172.20.10.6:51859", :remoteAddress "51.15.75.138:30303"}, :protoco
@janherich
janherich / event.clj
Created February 19, 2018 14:18
Pure event
(handlers/register-handler-fx
:delete-chat
[re-frame/trim-v]
(fn [cofx [chat-id]]
(-> (chat.models/remove-chat cofx chat-id)
(update :db navigation/replace-view :home))))