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
(defn first-denomination [kinds-of-coins] | |
(cond (= kinds-of-coins 1) 1 | |
(= kinds-of-coins 2) 5 | |
(= kinds-of-coins 3) 10 | |
(= kinds-of-coins 4) 25 | |
(= kinds-of-coins 5) 50)) | |
(defn cc [amount kinds-of-coins] | |
(cond (= amount 0) 1 | |
(or (< amount 0) (= kinds-of-coins 0)) 0 | |
:else (+ (cc amount |
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 com.mongodb.*; | |
import com.mongodb.util.JSON; | |
import twitter4j.TwitterException; | |
import twitter4j.TwitterStream; | |
import twitter4j.TwitterStreamFactory; | |
import twitter4j.StatusListener; | |
import twitter4j.Status; | |
import twitter4j.StatusDeletionNotice; | |
import twitter4j.internal.org.json.JSONObject; | |
import twitter4j.json.DataObjectFactory; |
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
(ns twitterstream.core | |
(:require | |
[http.async.client :as client] | |
[org.danlarkin.json :as json]) | |
(:use somnium.congomongo)) | |
(mongo! :db "twitterdb") ; Mongo database called twitterdb | |
(def url "https://stream.twitter.com/1/statuses/sample.json") | |
(def cred {:user "username" :password "password"}) |
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
# Given a graph that is a list of edges between nodes | |
# i.e. [(0,1), (1,5), (5, 7), (7,1)] | |
def find_eulerian_tour(graph): | |
tour = [] | |
find_tour(graph[0][0], graph, tour) | |
return tour | |
def find_tour(u, graph, tour): | |
for edge in graph: | |
if u == edge[0]: |
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 httplib2 | |
import json | |
h = httplib2.Http(".cache") | |
h.add_credentials('admin', 'admin') | |
#resp, content = h.request('http://10.55.17.20:8080/controller/nb/v2/statistics/default/flowstats', "GET") | |
# Updated 8 SEP 2013 to reflect new REST API | |
resp, content = h.request('http://10.55.17.20:8080/controller/nb/v2/statistics/default/flow', "GET") | |
allFlowStats = json.loads(content) | |
flowStats = allFlowStats['flowStatistics'] |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.opendaylight.controller</groupId> | |
<artifactId>commons.opendaylight</artifactId> | |
<version>1.4.0-SNAPSHOT</version> | |
<relativePath>../../../controller/opendaylight/commons/opendaylight</relativePath> | |
</parent> |
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
package com.example.mystats; | |
import org.opendaylight.controller.sal.core.Node; | |
import org.opendaylight.controller.sal.match.MatchType; | |
import org.opendaylight.controller.sal.reader.FlowOnNode; | |
import org.opendaylight.controller.sal.utils.ServiceHelper; | |
import org.opendaylight.controller.statisticsmanager.IStatisticsManager; | |
import org.opendaylight.controller.switchmanager.ISwitchManager; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
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
package com.example.mystats | |
import org.osgi.framework.{ BundleActivator, BundleContext } | |
import org.opendaylight.controller.sal._ | |
import org.opendaylight.controller.statisticsmanager.IStatisticsManager | |
import org.opendaylight.controller.switchmanager.ISwitchManager | |
import org.opendaylight.controller.sal.utils.ServiceHelper | |
import scala.collection.JavaConversions._ | |
class Activator extends BundleActivator { |
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
var w = 400, | |
h = 400, | |
fill = d3.scale.category20(); | |
var svg = d3.select("#chart") | |
.append("svg:svg") | |
.attr("width", w) | |
.attr("height", h); | |
d3.json("topo.json", function(json) { |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.opendaylight.controller</groupId> | |
<artifactId>commons.opendaylight</artifactId> | |
<version>1.4.0-SNAPSHOT</version> | |
<relativePath>../../../controller/opendaylight/commons/opendaylight</relativePath> | |
</parent> |
OlderNewer