Skip to content

Instantly share code, notes, and snippets.

from ctypes import c_char
from ctypes import c_char_p
from ctypes import c_short
from ctypes import c_uint16
from ctypes import c_int
from ctypes import c_ushort
from ctypes import c_ulong
from ctypes import CDLL
from ctypes import Structure
from ctypes import Union
@shriroopjoshi
shriroopjoshi / ovs-cheat.md
Created January 30, 2020 00:26 — forked from djoreilly/ovs-cheat.md
OVS cheat sheet

DB

ovs-vsctl list open_vswitch
ovs-vsctl list interface
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl -f csv --no-heading --columns=_uuid list controller
ovs-vsctl -f csv --no-heading -d bare --columns=other_config list port
ovs-vsctl --format=table --columns=name,mac_in_use find Interface name=br-dpdk1
ovs-vsctl get interface vhub656c3cb-23 name
@shriroopjoshi
shriroopjoshi / interface.py
Created January 30, 2020 00:25
An example to use C library calls from python to get physical interfaces
from ctypes import c_char
from ctypes import c_char_p
from ctypes import c_int
from ctypes import c_uint
from ctypes import c_ushort
from ctypes import c_void_p
from ctypes import CDLL
from ctypes import pointer
from ctypes import POINTER
from ctypes import Structure
@shriroopjoshi
shriroopjoshi / endian.c
Created July 23, 2019 18:45
Code to check endian-ness of the system
#include <stdio.h>
int main() {
unsigned int i = 1;
char *c = (char*) &i;
if (*c)
printf("Little endian\n");
else
printf("Big endian\n");
return 0;
@shriroopjoshi
shriroopjoshi / buddyinfo.py
Created March 4, 2019 19:44 — forked from labeneator/buddyinfo.py
Pretty prints /proc/buddyinfo
#!/usr/bin/env python
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 textwidth=79 autoindent
"""
Python source code
Last modified: 15 Feb 2014 - 13:38
Last author: lmwangi at gmail com
Displays the available memory fragments
by querying /proc/buddyinfo