Skip to content

Instantly share code, notes, and snippets.

View pavel-odintsov's full-sized avatar
🛡️
On mission to deliver affordable DDoS protection

Pavel Odintsov pavel-odintsov

🛡️
On mission to deliver affordable DDoS protection
View GitHub Profile
@MrPeanutButta
MrPeanutButta / bit_flip.c
Created May 1, 2013 22:40
useful bitflip. designing software DIR-24-8-basic.
/*
* for use with software DIR-24-8-basic.
* personal implementation.
*/
void flip_state(uint32_t &prefix, uint8_t &position){
prefix = prefix ^ 1<<position;
}
@hiroyuki-sato
hiroyuki-sato / gist:201032fe75d2cf9f5801
Last active October 27, 2022 16:13
Build VyOS image image on Debian Jessie environment.

Overview

Build VyOS image image on Debian Jessie environment.

Install Debian jessie

Install Debian jessie.

@falzm
falzm / commonlog2iso8601.go
Created November 2, 2014 16:42
Convert Nginx' "time_local" to "time_iso8601" date formats
package main
import "fmt"
import "time"
func main() {
commonlogDateFormat := "2/Jan/2006:15:04:05 -0700"
iso8601DateFormat := "2006-01-02T15:04:05-07:00"
parsedDate, err := time.Parse(commonlogDateFormat, "18/Oct/2014:08:53:14 +0200")
@jpillora
jpillora / sshd.go
Last active December 17, 2023 16:27
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@benagricola
benagricola / comm.lua
Created May 21, 2015 21:49
BGP extended community number decoding - Python vs. Lua
#!/usr/bin/env tarantool
local pickle = require('pickle')
local denumerate = function(num)
local bin = ''
while num > 0 do
local char = num % 256
num = num - char
num = num / 256
bin = string.char(char) .. bin
@lukego
lukego / README.md
Last active February 21, 2021 14:39
Example using snsh (snabb shell) to feed packets to a C program

This is a simple example of a low-level script that uses the Snabb Switch 82599 10G ethernet device driver directly to feed packets into a C function provided as a shared library. Written for a discussion with Pavel Odintsov.

Here is now to run it:

  1. Compile snabbswitch to get snabb executable.
  2. Compile a C callback function to a shared library e.g. capturecallback.c below.
  3. Run: sudo ./snabb snsh capture2c <pciaddress> <filename.so>

The output should look something like this:

@evgenypim
evgenypim / pps.sh
Last active November 3, 2015 11:41 — forked from pavel-odintsov/pps.sh
pps.sh for habrahabr
#!/bin/bash
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo
@cben
cben / CF-CNAME-flattened-TTL.md
Created September 10, 2015 20:46
The problem with CloudFlare's DNS "CNAME flattening" TTL

[attaching this to a CloudFlare survey why I left them (for DNSimple)]

I was a free user using CloudFlare only for DNS, chiefly because it can simulate CNAME at an apex domain. The apex domains mathdown.net,mathdown.com point to mathdown-cben.rhcloud.com. Cloudflare "CNAME-flattening" nicely returns an A record; unfortunately it's served with a huge TTL of 7 days(!), which causes a long outage when the underlying IP changes.

I asked support how I can lower the TTL (BTW it's great that you provide free support at all) and was told [https://support.cloudflare.com/hc/en-us/requests/522551, emphasis mine]:

This is based on the TTL of your authoritative provider for mathdown-cben.rhcloud.com:

@narutaro
narutaro / netflow_generator_hands_on.md
Last active September 1, 2021 03:17
Comparing NetFlow generators

Comparing NetFlow generators

Sharing my hands-on experience on some of the free NetFlow generators. I use Paessler NetFlow Generator for quick test, Flowalyzer™ NetFlow Generator for complicated flow creation and flowgen for automated performance testing.

Screenshot:

image

Pros:

@avafloww
avafloww / PhpJava.java
Last active October 16, 2022 18:50
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();