Skip to content

Instantly share code, notes, and snippets.

View andrewray's full-sized avatar

Andrew Ray andrewray

View GitHub Profile
@andrewray
andrewray / cifakiyo128.p64
Last active August 29, 2015 14:06
cifakiyo h.261 bitstream
@andrewray
andrewray / solver.ml
Created March 14, 2015 02:38
OCaml conjugate gradient solver (for positive semi-definite matrices). For use in the Coursera "VLSI CAD: Logic to Layout" mooc placement exersize.
(*
An OCaml (4.02) port of the C++ conjugate gradient solver.
Demo
----
$ ocaml
# #use "solver.ml";;
# let b, (err, x) = Demo.solve_small();;
@andrewray
andrewray / gist:179832b0ea39481d0f2c
Last active August 29, 2015 14:17
install zmq3 (yes really 3) for ubuntu 12.04
#!/bin/sh -ex
echo 'yes' | sudo apt-add-repository ppa:lvillani/zeromq3
sudo apt-get update
sudo apt-get install --force-yes -y libzmq3=3.2.4+dfsg-1~precise1~ppa1 libzmq3-dev=3.2.4+dfsg-1~precise1~ppa1

To access Iocaml require the package iocaml-kernel.notebook

From a discussion on using plplot in iocaml

yes, either Iocaml.dispaly or Iocaml.send_mime could do the job in sligthly different ways:

?context:Iocaml.cell_context -> ?base64:bool -> string -> string -> unit
@andrewray
andrewray / gist:4f4d1949934557ca1d59
Created May 22, 2015 15:54
An example GIST for the ocaml-github javascript test application
A simple GIST created to demonstrate ocaml-github javascript integration.
(* Extending the LEDs example with a couple of more advanced features.
1) Use interfaces to define the input and output ports of the circuit
and then use the generic functors in HardCaml.Interface to avoid
needing to explicitly define port names with the `input` and `output`
functions.
2) Implement the pictorial statemachine from the diagram in the style
we would use if writing in VHDL or Verilog
@andrewray
andrewray / gist:a6e44c0ab497e8737dc2
Created March 14, 2016 12:35
Dockerfile to build iocaml and run with jupyter
FROM ocaml/opam
RUN sudo apt-get install -y \
libgmp3-dev \
libzmq3-dev \
libffi-dev \
libssl-dev \
zlib1g-dev \
pkg-config \
build-essential \
@andrewray
andrewray / install.md
Last active September 20, 2016 16:08
Install hardcaml-riscv (20 sept 2016)
@andrewray
andrewray / ppx_hardcaml.ml
Created December 14, 2016 01:45
ppx_hardcaml, using expression mapper
(*
build with:
ocamlbuild -use-ocamlfind -package compiler-libs.common -package ppx_tools.metaquot ppx_hardcaml.native
*)
open Ast_mapper
open Ast_helper
@andrewray
andrewray / test_hier2.ml
Created January 23, 2017 02:22
Hierarchy in hardcaml, with optional flattening and automatic wiring of clock
open HardCaml
(* different register types *)
module Seq = struct
open Signal
open Types
open Seq
module type S = sig
include Interface.S
val reg : Api.Comb.t t -> Signal.Types.register