Skip to content

Instantly share code, notes, and snippets.

DRiKE / nginx_access_to_as.rb
Last active Oct 29, 2015
Small script to parse nginx access log file, and find out from what organisation (AS) was visiting your website
View nginx_access_to_as.rb
#!/usr/bin/env ruby
require 'teamcymru'
require 'ipaddr'
c =
ips =
ARGF.each do |line|
ip =[0])
DRiKE / simplesix.c
Created Nov 5, 2015
Minimal example of extracting the IPv6 Flow Label from IPv6 packets
View simplesix.c
#include <stdio.h>
#include <pcap.h>
#include <arpa/inet.h>
#include <linux/if_ether.h>
#include <netinet/ip6.h>
#define SNAP_LEN 1500
int main(int argc, char *argv[]) {
DRiKE / brightd.service
Created Mar 19, 2013
brightd systemd .service file
View brightd.service
Description=Brightd brightness daemon
ExecStart=/usr/sbin/brightd -d -x -w 6
Created Feb 25, 2012
Dutch translation for RailsAdmin
# Localization file for Dutch.
# Translated from the English locale by Luuk Hendriks (DRiKE on github), used the date and datetime
# from
# credits for those sections to Ariejan de Vroom and Floris Huetink
name: Home
DRiKE / goldencheetah-3.5.1710.ebuild
Created Dec 24, 2017
GoldenCheetah Gentoo ebuild, v3.5-DEV1710
View goldencheetah-3.5.1710.ebuild
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
inherit qmake-utils
inherit versionator
MY_PV=$(replace_version_separator 2 '-DEV')
View xdpblog1-1_xdp_dns_says_no.c
int xdp_dns_says_no(struct xdp_md *ctx)
struct cursor c;
struct ethhdr *eth;
uint16_t eth_proto;
struct iphdr *ipv4;
struct ipv6hdr *ipv6;
cursor_init(&c, ctx);
DRiKE / xdp1-4-dns_qrr.c
Created Jul 16, 2020
XDP blog, post 1 gist 4
View xdp1-4-dns_qrr.c
struct dns_qrr {
uint16_t qtype;
uint16_t qclass;
struct dns_rr {
uint16_t type;
uint16_t class;
uint32_t ttl;
uint16_t rdata_len;
DRiKE / xdp1-5-udp_dns_reply.c
Last active Jul 16, 2020
XDP blog, post 1 gist 5
View xdp1-5-udp_dns_reply.c
static __always_inline
int udp_dns_reply(struct cursor *c)
struct udphdr *udp;
struct dnshdr *dns;
if (!(udp = parse_udphdr(c))|| udp->dest != __bpf_htons(DNS_PORT)
|| !(dns = parse_dnshdr(c)))
return -1;
View xdp1-6-udp_dns_reply-part2.c
// continuing:
if (dns->arcount) {
struct dns_rr *opt_rr;
uint8_t *opt_owner = c->pos;
opt_owner = c->pos;
if (++c->pos > c->end || *opt_owner
|| !(opt_rr = parse_dns_rr(c))
|| opt_rr->type != __bpf_htons(RR_TYPE_OPT))
DRiKE / xdp1-7-dns_says_no_final.c
Created Jul 16, 2020
XDP blog, post 1 gist 7
View xdp1-7-dns_says_no_final.c
static __always_inline
void csum_remove_data(uint32_t *csum, struct cursor *c, uint16_t len)
if (c->pos + len <= c->end) {
*csum = bpf_csum_diff(c->pos, len, 0, 0, *csum);
c->pos += len;
int xdp_dns_says_no(struct xdp_md *ctx)