#!/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
<!-- common payload: stats associated with data --> | |
type StatsRange = { | |
max: number, min: number | |
} | |
type StatsKeys = 'count' | 'aum' | 'priceusd' | 'value' | |
type PartialStats< | |
T extends Partial<{ | |
[key in StatsKeys]: any; |
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
<!-- common payload: stats associated with data --> | |
type StatsRange = { | |
max: number, min: number | |
} | |
type StatsKeys = 'count' | 'aum' | 'priceusd' | 'value' | |
interface PartialStats<Type extends string|number|symbol, RangeType> { | |
stats?: Partial<Record<Type, RangeType>> | |
} |
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
<!-- common payload: stats associated with data --> | |
type StatsRange = { | |
max: number, min: number | |
} | |
type StatsKeys = 'count' | 'aum' | 'priceusd' | 'value' | |
type PartialStats = { | |
stats?: { | |
[key in StatsKeys]?: StatsRange |
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
<-- 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
// before inline default | |
import { BeforeFunction } from 'before-module'; | |
const BeforeComponent = (props) => { | |
const view = BeforeFunction(); | |
return <View>{view}</View>; | |
}; | |
// after inline default |
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, |
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
// lazy loading for three images | |
const ImageLazyLoad = React.forwardRef((props, ref) => { | |
const marker1 = React.useRef(null); | |
const marker2 = React.useRef(null); | |
const marker3 = React.useRef(null); | |
const [markerVisible, setmarkerVisible] = useState(0); | |
// marker Visible set with value -> 1,2,3 | |
React.useImperativeHandle(ref, () => ({ | |
onScroll: () => { |
NewerOlder