Skip to content

Instantly share code, notes, and snippets.

View DavadDi's full-sized avatar

DavadDi DavadDi

View GitHub Profile
DavadDi /
Created February 17, 2022 12:14 — forked from jasonkarns/
Git send-email using Gmail
  1. Configure git.
# ~/.config/git/config
  confirm = auto
  smtpServer =
  smtpServerPort = 587
  smtpEncryption = tls
  smtpUser = <gmail email address>
DavadDi / sync-projects
Created September 27, 2021 07:42 — forked from JonasGroeger/sync-projects
Gitlab: Clone / Pull all projects in a group
#!/usr/bin/env bash
# Documentation
PROJECT_PROJECTION="{ "path": .path, "git": .ssh_url_to_repo }"
// hijack.c
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/module.h> /* Specifically, a module */
#include <linux/proc_fs.h> /* Necessary because we use the proc fs */
#include <asm/uaccess.h> /* for copy_from_user */
#include <linux/fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/kallsyms.h>
#include <linux/cpu.h>
DavadDi /
Created November 27, 2020 02:02 — forked from theojulienne/
ICMP packet tracer using BCC
bpf_text = """
#include <linux/ptrace.h>
#include <linux/sched.h> /* For TASK_COMM_LEN */
#include <linux/icmp.h>
#include <linux/netdevice.h>
struct probe_icmp_data_t
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# author: guiu
# data: 2020.2.28
import requests
import json
import mimetypes
import argparse
import sys
Copyright (c) 2016, Nitin Gode
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
DavadDi / skbtracer.c
Created August 10, 2020 04:23 — forked from chendotjs/skbtracer.c
#include <bcc/proto.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/ipv6.h>
#include <uapi/linux/icmp.h>
#include <uapi/linux/tcp.h>
#include <uapi/linux/udp.h>
#include <uapi/linux/icmpv6.h>
#include <net/inet_sock.h>
#include <linux/netfilter/x_tables.h>
apiVersion: extensions/v1beta1
kind: Ingress
annotations: '[{"addresses":[""],"port":80,"protocol":"HTTP","serviceName":"qtt-infra-dev:adcoder","ingressName":"qtt-infra-dev:ingress-weight-test","hostname":"","path":"/version","allNodes":false},{"addresses":[""],"port":80,"protocol":"HTTP","serviceName":"qtt-infra-dev:adcoder-test","ingressName":"qtt-infra-dev:ingress-weight-test","hostname":"","path":"/version","allNodes":false}]' 'adcoder: 200, adcoder-test: 200'
creationTimestamp: 2019-09-02T12:07:10Z
generation: 1
name: ingress-weight-test
namespace: qtt-infra-dev
DavadDi / nginx.conf
Created September 13, 2019 14:02
ingress nginx example
# Configuration checksum: 15488413709381799850
# setup custom paths that do not require root access
pid /tmp/;
load_module /etc/nginx/modules/;
daemon off;
local ngx_balancer = require("ngx.balancer")
local cjson = require("")
local util = require("util")
local dns_util = require("util.dns")
local configuration = require("configuration")
local round_robin = require("balancer.round_robin")
local chash = require("balancer.chash")
local chashsubset = require("balancer.chashsubset")
local sticky = require("balancer.sticky")