This file contains hidden or 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 difflib | |
veggies1 = ''' | |
celery | |
spinach | |
lettuce | |
garlic | |
carrot | |
cabbage | |
potato |
This file contains hidden or 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
--- lao 2020-02-21 23:30:39.942229878 -0800 | |
+++ tzu 2020-02-21 23:30:50.442260588 -0800 | |
@@ -1,7 +1,6 @@ | |
-The Way that can be told of is not the eternal Way; | |
-The name that can be named is not the eternal name. | |
The Nameless is the origin of Heaven and Earth; | |
-The Named is the mother of all things. | |
+The named is the mother of all things. | |
+ | |
Therefore let there always be non-being, |
This file contains hidden or 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
--- | |
- hosts: router_fsn | |
gather_facts: no | |
connection: local | |
tasks: | |
- name: Login | |
include_vars: secrets.yml | |
- name: Provider definition |
This file contains hidden or 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 requests | |
data = { 'username' : 'root', 'password' : 'default' } | |
r = requests.post('https://address.of.opengear/api/v1/sessions/', data=json.dumps(data), verify=False) | |
token = json.loads(r.text)['session'] |
This file contains hidden or 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 requests, json | |
data = { 'username' : 'root', 'password' : 'default' } | |
r = requests.post('https://address.of.opengear/api/v1/sessions/', json.dumps(data), verify=False) | |
token = json.loads(r)['session'] |
This file contains hidden or 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 requests, json | |
data = { 'username' : 'root', 'password' : 'default' } | |
r = requests.post('https://address.of.opengear/api/v1/sessions/', json.dumps(data), verify=False) | |
token = json.loads(r.text)['session'] |
This file contains hidden or 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 requests, json | |
data = { 'username' : 'root', 'password' : 'default' } | |
r = requests.post('https://address.of.opengear/api/v1/sessions/', data=json.dumps(data), verify=False) | |
token = json.loads(r.text)['session'] |
This file contains hidden or 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
headers = { 'Authorization' : 'Token ' + token } | |
r = requests.get('https://address.of.opengear/api/v1/serialPorts/', headers=headers, verify=False) | |
j = json.loads(r.text) | |
print(json.dumps(j, indent=4)) |
This file contains hidden or 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
def my_function(n): | |
return n > 1 | |
print(my_function(1)) | |
print(my_function(2)) |
This file contains hidden or 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 unittest | |
class TestStringMethods(unittest.TestCase): | |
def test_upper(self): | |
self.assertEqual('foo'.upper(), 'FOO') | |
def test_isupper(self): | |
self.assertTrue('FOO'.isupper()) | |
self.assertFalse('Foo'.isupper()) |