This file contains 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
open Lwt | |
let establish saddr caddr = | |
let open Lwt_io in | |
let str,push = Lwt_stream.create () in | |
let client (g,p) = | |
let rec loop () = write_chars p str >> loop () in | |
ignore_result (loop ()) in | |
let hsrv = establish_server saddr client in | |
lwt g,p = open_connection caddr in |
This file contains 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
val establish: Unix.sockaddr -> Unix.sockaddr -> unit Lwt.t | |
(** [establish broadcast from] establishes a server, broadcasting | |
data from address [from] to [broadcast] *) |
This file contains 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
export CPATH=/opt/local/include | |
export LIBRARY_PATH=/opt/local/lib | |
export MANPATH=/opt/local/man | |
export LDFLAGS='-L/opt/local/lib' | |
export CPPFLAGS='-I/opt/local/include' | |
export LD_LIBRARY_PATH=/opt/local/lib | |
export LD_INCLUDE_PATH=/opt/local/include |
This file contains 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
open Lwt | |
let block_size = 256 * 4096 | |
let ifd = Lwt_unix.stdin | |
let ofd = Lwt_unix.stdout | |
let print spd = | |
try_lwt | |
Lwt_io.eprintf "%s\r" (Speed.to_string spd) | |
with Speed.Undefined -> return_unit |
This file contains 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
This file contains 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
(* | |
1. install opam | |
2. install core_kernel library: `opam install core_kernel` | |
3. build with `ocamlbuild -pkg core_kernel scabble.native` | |
4. run as `./scrabble.native /usr/share/dict/american-english` | |
*) | |
open Core_kernel.Std | |
open Format |
This file contains 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
open Core_kernel.Std | |
open Bap.Std | |
open Or_error.Monad_infix | |
module Insn = Disasm_expert.Basic.Insn | |
module Mips = struct | |
(** Defines the register map *) | |
module CPU = struct | |
let mem = Var.create "mem" @@ mem32_t `r8 |
This file contains 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
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = "4096" | |
end | |
config.vm.provision "shell", privileged: false, inline: <<-SHELL | |
sudo add-apt-repository --yes ppa:avsm/ppa | |
sudo apt-get update | |
sudo apt-get --yes install opam | |
opam init --auto-setup --comp=4.02.3 --yes |
This file contains 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
import bap | |
import networkx as nx | |
def build_cfg(sub): | |
G = nx.DiGraph() | |
entry = sub.blks[0].id.number | |
G.add_node(entry) | |
for blk in sub.blks: | |
for jmp in blk.jmps: | |
if jmp.constr == 'Goto' and jmp.target.constr == 'Direct': |
This file contains 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
open Core_kernel.Std | |
open Bap.Std | |
open Graphlib.Std | |
module G = Graphs.Cfg | |
let complexity graph = | |
let edges = Seq.length (G.edges graph) in | |
let nodes = Seq.length (G.nodes graph) in | |
let parts = Graphlib.strong_components (module G) graph |> |
OlderNewer