Skip to content

Instantly share code, notes, and snippets.

View maarek's full-sized avatar
💭
🦀

Jeremy Lyman maarek

💭
🦀
View GitHub Profile
@maarek
maarek / Main.hs
Created March 28, 2021 15:35
Haskell_Example
{-# LANGUAGE OverloadedStrings #-}
module EscrowWithCollateral where
import Language.Marlowe.Extended
main :: IO ()
main = print . pretty $ contract
{- What does the vanilla contract look like?
@maarek
maarek / blockly.xml
Created March 28, 2021 15:33
Untitled Project
When
[Case
(Deposit
(Role "bob")
(Role "bob")
(Token "" "")
(Constant 4500)
)
(When
[Case
# talos-mstr-01
pvesm alloc local-zfs 201 '' 25G
qm create 201 \
--name talos-mstr-01 \
--cdrom local:iso/talos.iso \
--ostype other \
--ide0 local-zfs:vm-201-disk-0,size=25G \
--sockets 1 \
--cores 1 \
@maarek
maarek / GPG and git on macOS.md
Created September 21, 2019 01:56 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
// How to do this functional flow in Javaslang/Vavr
Response response = new PersonValidator().validatePerson("First", "Last"); // Returns Validation<Seq<String>, Person>
// success -> Try.of(() -> sendToMoon(Person)) // Throws Exception or returns void
// trySuccess -> Response.ok().build()
// tryFailure -> Response.Status(BadRequest).entity(throwable).build()
// failure -> Response.Status(BAD_REQUEST).entity(validatorStringsAppended).build()
struct Item {
let description: String
let weight: Int
let value: Int
let quantity: Int
init(description: String, weight: Int, value: Int, quantity: Int) {
self.description = description
self.weight = weight
@maarek
maarek / build.gradle
Created October 22, 2015 17:50
kotlin quasar build.gradle
buildscript {
ext.kotlinVer = '0.14.449'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVer"
}
}
@maarek
maarek / server.ex
Last active August 29, 2015 14:20
Elixir Chat Server
defmodule Chat.Server do
use Application
# Create a Room structure that has a list of clients
defmodule Room do
defstruct users: []
end
defmodule User do
defstruct name: "", socket: Socket
@maarek
maarek / gist:ecbe1e176c292b6912be
Last active August 29, 2015 14:15
Length of longest subsequence of (+1)-increasing consecutive integers
; ex. (= (__ [1 0 1 2 3 0 4 5]) [0 1 2 3])
; #1 given list
(def lci (fn [list]
; #2 create partitioned list ((1 0) (0 1) (1 2) (2 3) (3 0) (0 4) (4 5))
; #3 perform last first on partitioned list
(->> (partition 2 1 list)
; #4 goes through each group and determines if index 2 is less than index 1 and groups those as it iterates
; (((1 0)) ((0 1) (1 2) (2 3)) ((3 0)) ((0 4)) ((4 5)))
(partition-by #(- (second %) (first %)))
; #5 iterate each group from the previous to determine is index 2 is less than 1 and if true return
@maarek
maarek / bigchain.exs
Last active August 29, 2015 14:02
elixir --erl "+P 1000000" bigchain.exs
defmodule Bigchain do
def start(n) do
start self, n
end
def start(pid, 0) do
#IO.puts "start #{inspect pid}, 0"
send pid, {:stop, 0}
end