Skip to content

Instantly share code, notes, and snippets.

View dmarion's full-sized avatar

Damjan Marion dmarion

  • Rijeka, Croatia
View GitHub Profile

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 / 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"
}
#!/bin/bash
ask() {
local _ret=$1
read -p "$2 [$3]: " INPUT
if [ "$INPUT" == "" ] ; then
INPUT=$3
fi
eval "$_ret=$INPUT"
}
#!/bin/bash
CPU=$1
if ! [[ $CPU =~ ^[0-9]+$ ]] ; then
echo "Please specify CPU number"
exit
fi
watch -n 1 " \
@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])
#include <stdio.h>
#ifndef TSC_CLOCK_MHZ
#define TSC_CLOCK_MHZ 2500
#endif
#define TSC_N_MARKS 256
typedef struct
{
#include <tscmarks.h>
#include <vppinfra/bihash_24_8.h>
#include <vppinfra/bihash_template.h>
#include <vppinfra/mem.h>
#include <vppinfra/bihash_template.c>
#define NUM_BUCKETS (1 << 24)
#define N_ELTS (100 * 1000 * 1000)
#define MEM_SIZE (16ULL << 30)
#!/bin/bash
if [ ! -d boot ] ; then
PKG=$(apt-cache depends -i linux-image-kvm | grep Depends: | cut -d: -f2)
apt-get download ${PKG}
dpkg --fsys-tarfile ${PKG}_*.deb | tar xvf - ./boot
echo $PKG
fi
TESTPMD_BIN=${HOME}/src/dpdk/x86_64-native-linuxapp-gcc/app/testpmd
@dmarion
dmarion / vppinc.h
Created March 27, 2019 08:14
vppinc.h
#include <x86intrin.h>
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
#define _(x) __attribute__((vector_size (x)))
typedef u8 u8x32 _(32);
typedef u16 u16x16 _(32);
@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"}