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
Битовые операторы Python | |
Эти операторы работают над операндами бит за битом. | |
Бинарное И (&) | |
Проводит побитовую операцию and над двумя значением. Здесь бинарная 2 — это 10, а 3 — 11. Результатом побитового and является 10 — бинарная 2. Побитовое and над 011(3) и 100(4) выдает результат 000(0). | |
Пример: | |
>>> 2&3 | |
2 | |
>>> 3&4 |
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
# flatten([1, [2, 3, [4]], 5]) -> [1,2,3,4,5] | |
# flatten([1, [2,3], [[2], 5], 6]) -> [1,2,3,2,5,6] | |
def flatten(s): | |
if not s: | |
return [] | |
if isinstance(s[0], list): | |
return flatten(s[0]) + flatten(s[1:]) | |
return s[:1] + flatten(s[1:]) |
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
#!/bin/env python | |
""" | |
Python library for calling vCO workflows. | |
Author: AV | |
Date: 2018-07-11 | |
Changed 2019-03-18 |
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
#!/bin/env python | |
""" | |
Python wrapper for calling vCO workflows. | |
Author: AV | |
Date: 2018-06-14 | |
Version: 0.6 | |
History: |
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
CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt | |
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) | |
curl --cacert $CERT -H "Authorization: Bearer $TOKEN" https://$KUBERNETES_SERVICE_HOST/api/v1/prelude/default/pods/ |
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
var spanSet = {} | |
for each (var vm in allVms) { | |
var vmOpts = allSessions.filter(function(x){ return x.vmName == vm.name })[0] | |
System.log(vmOpts) | |
System.log(vmOpts.parentName) | |
for each (var dev in vm.config.hardware.device) { | |
if ( | |
!(dev instanceof VcVirtualVmxnet2) && | |
!(dev instanceof VcVirtualVmxnet3) && | |
!(dev instanceof VcVirtualE1000) |
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
1. To find out the CIMC ip from within the ESXi cli: | |
[code] | |
enum_instances OMC_IPMIIPProtocolEndpoint root/cimv2 |grep ipv4 | |
2. To change vmnic order (https://kb.vmware.com/s/article/2091560): | |
[code] | |
localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias list | |
localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type pci --alias vmnicN --bus-address B | |
For example, if you want to swap vmnic3 and vmnic4 use the following commands: |