Based on Zeno Rocha Osx Setup
When you have a new MacBook...
First of all backup everything with Time Machine or in another way.
class MyMath | |
def self.euclides(num1, num2) | |
return num1 if num2 == 0 | |
return euclides(num2, num1 % num2) | |
end | |
end | |
MyMath.euclides(12, 18) |
o = '* 172.31.1.0/24 40.0.0.4 0 7678 7675 i\n' | |
k = [x for x in o.split(" ") if x != ''] # k = ['*', '172.31.1.0/24', '40.0.0.4', ' 0 7678 7675 i\n'] | |
p = k[-1].split(' ') # p = ['0', '7678', '7675', 'i\n'] | |
k.pop() # k = ['*', '172.31.1.0/24', '40.0.0.4'] | |
k.append(p[0]) # k = ['*', '172.31.1.0/24', '40.0.0.4', '0'] | |
p.pop(0) # p = ['7678', '7675', 'i\n'] | |
d = '' | |
for z in p: | |
d = d + z | |
k.append(d.lstrip()) # k = ['*', '172.31.1.0/24', '40.0.0.4', '0', '7678 7675 i\n'] |
BGP table version is 0, local router ID is 10.0.0.2 | |
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, | |
r RIB-failure, S Stale, R Removed | |
Origin codes: i - IGP, e - EGP, ? - incomplete | |
Network Next Hop Metric LocPrf Weight Path | |
* 172.31.1.0/24 40.0.0.4 0 7678 7675 i | |
*> 10.0.0.1 0 0 7675 i | |
*> 172.31.2.0/24 0.0.0.0 0 32768 i | |
* 172.31.3.0/24 40.0.0.4 0 7678 7677 i |
[['BGP table version is 0, local router ID is 10.0.0.2\n'], ['Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,\n'], [' r RIB-failure, S | |
Stale, R Removed\n'], ['Origin codes: i - IGP, e - EGP, ? - incomplete\n'], ['\n'], [' Network Next Hop Metric LocPrf Weight Path\n'], ['* 172.31.1.0/24 4 | |
0.0.0.4 0 7678 7675 i\n'], ['*> 10.0.0.1 0 0 7675 i\n'], ['*> 172.31.2.0/24 0.0.0.0 0 | |
32768 i\n'], ['*> 172.31.3.0/24 10.0.0.1 0 7675 7677 i\n'], ['* 40.0.0.4 0 7678 7677 i\n'] | |
, ['* 172.31.4.0/24 10.0.0.1 0 7675 7678 i\n'], ['*> 40.0.0.4 0 0 7678 i\n'], ['\n'], ['Total number | |
of prefixes 4\n']] |
#!/bin/sh | |
#Kill process by name | |
ps -ef | grep $1 | grep -v grep | awk '{print $2}' | xargs kill -9 |
#! /usr/bin/env python | |
import re | |
# Sample input to test | |
crude = ''' | |
BGP table version is 0, local router ID is 10.0.0.2 | |
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, | |
r RIB-failure, S Stale, R Removed | |
Origin codes: i - IGP, e - EGP, ? - incomplete | |
Network Next Hop Metric LocPrf Weight Path |
#!/usr/bin/python | |
# Author: Anna Cruz <anna.cruz@uniriotec.br> | |
# | |
# This file is a script to be used as POX module. | |
# | |
# | |
""" | |
This script collects flow informations on all switches connected | |
in this instance of POX. |
a.equal?(b) # object identiy - a e b se referem ao mesmo objeto | |
a.eql?(b) # object equivalence - a e b tem o mesmo valor | |
a == b # object equivalence - a e b tem o mesmo valor com conversão de tipo |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(('',8085)) | |
s.listen(1) | |
conn, addr = s.accept() | |
print 'Connected by', addr | |
data = conn.recv(1024) #receber dados | |
string = bytes.decode(data) #decodificar para string |
Based on Zeno Rocha Osx Setup
When you have a new MacBook...
First of all backup everything with Time Machine or in another way.