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 json | |
from jsonrpclib import Server | |
username = "admin" | |
password = "admin" | |
urlString = "https://{}:{}@{}/command-api".format(username, password, "bleaf1") | |
switchReq = Server( urlString ) | |
response = switchReq.runCmds( 1, ["enable", "show running-config"], "text" ) | |
print response |
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 json | |
from jsonrpclib import Server | |
switches = ["bleaf1", "bleaf2", "bleaf3", "bleaf5"] | |
username = "admin" | |
password = "admin" | |
for switch in switches: | |
urlString = "https://{}:{}@{}/command-api".format(username, password, switch) | |
switchReq = Server( urlString ) |
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 aristalabstatus | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"github.com/fredhsu/eapigo" | |
"io/ioutil" | |
"net/http" | |
"os" |
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] | |
name = "ovsdb" | |
version = "0.1.0" | |
authors = ["fredlhsu <fredlhsu@aristanetworks.com>"] | |
[dependencies.serde] | |
serde = "*" | |
[dependencies.serde_macros] | |
serde_macros = "*" |
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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
"github.com/mitchellh/mapstructure" | |
) |
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> |