#!/usr/bin/python
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.link import Intf
from mininet.log import setLogLevel, info
from mininet.node import Controller, OVSKernelSwitch, RemoteController
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 MySQLdb | |
conn = MySQLdb.connect(host= "localhost", | |
user="root", #give your mysql database username | |
passwd="db password", #give mysql database password | |
db="db name") #give mysql database name | |
x = conn.cursor() | |
''' | |
insert into mysql columns |
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
<-- Commands below connects the mininet hosts to internet and also with other mininet hosts.--> | |
$ sudo mn --topo=single,2 (topology of consisting 1 switch and 2 hosts) | |
$ sudo ifconfig s1 up | |
$ sudo ovs-vsctl add-port s1 enp0s3(or your NAT interface of virtual machine) | |
$ ifconfig enp0s3 0 | |
$ dhclient s1 (To get the IP address for s1. Till here VM will get the internet connectivity through OVS.) | |
mininet> xterm h1 | |
h1> ifconfig h1-eth0 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
''' | |
A custom topology consisting 6 hosts and 3 switches. Where main switch is connected to other two switches. | |
And 3-3 hosts connected to these 2 switches. Your system should have mininet installed. | |
''' | |
from mininet.topo import Topo | |
class MyTopo( Topo ): | |
def __init__( self ): | |
Topo.__init__(self) |
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
$ sudo mn --topo single,3 --controller=remote,ip=<controller ip>,port=6633 | |
(To make a topology with 1 switch, 1 remote controller and 3 hosts) | |
mininet> xterm h1 h2 h3 | |
h2> tcpdump -XX -n -i h2-eth0 (run tcpdump to capture packets) | |
h3> tcpdump -XX -n -i h3-eth0 | |
h1> ping -c1 10.0.0.2 | |
(Do not do pingall before these. Otherwise you won't see the same ARP request on h2 and h3) | |
mininet> exit |
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 UIKit | |
class ViewController: UIViewController { | |
var imageView: UIImageView! | |
let urlImageView = "https://scontent.fblr1-4.fna.fbcdn.net/v/t1.0-9/41680104_2150992674919611_3587931360280444928_n.jpg?_nc_cat=110&_nc_ht=scontent.fblr1-4.fna&oh=0ade5c5fe8c8b5f476fa8336b25fc72f&oe=5CE5D475" | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
addImagesToView() |
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
pipeline { | |
agent none | |
stages { | |
stage('unit-testing') { | |
agent { | |
docker { image 'node:8.15.1-jessie' } | |
} | |
steps { | |
sh 'node -v' | |
} |
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 const CustomText = styled.Text` | |
font-size: ${props => props.fontSize}px; | |
color: ${props => props.fontColor}; | |
letter-spacing: ${props => props.letterSpacing}; | |
font-style: ${props => props.fontStyle}; | |
font-weight: ${props => props.fontWeight}; | |
font-family: ${props => props.fontFamily}; | |
line-height: ${props => props.lineHeight}; | |
`; | |
CustomText.defaultProps = { |
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
const widthPercentageToDP = widthPercent => { | |
const screenWidth = Dimensions.get('window').width; | |
const elemWidth = parseFloat(widthPercent); | |
return PixelRatio.roundToNearestPixel(screenWidth * elemWidth / 100); | |
}; | |
const heightPercentageToDP = heightPercent => { | |
const screenHeight = Dimensions.get('window').height; | |
const elemHeight = parseFloat(heightPercent); | |
return PixelRatio.roundToNearestPixel(screenHeight * elemHeight / 100); | |
}; |
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 axios from 'axios'; | |
import { USER_NAME, PASSWORD, REST_END_POINT } from './ApiConstants'; | |
function baseAxios(options) { | |
const defaultHeaders = { | |
'Content-Type': 'application/json', | |
'Accept-Language': options.language ? options.language : 'en', | |
'lang': options.lang ? options.lang : 'en', | |
username: USER_NAME, | |
password: PASSWORD, |
OlderNewer