Skip to content

Instantly share code, notes, and snippets.

View kwrooijen's full-sized avatar

Kevin van Rooijen kwrooijen

View GitHub Profile
@kwrooijen
kwrooijen / index.js
Created March 25, 2022 13:33
Elrond serialization
// Import from erdjs SDK
import { AbiRegistry, BinaryCodec } from "@elrondnetwork/erdjs";
// Our base64 response buffer that was queries
let buffer = Buffer.from("AAAACFNvbWUgaGF0AAAAClNvbWUgc2hpcnQAACMp", "base64");
// Load the main.abi.json into our program
let registry = await AbiRegistry.load({ files: ["main.abi.json"] });
// Get MyNFT struct from the registry
@kwrooijen
kwrooijen / elrond_nft.sh
Last active December 13, 2021 13:41
A script for creating NFTs on the Elrond Network
#!/bin/bash
# Deriving PEM file
#
erdpy --verbose wallet derive wallet.pem --mnemonic
# Elrond Network Variables
CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"
@kwrooijen
kwrooijen / Render-com-Clojure.Dockerfile
Last active August 19, 2020 20:45
A Dockerfile meant for deploying a Clojure Uberjar to Render.com
FROM clojure:openjdk-8-lein-slim-buster AS build-jar
# Install any dependencies e.g. NPM for Clojurescript
# RUN apt update && apt install npm -y
WORKDIR /usr/src
COPY . .
# Build the uberjar. If you need to prepare certain things for your release
# (e.g. build your Clojurescript with Shadow-cljs) you can add a `:prep-tasks`
# key to the `:uberjar` profile in your `project.clj`. `lein-shell` can also be
# used to execute shell commands such as `npm`.
(defmulti exception->map
(fn [^SQLException e]
(.getSQLState e)))
(defn- remove-quotes [s]
(clojure.string/replace s #"\"" ""))
(defn sql-key->keyword [sql-key]
(-> sql-key
(string/replace #"_key$" "")
(deftype YggdrasilAtom [name state]
clojure.lang.IAtom
(reset [this f] (reset! (.-state this) f))
(swap [this a] (swap! (.-state this) a))
(swap [this a b] (swap! (.-state this) a b))
(swap [this a b c] (swap! (.-state this) a b c))
(swap [this a b c d] (swap! (.-state this) a b c d))
(compareAndSet [this a b] (compare-and-set! (.-state this) a b))
(toString [this] (str (.-name this)))
(ns dnd.core
(:require
[reagent.core :as r]
[reagent.dom :as d]))
(def default-persons
[{:person/name "Kevin"
:person/age 29
:person/active? true}
{:person/name "Foo"
(defrecord RefWith [key opts]
ig/RefLike
(ref-key [_] key)
(ref-resolve [_ config resolvef]
(let [[k _] (first (ig/find-derived config key))
config (update config k #(merge % opts))
v (get (ig/init config [k]) k)]
(resolvef k v))))
(defn ref-with [key opts]

Keybase proof

I hereby claim:

  • I am kwrooijen on github.
  • I am kwrooijen (https://keybase.io/kwrooijen) on keybase.
  • I have a public key ASD8wtzccqWjVgW2_O3-nJf4d6kPTyHnufxZ4kRYZ1f_pAo

To claim this, I am signing this object:

(require 'package)
(require 'ert)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
@kwrooijen
kwrooijen / threading.scm
Last active April 1, 2023 00:52
Clojure's threading macro in scheme
(define-syntax ->
(syntax-rules ()
([_ value]
value)
([_ value snd rest ...]
(cond
[(list? 'snd)
(let ([f (primitive-eval (car 'snd))]
[args (cons value (cdr 'snd))])
(-> (apply f args) rest ...))]