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
| default_vlans: &default_vlans "{ | |
| 'vlan {{ admin_vlan }}': { | |
| 'description': 'Production/Administration', | |
| 'tagged_members': [ | |
| { | |
| 'port': 'port-channel 10', | |
| 'state': 'present' | |
| } | |
| ], | |
| 'state': 'present' |
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 add_interface_group_to_segment(self, tenant_name, segment_name, interface_group_name, vlan_id): | |
| segments = self.get_segments(tenant_name) | |
| interface_groups = self.get_interface_groups() | |
| segment_membership = self.get_segment_interface_groups(tenant_name, segment_name) | |
| verb = self.verb_check(segment_membership) | |
| segment_exists, dummy = self.resource_exists(segments, 'name', segment_name) | |
| interface_group_exists, dummy = self.resource_exists(interface_groups, 'name', interface_group_name) | |
| interface_assigned_to_segment, dummy = self.resource_exists(segment_membership, 'interface-group', interface_group_name) |
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 assign_interface_group_to_segment(vlans, interface_groups): | |
| if not ( type(vlans) is list ) and ( type(interface_groups) is list): | |
| print("Parameters must be supplied as a list.") | |
| return | |
| # Lets go ahead and normalize the vlan list into strings because I'm nice to myself... | |
| vlans = [str(vlan) for vlan in vlans] | |
| segments = [segment for segment in segment_info if segment[':vlan_tag'] in vlans] |
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
| from bcf_methods import BigCloudFabric | |
| import pprint | |
| import csv | |
| import yaml | |
| def main(): | |
| segment_info = [] | |
| with open('/home/nhanlon/Downloads/Kayak-SomervilleNetwork-Discovery - Segments.csv', 'rb') as f: | |
| data = csv.DictReader( |
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
| :oc:du::du -sk * | sort -rn | awk '{{}out=$2; for(i=3;i<=NF;i{+}{+}){{}out=out" "$i{}}; print out{}}' | xargs -ia du -hs "a" | |
| :oc:tcpcount::netstat -plan|grep :80|awk {{}'print $5'{}}|cut -d: -f 1|sort|uniq -c|sort -nk 1 | |
| :oc:udptcp::netstat -anp |grep 'tcp\|udp' | awk '{{}print $5{}}' | cut -d: -f1 | sort | uniq -c | sort -n | |
| :oc:estab::netstat -ntu | grep ESTAB | awk '{{}print $5{}}' | cut -d: -f1 | sort | uniq -c | sort -nr |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main( int argc, char *argv[] ) { | |
| FILE *fp; | |
| char path[80]; | |
| fp = popen("/usr/bin/which telinit", "r"); |
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
| pool.installAllPatches | |
| { | |
| "pool": "df32b8d2-12e1-7a84-0490-7a8178247188", | |
| "id": "df32b8d2-12e1-7a84-0490-7a8178247188" | |
| } | |
| { | |
| "message": "SR required to create VDI", | |
| "stack": "Error: SR required to create VDI | |
| at Xapi._callee52$ (/usr/local/lib/node_modules/xo-server/dist/xapi/xapi/index.js:1627:12) | |
| at tryCatch (/usr/local/lib/node_modules/xo-server/node_modules/regenerator-runtime/runtime.js:65:40) |
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
| >>> 262.2 / float(2.2) | |
| 119.18181818181817 | |
| >>> 262.2 / float(2.20462) | |
| 118.93206085402474 |
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 isOdd(value): | |
| numbers = list(range(0, 2147483647)) | |
| even = True | |
| for num in numbers: | |
| if even: | |
| numbers.remove(num) | |
| even = not even | |
| if value in numbers: | |
| # double check | |
| if not isEven(value): |
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
| 2.3.0 :047 > q.first[1]["name_label"] | |
| => "xenc" | |
| 2.3.0 :048 > q.select{|t| t[1]["name_label"].to_s == "xenc"} | |
| => {} |