Skip to content

Instantly share code, notes, and snippets.

View aeppert's full-sized avatar

Aaron Eppert aeppert

View GitHub Profile
@aeppert
aeppert / af_packet_rx_ring.c
Created September 19, 2017 17:37 — forked from pavel-odintsov/af_packet_rx_ring.c
af_packet_rx_ring_habrahabr.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <sys/mman.h>
#include <poll.h>
#include <arpa/inet.h>
package main
import (
"encoding/json"
"fmt"
"net"
)
type netifs struct {
Addrs []string
package main
import (
"fmt"
"syscall"
)
func UtsArrayToStr(in []int8) string {
i, out := 0, make([]byte, 0, len(in))
for ; i < len(in); i++ {
@aeppert
aeppert / lsmod.go
Last active September 29, 2017 14:27
/ Aaron Eppert - 2017
// golang wrapper around libkmod with lsmod as an example
//
package main
/*
#cgo pkg-config: libkmod
#include <libkmod.h>
*/
import "C"
@aeppert
aeppert / hexdump.pac
Last active October 26, 2017 23:35
Hexdump in Binpac
%extern{
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <sstream>
%}
function dump_message(msg: const_bytestring): bool
%{
int i;
@aeppert
aeppert / itimer_test.c
Created October 12, 2017 20:13
ITIMER with sigaction example
#include <stdio.h>
#include <signal.h>
#include <sys/time.h>
static volatile sig_atomic_t g_called;
void g(int sig)
{
g_called += 1;
printf("g called - %d times\n", g_called);
@aeppert
aeppert / librdkafka_rrpart.cc
Last active April 12, 2018 16:49
librdkafka round-robin partitioner
class RRPartitionerCb : public RdKafka::PartitionerCb {
public:
RRPartitionerCb() { partition = 0; }
int32_t partitioner_cb(const RdKafka::Topic *topic,
const std::string *key,
int32_t partition_cnt,
void *msg_opaque) {
if((partition+1) > (partition_cnt-1)) {
partition = 0;
return partition;
Name: jemalloc
Version: 5.1.0
Release: 3%{?dist}
Summary: General-purpose scalable concurrent malloc implementation
Group: System Environment/Libraries
License: BSD
URL: http://www.canonware.com/jemalloc/
Source0: https://github.com/jemalloc/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2
@aeppert
aeppert / jemalloc.spec
Created January 10, 2019 21:04
jemalloc 5.0.X RPM Spec
Name: jemalloc
Version: 5.1.0
Release: 3%{?dist}
Summary: General-purpose scalable concurrent malloc implementation
Group: System Environment/Libraries
License: BSD
URL: http://www.canonware.com/jemalloc/
Source0: https://github.com/jemalloc/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2
@aeppert
aeppert / send_to_slack.go
Created February 4, 2019 16:11
Send a message to Slack
package main
import (
"os"
"fmt"
"github.com/bluele/slack"
)
var (
Version string
Build string