Skip to content

Instantly share code, notes, and snippets.

View nizq's full-sized avatar
🎯
Focusing

nizq nizq

🎯
Focusing
View GitHub Profile
@rtbs-dev
rtbs-dev / pmml_bayesnet.ipynb
Last active March 24, 2023 16:43
Bayesian Network Models in PyMC3 and NetworkX
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@summerwind
summerwind / xdp_load_balancer.c
Last active January 30, 2023 15:04
XDP based load balancer with L3DSR support
#define KBUILD_MODNAME "load_balancer"
#include <uapi/linux/bpf.h>
#include <linux/in.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
BPF_HASH(counter, uint32_t, long);
@mattfield
mattfield / walker.clj
Created January 27, 2014 09:41
Clojure tree walker
(defn tree-searcher
"Parse through every node in a tree and check against
give matcher function. If a match succeeds, return the node.
If no match is found after all recursions, just return the tree.
Also see clojure.walk"
[zipper matcher]
(loop [loc zipper]
(if (zip/end? loc)
(zip/root loc)
(if-let [matcher-result (matcher (zip/node loc))]
@giannitedesco
giannitedesco / rxring.c
Created June 26, 2013 00:20
TPACKET_V3 mmap packet sockets, showing off flexible frame sizes and multi-process hash fanout
/* Copyright (c) 2013 Gianni Tedesco
* Released under the terms of the GNU GPL version 3
* mmap() packet socket transmission
*/
#ifndef __linux__
#error "Are you loco? This is Linux only!"
#endif
#include <stdio.h>
@timgluz
timgluz / output.clj
Last active December 16, 2015 20:39
Python Setup parser by using instaparser
(insta/parse parser "install_requires = ['argparse', 'requests>=1.1.0,<1.3.0', 'colorama>=0.9,!=1.1,!=1.2.1,<=1.4.1a3']")
[:PYTHON_SETUP_PARSER
"install_requires"
"="
"["
[:SEQ-OF-REQUIREMENT
[:REQUIREMENT "argparse"]
[:REQUIREMENT
"requests"
@emasaka
emasaka / ltsv.clj
Last active December 12, 2015 08:39
LTSV parser by Clojure
;; LTSV (Labeled Tab-separated Values) parser by Clojure
(use '[clojure.string :only [split]])
(defn ltsv-parse-line
"Parses one LTSV line. Returns a map."
[^String line]
(reduce (fn [r s] (let [[k v] (split s #":" 2)] (assoc r k v)))
{} (split line #"\t") ))
@karmi
karmi / nginx-elasticsearch-proxy.conf
Created May 23, 2011 08:16
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#