Skip to content

Instantly share code, notes, and snippets.

View sahid's full-sized avatar

Sahid Orentino Ferdjaoui sahid

View GitHub Profile
This file has been truncated, but you can view the full file.
=> Loading bpf_lxc.c:from-container...
libbpf: loading test/bpf/../../bpf/bpf_lxc.o
libbpf: elf: section(3) 2/1, size 336, link 0, flags 6, type=1
libbpf: sec '2/1': found program '__send_drop_notify' at insn offset 0 (0 bytes), code size 42 insns (336 bytes)
libbpf: elf: section(4) .rel2/1, size 32, link 73, flags 0, type=9
libbpf: elf: section(5) 2/3, size 2096, link 0, flags 6, type=1
libbpf: sec '2/3': found program 'tail_icmp6_send_echo_reply' at insn offset 0 (0 bytes), code size 262 insns (2096 bytes)
libbpf: elf: section(6) .rel2/3, size 144, link 73, flags 0, type=9
libbpf: elf: section(7) 2/5, size 4112, link 0, flags 6, type=1
libbpf: sec '2/5': found program 'tail_icmp6_send_time_exceeded' at insn offset 0 (0 bytes), code size 514 insns (4112 bytes)
@sahid
sahid / client.py
Created September 26, 2014 11:36
demo serial console
# demo os serial-console
#
# deps:
# easy_install ws4py
#
# nova.conf:
# [serial_console]
# enabled = true
#
# nova boot --image cirros --flavor 1 i1
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index db9ab2f..cabdb00 100644
--- a/nova/conductor/manager.py
+++ b/nova/conductor/manager.py
@@ -797,11 +797,6 @@ class ComputeTaskManager(base.Base):
filter_properties=filter_properties,
legacy_bdm_in_spec=legacy_bdm)
- def _get_image(self, context, image_id):
- if not image_id:
diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py
index d0e3d87..c14de7d 100644
--- a/novaclient/v1_1/shell.py
+++ b/novaclient/v1_1/shell.py
@@ -423,6 +423,7 @@ def do_boot(cs, args):
extra_boot_kwargs = utils.get_resource_manager_extra_kwargs(do_boot, args)
boot_kwargs.update(extra_boot_kwargs)
+ print("output from cs.servers.create()...")
server = cs.servers.create(*boot_args, **boot_kwargs)
2013/10/07 07:33:52 Connections spawned: 28200
2013/10/07 07:33:52 websocket.Dial ws://10.220.4.13:8080/: dial tcp 10.220.4.13:8080: cannot assign requested address
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x54d26d]
goroutine 28243 [running]:
sync/atomic.CompareAndSwapUint32()
/usr/lib/go/src/pkg/sync/atomic/asm_amd64.s:14 +0xd
sync.(*Mutex).Lock(0x28)
/usr/lib/go/src/pkg/sync/mutex.go:43 +0x35
@sahid
sahid / gist:5022081
Created February 24, 2013 00:42
Bucket Sort in Python
def bsort(A):
"""Returns A sorted. with A = {x : x such that 0 <= x < 1}."""
buckets = [[] for x in range(10)]
for i, x in enumerate(A):
buckets[int(x*len(buckets))].append(x)
out = []
for buck in buckets:
out += isort(buck)
return out
@sahid
sahid / gist:4981382
Created February 18, 2013 22:32
Delete a node ins a BST
def transplant(root, node, newone):
if newone:
newone.parent = node.parent
if node.parent:
if node.parent.left == node:
node.parent.left = newone
else:
node.parent.right = newone
else:
root = newone
@sahid
sahid / gist:4979645
Created February 18, 2013 18:50
Insert into a BST Python
def insert(root, node):
curr = root # Keeps the root of the tree.
while curr:
parent = curr
if node.key < curr.key:
curr = node.left
else:
curr = node.right
node.parent = parent
if node.parent is None:
@sahid
sahid / gist:4979320
Last active December 13, 2015 21:48
Search min/max in a BST. Python
def min(node):
while node.left:
node = node.left
return node
def max(node):
while node.right:
node = node.right
return node
@sahid
sahid / gist:4974098
Created February 17, 2013 23:30
Find the kth largest element in an unsorted array.
def findKth(A, k):
if k > len(A) or k < 1:
raise Exception("Invalid Parameters.")
i = 0
while i < k:
imax = i
j = i + 1
while j < len(A):
if A[imax] < A[j]:
imax = j