This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns merkle.tree | |
(:import [java.security MessageDigest])) | |
(defn sha-256-digest [bs] | |
(.digest | |
(doto (MessageDigest/getInstance "SHA-256") | |
(.update bs)))) | |
(def double-sha-256 (comp sha-256-digest sha-256-digest)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; # Maria for Experts | |
;; This is a short tour of abstractions we've made in the process of building Maria, | |
;; which are also available while using the system. It is meant for people with experience using | |
;; functional programming languages who already know how to evaluate forms in Maria. | |
;; If you're a beginner to Maria or to programming in general, I recommend starting [here](https://www.maria.cloud/intro). | |
;; (For the impatient, Command-Enter — Control-Enter on a PC — within a code block with evaluate the code before the cursor.) | |
;; ## Notebook interface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T ExhaustiveExample<T>(IEnumerable<T> sequence) => | |
sequence switch | |
{ | |
System.Array { Length : 0 } => default(T), | |
System.Array { Length : 1} array => (T)array.GetValue(0), | |
System.Array {Length : 2} array => (T)array.GetValue(1), | |
System.Array array => (T)array.GetValue(2), | |
IEnumerable<T> list | |
when !list.Any() => default(T), | |
IEnumerable<T> list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using the same syntax as for value types | |
string nonNullable = null; // compiler warning | |
string? nullable = null; | |
// here is breaking change in a new version of the language, | |
// the nullable reference types is the only feature of C# 8 that isn’t enabled by default | |
//look: before C# 8 | |
string nullableString; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash | |
# without the /bin/ part | |
docker run -it ubuntu bash | |
# nothing else but bash... | |
docker run -it bash | |
#if image has a defined ENTRYPOINT. For these cases use: | |
docker run -it --entrypoint /bin/bash <image> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; "human" date/time format parsing | |
(def human-time-parser | |
(insta/parser | |
"S = H (':' M)? ' '? P? (' ' Z)? | |
H = #'[1-9]' | #'1[0-2]' | |
M = #'0[0-9]' | #'[1-5][0-9]' | |
P = AM | PM | |
AM = 'A' 'M'? | |
PM = 'P' 'M'? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Github.com ui .currently does not natively supoport search for multiple topic tags as of now. However their api allows you to query multiple tags. Below is a simple example to query github.com with ecs and go topic tags. | |
curl -H "Accept: application/vnd.github.mercy-preview+json" \ | |
https://api.github.com/search/repositories?q=topic:ecs+topic:go | |
Response from the github can be rather verbose so lets filter only relavant info such repo url and description. | |
curl -H "Accept: application/vnd.github.mercy-preview+json" \ | |
https://api.github.com/search/repositories\?q\=topic:ecs+topic:go | jq '.items[] | {url:.url, description:.description}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns talk | |
(:require [overtone.core :refer :all] | |
[clojure.java.io :as io] | |
[clj-http.client :as http] | |
[clojure.test :as test])) | |
(def talk | |
{:title "Sequencing dance music with Clojure" | |
:author "Piotr Jagielski" | |
:company {:name "TouK" :what "Software house" :from "Warsaw, Poland"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns talk | |
(:require [overtone.core :refer :all] | |
[clojure.java.io :as io] | |
[clj-http.client :as http] | |
[clojure.test :as test])) | |
(def talk | |
{:title "Sequencing dance music with Clojure" | |
:author "Piotr Jagielski" | |
:company {:name "TouK" :what "Software house" :from "Warsaw, Poland"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bb | |
(ns vidwiz.main | |
"This is a prototype script for automating a portion of my video editing using ffmpeg." | |
(:require [clojure.java.shell :refer [sh]] | |
[clojure.string :as st])) | |
;; util | |
(defn get-extension | |
[fname] |