Skip to content

Instantly share code, notes, and snippets.

View pichuang's full-sized avatar

Phil Huang pichuang

View GitHub Profile
@pichuang
pichuang / clusterdemo.py
Last active August 29, 2015 14:23
mininet clusterdemo.py by pichuang
#!/usr/bin/python
"clusterdemo.py: demo of Mininet Cluster Edition prototype"
from mininet.examples.cluster import MininetCluster, SwitchBinPlacer
from mininet.topolib import TreeTopo
from mininet.log import setLogLevel
from mininet.examples.clustercli import ClusterCLI as CLI
from mininet.node import Controller, RemoteController
#!/usr/bin/python
from mininet.examples.cluster import MininetCluster, SwitchBinPlacer
from mininet.topolib import TreeTopo
from mininet.topo import LinearTopo
from mininet.log import setLogLevel, info
from mininet.examples.clustercli import ClusterCLI as CLI
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.util import dumpNodeConnections
@pichuang
pichuang / yield.py
Last active August 29, 2015 14:24
Research fab
#!/usr/bin/env python3
'''
Research yield
http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/
'''
import time
import logging
@pichuang
pichuang / counter.py
Created July 1, 2015 11:50
Research counter
#!/usr/bin/env python3
'''
Research counter
'''
'''
Use dict()
'''
data = ['a', '2', 2, 4, 5, '2', 'b', 4, 7, 'a', 5, 'd', 'a', 'z']
count_freq = dict()
#!/usr/bin/python
"""
vxlan_mininet.py
mininet1 mininet2
-------- --------
| | | |
| s1=========s2 |
| | | | | |
#!/usr/bin/python
"""
gre_mininet.py
mininet1 mininet2
-------- --------
| | | |
| s1=========s2 |
| | | | | |
#!/bin/sh
APP_PATH=~/ryuInstallHelper/ryu/ryu/tests/switch
TEST_TARGET_SWITCH="0000000000000001"
AUXILIARY_SWITCH="0000000000000002"
TEST_PATTERN="of13"
ryu-manager --test-switch-target $TEST_TARGET_SWITCH \
--test-switch-tester $AUXILIARY_SWITCH \
--test-switch-dir $APP_PATH/$TEST_PATTERN \
$APP_PATH/tester.py
<?php
$arr = array(0=>1,"aa"=>2, 3, 4);
foreach($arr as $key=>$val){
print($key == "aa" ? 5 : $val);
}
?>
@pichuang
pichuang / 0_reuse_code.js
Created November 2, 2015 18:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
hostname bgp1
password sdnip
!
router bgp 65000
bgp router-id 192.168.10.101
timers bgp 3 9
!
neighbor 192.168.10.1 remote-as 65001
neighbor 192.168.10.1 ebgp-multihop
neighbor 192.168.10.1 timers connect 5