Skip to content

Instantly share code, notes, and snippets.

Mark Engelberg Engelberg

Block or report user

Report or block Engelberg

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
@Engelberg
Engelberg / Poor man's hardware wallet
Last active Jun 5, 2019
"Poor man's hardware wallet"
View Poor man's hardware wallet
For those who cannot afford a hardware wallet, the next best thing is to use Electrum
to create a 2-of-2 multisig wallet with one key on your phone and one on your desktop.
To use, create the transaction on your desktop client, and then display the QR code
for the partially signed transaction. Scan the QR code in your phone's Electrum,
sign it, and broadcast with a few taps.
Given the added difficulty of a hacker accessing both your desktop and your phone,
you get significantly better security and the process of using the wallet remains
relatively straightforward.
@Engelberg
Engelberg / electrs on dojo
Last active Jun 10, 2019
Installing local electrum server that relies on the bitcoin daemon inside of Samourai Dojo for its data
View electrs on dojo
I am successfully running a local electrum server, getting its data from dojo. This is useful for private use of hardware wallets.
Step 1: As Laurent MT suggested in the Samourai telegram group, you need to edit the docker-compose.yaml file, adding to the bitcoind section the following two lines
ports:
- "127.0.0.1:28256:28256"
Step 2: Follow install directions for electrs, an electrum server written in rust.
electrs install directions can be found here: https://github.com/romanz/electrs/blob/master/doc/usage.md
@Engelberg
Engelberg / core_subset.clj
Created Aug 2, 2018
Comparison Clojure to Java
View core_subset.clj
public class CoreSubsetObjective implements Objective<SubsetSolution, CoreSubsetData>{
/**
* Evaluates the given subset solution using the underlying data, by computing the average
* distance between all pairs of selected items. If less than two items are selected,
* the evaluation is defined to have a value of 0.0.
*
* @param solution subset solution
* @param data core subset data
* @return evaluation with a value set to the average distance between all pairs of selected items;
@Engelberg
Engelberg / cond-example.clj
Created Apr 3, 2017
refactoring with better-cond
View cond-example.clj
; The sample to refactor
(if-let [x (foo)]
(if-let [y (bar x)]
(if-let [z (goo x y)]
(do
(qux x y z)
(log "it worked")
true)
(do
(log "goo failed")
@Engelberg
Engelberg / wordlist.txt
Created Feb 21, 2017
Esperanto wordlist from Baza Radikaro with unique 3-letter prefixes
View wordlist.txt
abelo
abio
abomeno
abrikoto
absoluta
abunda
acida
adapti
adicii
adjektivo
@Engelberg
Engelberg / core.clj
Last active Jan 5, 2017
Twenty four using partitions
View core.clj
(ns twentyfour.core
(:use clojure.math.combinatorics))
(def ops ['+ '- '* '/])
(def commutative #{'+ '*})
;; We can generate all the possible expressions efficiently with combinatorics' partitions
;; partitions automatically handles duplicates for us, which keeps the process efficient
(defn expressions [nums]
View keybase.md

Keybase proof

I hereby claim:

  • I am engelberg on github.
  • I am markengelberg (https://keybase.io/markengelberg) on keybase.
  • I have a public key whose fingerprint is C3F3 DE10 2B2E DEDA 4613 AC36 530A 864D 3A1B A35E

To claim this, I am signing this object:

View utils.cond.clj
(ns utils.cond
"A collection of variations on Clojure's core macros. Let's see which features
end up being useful."
{:author "Christophe Grand"}
(:refer-clojure :exclude [cond when-let if-let]))
(defmacro if-let
"A variation on if-let where all the exprs in the bindings vector must be true.
Also supports :let."
([bindings then]
@Engelberg
Engelberg / bowling.clj
Created May 18, 2016
Bowling kata in 11 lines of clojure
View bowling.clj
(defn- sum [s] (reduce + s))
(defn score
([gs] (let [s (clojure.string/replace gs #"\d/" #(str (nth % 0) (char (- 106 (int (nth % 0)))))),
g (map #(case % \X 10 \- 0 (- (int %) 48)) s)]
(score g 1)))
([game frame]
(cond
(= frame 10) (sum game)
(= (first game) 10) (+ (sum (take 3 game)) (score (drop 1 game) (inc frame))),
(= (sum (take 2 game)) 10) (+ (sum (take 3 game)) (score (drop 2 game) (inc frame))),
@Engelberg
Engelberg / teamsplit.clj
Created Oct 7, 2015
Loco model for splitting a sequence of numbers into two equally-sized parts, minimizing the disparity of their sums
View teamsplit.clj
(ns mark.teamsplit
(:require [loco.core :as l]
[loco.constraints :refer :all]))
; Although this problem was stated in terms of a group of players
; with multiple attributes, we can just represent each player by
; a single number, so this function just takes the list of numbers.
(defn find-teams
"Players is a list of player strengths, timeout is in milliseconds"
You can’t perform that action at this time.