Skip to content

Instantly share code, notes, and snippets.

View nyrahul's full-sized avatar
🐞

Rahul Jadhav nyrahul

🐞
  • AccuKnox
View GitHub Profile
@joestringer
joestringer / micro-k8s-setup.md
Last active April 20, 2021 17:06
MicroK8s development environment setup for Cilium

Set up microk8s with Cilium for development

Microk8s is a Canonical project to provide a kubernetes environment for local development, similar to minikube but without requiring a separate VM to manage. These instructions describe setting it up for common development use cases with Cilium and may be helpful in particular for testing BPF kernel extensions with Cilium.

Microk8s will run its own containerd runtime, which may be initially confusing when building containers locally with docker. This guide assumes that you will use docker locally for building containers, and push these into a microk8s registry for use by containerd in the microk8s environment.

This guide works with MicroK8s 1.14 or above, with containerd. If you are running an earlier version, see the previous instructions.

Requirements

#!/bin/bash
set -E
trap 'echo Failed line: $LINENO command: $BASH_COMMAND && exit $?' ERR
lcnt=1
nw_pref="192.168.10"
create_node()
{
ns="$1"; shift;
@nyrahul
nyrahul / writepcap.c
Last active March 15, 2023 14:33
Write a packet buffer to a file in pcap format without using pcap libs/hdrs.
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/time.h>
/*---------------------------------------------------------------------------*/
/* CITT CRC16 polynomial ^16 + ^12 + ^5 + 1 */
/*---------------------------------------------------------------------------*/
unsigned short crc16_add(unsigned char b, unsigned short acc)
{
@nyrahul
nyrahul / hyperthreading_ctl.sh
Created January 10, 2018 06:03
Enable/Disable hyperthreading & multicore on x86 machines with linux (ubuntu distro tested)
#!/bin/bash
trap byefunc EXIT
byefunc()
{
[[ "$NO_CPUINFO" == "1" ]] && return
lscpu
}