Skip to content

Instantly share code, notes, and snippets.

View dmarion's full-sized avatar

Damjan Marion dmarion

  • Rijeka, Croatia
View GitHub Profile
#include <stdio.h>
#ifndef TSC_CLOCK_MHZ
#define TSC_CLOCK_MHZ 2500
#endif
#define TSC_N_MARKS 256
typedef struct
{
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/queue.h>
#include <unistd.h>
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_debug.h>
#!/bin/bash
CPU=$1
if ! [[ $CPU =~ ^[0-9]+$ ]] ; then
echo "Please specify CPU number"
exit
fi
watch -n 1 " \
#!/bin/bash
ask() {
local _ret=$1
read -p "$2 [$3]: " INPUT
if [ "$INPUT" == "" ] ; then
INPUT=$3
fi
eval "$_ret=$INPUT"
}
@dmarion
dmarion / vpp-py
Last active September 26, 2020 11:12
#!/bin/bash
VPP_ROOT=$(git rev-parse --show-toplevel)
PLATFORM=${PLATFORM:-"vpp"}
if [ "$1" == "-i" ] ; then
apt install -y python-dev
cd ${VPP_ROOT}
make -C build-root PLATFORM=${PLATFORM} TAG=${PLATFORM}_debug vpp-api-install
cd vpp-api/python
@dmarion
dmarion / vpp
Created January 14, 2016 15:17
vpp build wrapper script
#!/bin/bash
# load config if exists
[ -e $HOME/.vpp ] && source $HOME/.vpp
VPP_BUILD_ROOT=$(git rev-parse --show-toplevel)/build-root
VPP_CONFIG_DIR=${VPP_CONFIG_DIR:-${VPP_BUILD_ROOT}}
VPP_PLATFORM=${VPP_PLATFORM:-"vpp"}
VPP_VERBOSE=${VPP_VERBOSE:-"0"}
VPP_DPDK_VER=${VPP_DPDK_VER:-"default"}
@dmarion
dmarion / bootstrap-ubuntu-vm
Created June 9, 2015 21:28
bootstrap-ubuntu-vm
#!/bin/bash
ask() {
local _ret=$1
read -p "$2 [$3]: " INPUT
if [ "$INPUT" == "" ] ; then
INPUT=$3
fi
eval "$_ret=$INPUT"
}

Keybase proof

I hereby claim:

  • I am dmarion on github.
  • I am dmarion (https://keybase.io/dmarion) on keybase.
  • I have a public key whose fingerprint is 0219 F8B5 D48E C80C 0ADD AF56 D052 EE9D B6EE 8C8A

To claim this, I am signing this object:

@dmarion
dmarion / gist:9089885
Last active December 31, 2016 15:24
hexdump
void hexdump(uint8_t buffer[], int len)
{
#define HEXDUMP_LINE_LEN 16
int i;
char s[HEXDUMP_LINE_LEN+1];
bzero(s, HEXDUMP_LINE_LEN+1);
for(i=0; i < len; i++) {
if (!(i%HEXDUMP_LINE_LEN)) {
if (s[0])