CCNA DevNet Notes

1) Python Requests status code checks:

r.status_code ==

2) Docker publish ports:

$ docker run -p ubuntu bash

This binds port 8080 of the container to TCP port 80 on of the host machine. You can also specify udp and sctp ports. The Docker User Guide explains in detail how to manipulate ports in Docker.

3) HTTP status codes:

1xx informational
2xx Successful
 201 created
 204 no content (post received by server)
3xx Redirect
 301 moved permanently - future requests should be directed to the given URI
 302 found - requested resource resides temporally under a different URI
 304 not modified
4xx Client Error
 400 bad request
 401 unauthorized (user not authenticated or failed)
 403 forbidden (need permissions)
 404 not found
5xx Server Error
 500 internal server err - generic error message
 501 not implemented
 503 service unavailable

4) Python dictionary filters:

my_dict = {8:'u',4:'t',9:'z',10:'j',5:'k',3:'s'}

# filter(function,iterables)
new_dict = dict(filter(lambda val: val[0] % 3 == 0, my_dict.items()))

print("Filter dictionary:",new_filt)

5) HTTP Authentication

Basic: For "Basic" authentication the credentials are constructed by first combining the username and the password with a colon (aladdin:opensesame), and then by encoding the resulting string in base64 (YWxhZGRpbjpvcGVuc2VzYW1l).

Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l

auth_type = 'Basic'
creds = '{}:{}'.format(user,pass)
creds_b64 = base64.b64encode(creds)
header = {'Authorization': '{}{}'.format(auth_type,creds_b64)}


Authorization: Bearer <TOKEN>

6) “diff -u file1.txt file2.txt”. link1 link2

The unified format is an option you can add to display output without any redundant context lines

$ diff -u file1.txt file2.txt                                                                                                            
--- file1.txt   2018-01-11 10:39:38.237464052 +0000                                                                                              
+++ file2.txt   2018-01-11 10:40:00.323423021 +0000                                                                                              
@@ -1,4 +1,4 @@                                                                                                                                  
  • The first file is indicated by —
  • The second file is indicated by +++
  • The first two lines of this output show us information about file 1 and file 2. It lists the file name, modification date, and modification time of each of our files, one per line. 
  • The lines below display the content of the files and how to modify file1.txt to make it identical to file2.txt.
  • - (minus) – it needs to be deleted from the first file.
    + (plus) – it needs to be added to the first file.
  • The next line has two at sign @ followed by a line range from the first file (in our case lines 1 through 4, separated by a comma) prefixed by “-“ and then space and then again followed by a line range from the second file prefixed by “+” and at the end two at sign @. Followed by the file content in output tells us which line remain unchanged and which lines needs to added or deleted(indicated by symbols) in the file 1 to make it identical to file 2

7) Python Testing: Assertions

.assertEqual(a, b)	a == b
.assertTrue(x)	        bool(x) is True
.assertFalse(x)	        bool(x) is False
.assertIs(a, b)	        a is b
.assertIsNone(x)	x is None
.assertIn(a, b)	        a in b
.assertIsInstance(a, b)	isinstance(a, b)

*** .assertIs(), .assertIsNone(), .assertIn(), and .assertIsInstance() all have opposite methods, named .assertIsNot(), and so forth.

Pinza Veneta

This is a typical cake from the Veneto region in Italy. I tasted it in Venice and wanted to try myself at some point, and that happened this weekend.

I used this video and this blog as inspiration.


  • 1 litre whole milk (have some more extra just in case)
  • 200g corn flour (semolina)
  • 70g 00′ flour (plain can work too)
  • 80g butter
  • 100g sugar
  • 50g walnuts (chopped) – optional
  • 70ml Sambuca (didnt have Grappa)
    • 1 tsp fennel seeds (I used caraway as I didnt have fennel)
    • 1 tsp anis seeds
    • 1 orange: zest + juice
    • 1 lemon: zest
    • 2 apples chopped in small pieces
  • 8 dried figs chopped
  • 50g raisins


  • Pre-heat the oven at 180C.
  • Prepare a tray and spread some butter.
  • Soak the raisins, seeds, orange and lemon zest, juice and figs in Sambuca
  • In a big pan, bring to boil the milk. Immediately add corn and flour whisking without stopping to avoid lumps. Put at low heat now!
  • If it is too thick, you can add more milk. (I think I used 1.2l milk at the end and still quite thick!!!)
  • Cook for a couple of minutes at low heat, keep whisking, don’t burn it!
    • Remove from heat and add butter, sugar, and the mix fruit with sambuca. Add walnuts.
    • Mix all well with a spoon.
    • Pour in the tray. Level it with the spoon.
    • Put in the oven for 50-60 minutes.
    • Should be brown on top and quite moist inside if you dip a knife on it. The knife shouldnt come out clean.
    • Remove from oven and let it cool down for 1h at least before trying. The polenta is very moist so it takes time to get “solid”. Next day is even better taste!

This is the result!

It wasnt as the one I tasted in Venice but still was pretty good!