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 ast | |
import pprint | |
import networkx as nx | |
import matplotlib.pyplot as plt | |
class viz_walker(ast.NodeVisitor): | |
def __init__(self): | |
self.stack = [] |
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
def f3(x): | |
return 3*x | |
def f4(x): | |
return 4*x | |
def f2a(x): | |
return 2*f3(x) | |
def f2b(x): |
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
(defparameter defun-super-debug t) | |
(defmacro defun-wrapped-error (name vars &rest body) | |
" | |
A wrapper around defun that will catch any error and note which function it comes from before | |
re-raising the error. | |
" | |
`(defun ,name ,vars | |
(handler-case | |
(progn |
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
#!/bin/env/sh | |
# | |
# upload_to_ambition.sh | |
# Simple script demonstrating how to upload data to the Ambition Data API. | |
export AUTH_TOKEN=<AUTH-TOKEN> | |
curl -vvv -H "Content-Type: application/json" -X POST "https://<SUBDOMAIN>.ambition.com/public-api/integration/v1/data/new/" -H "Authorization: Token $AUTH_TOKEN" -d "{\"depot\": \"custom_depot\", \"data\": \"Data from Curl!\"}" |
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
#!/bin/env python | |
# | |
# ambition_api_python_example.py | |
# Simple script demonstrating how to upload data to the Ambition Data API. | |
import json | |
import sys | |
import urllib2 | |
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
/* | |
* upload_to_ambition.cs | |
* Simple program demonstrating how to upload data to the Ambition Data API | |
* | |
* This code needs to be linked to the System.Web.Extensions assembly. | |
* | |
* For mono, use 'gmcs ambition_api_c#_example.cs -r:System.Web.Extensions' | |
*/ | |
using System; |
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
# Note: I've used a consistent naming schem for the files in this project | |
# (ie, bindigo.mli bindigo.ml bindigo_tests.ml). | |
# This allows easy construction of various make targets working working with the files. | |
DELIM = ---------------------------- | |
LIB_NAME = bindigo | |
# Install this package so that is accessible in other projects on this sytem | |
install: clean uninstall $(LIB_NAME).byte $(LIB_NAME).native | |
@echo $(DELIM) Installing... |
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
macro_rules! time_it { | |
($msg:expr, $code:block) => ({ | |
let start = SystemTime::now(); | |
let res = { $code }; | |
let end = SystemTime::now(); | |
println!("{:?} duration: {:?}", $msg, end.duration_since(start).ok().unwrap()); | |
res | |
}) | |
} |
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
{-# OPTIONS_GHC -Wall #-} | |
module Tree where | |
import Data.List | |
data Tree a = Leaf | |
| Node Integer (Tree a) a (Tree a) | |
deriving (Show) | |
treeHeight :: Tree a -> Integer | |
treeHeight Leaf = 0 |
OlderNewer