Skip to content

Instantly share code, notes, and snippets.

View Quantisan's full-sized avatar

Paul Lam Quantisan

View GitHub Profile

Product Recommendation with Four Customers and 2 Products

Suppose we have a business with only 4 customers and 2 products. The customer can either view or buy a product. We can represent our customers and products as a graph like so.

CREATE
(bob { name:'Bob' }),
(tom { name:'Tom' }),
'use strict';
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
var gulp = require('gulp');
var open = require('open');
var wiredep = require('wiredep').stream;
// Load plugins
var $ = require('gulp-load-plugins')();
@Quantisan
Quantisan / typed_project.clj
Created March 29, 2014 19:44
Mock lein usage of core.typed
(defproject something "0.0.1"
:dependencies [[org.clojure/core.typed.core "0.x"]] ;; with minimal trace
:profiles {:dev {:dependencies [[org.clojure/core.typed "0.x"]]}}) ;; with full
@Quantisan
Quantisan / scott.clj
Created May 8, 2014 21:53
clojure restful server library idea with Graph
;; https://scott.mn/2014/01/26/first_thoughts_on_liberator_clojure/
(defn blog-post-resource [request id]
{:authorized?
(fnk [logged-in-user request]
(or logged-in-user
(= (:method request) :get)))
:allowed?
(fnk [logged-in-user author request]
@Quantisan
Quantisan / method_value_or_pointer.go
Created June 11, 2014 15:43
Defining methods on values or pointers
package main
import (
"fmt"
)
type rectPointer struct {
width int
height int
}
@Quantisan
Quantisan / Dockerfile
Created October 20, 2014 21:16
Fig continuous dev setup
FROM clojure
ADD . /usr/src/app
WORKDIR /usr/src/app
RUN lein deps
@Quantisan
Quantisan / articles_struct.clj
Created January 28, 2015 16:19
sample data structure
(def articles
[{:title "3 Langs" :author "boris" :tags #{:java :clojure :haskell}}
{:title "mylangs" :author "rocky" :tags #{:ruby :clojure :haskell}}
{:title "2 Langs" :author "boris" :tags #{:java :haskell}}])

Keybase proof

I hereby claim:

  • I am quantisan on github.
  • I am quantisan (https://keybase.io/quantisan) on keybase.
  • I have a public key ASCTfbD8h3Tj6_1bYqRUF9QnMOkuiy3UL0DJFjohnqRlHQo

To claim this, I am signing this object:

@Quantisan
Quantisan / run_algo.sh
Created September 10, 2018 00:07
AlgoVPN Docker: Deploying with scripted Ansible in a Docker container
# I had trouble provisioning AlgoVPN to EC2 with the included Docker image. The stdin
# isn't reading my AWS credentials correctly. So I'm running the ansible
# playbook directly to bypass entering the secrets. This is a record of my
# shell commands to get it provisioning an AlgoVPN server.
# First follow the instruction at https://github.com/trailofbits/algo/blob/master/docs/Docker.md
# to setup your config.cfg
# On the host machine, inside the algo repository folder, build the Docker image from source.
(require '[stepwise.core :as stepwise])
(stepwise/ensure-state-machine
:make-pizza
{:start-at :make-dough
:states
{:make-dough {:type :task
:resource :make-pizza/make-dough
:next :make-sauce}