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
@pavel-odintsov
pavel-odintsov / qxp.pm
Created October 7, 2014 04:19
qxp.pm by white dragon
package qxp;
use strict;
# https://code.google.com/p/qxp/
sub H($){pack'H*',$_[0]}
sub by{map{[splice@_,1,$_[0]]}!($#_%$_[0])..$#_/$_[0]}
sub is($){$_ eq$_[0]}
sub cat{join'',@_}
sub list{@_}
@pavel-odintsov
pavel-odintsov / ripe_atlas_traceroute_printer.pl
Last active August 29, 2015 14:16
RIPE atlas converter from JSON to native traceroute output
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Net::DNS::Resolver;
use List::Util qw(sum);
use lib "/opt/local/lib/perl5/vendor_perl/5.16.3";
@pavel-odintsov
pavel-odintsov / memory_eater_ng.c
Last active August 29, 2015 14:19
memory_eater_ng.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Author: pavel.odintsov@gmail.com at FastVPS Eesti OU
// License: GPLv2
// This script allocate huge block of memory and fill it with random crap
// It's useful for checking kdump or ISP's with memory oversell :)
// Compilation: gcc memory_eater_ng.c -omemory_eater_ng
package qxp;
use strict;
# code from: https://code.google.com/p/qxp/source/browse/qxp/qxp.pm
sub H($){pack'H*',$_[0]}
sub by{map{[splice@_,1,$_[0]]}!($#_%$_[0])..$#_/$_[0]}
sub is($){$_ eq$_[0]}
sub cat{join'',@_}
sub list{@_}
@pavel-odintsov
pavel-odintsov / get_abuse_email.py
Last active August 29, 2015 16:59
Get abuse email for subnet
#!/usr/bin/python
import json
import urllib2
import sys
import pprint
if len(sys.argv) != 2:
sys.exit("Please provide params");
@pavel-odintsov
pavel-odintsov / pps.sh
Created November 3, 2015 11:41 — forked from evgenypim/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
@pavel-odintsov
pavel-odintsov / gist:7252183
Created October 31, 2013 15:58
Script for scanning files loaded in memory
#/usr/bin/perl
# Author Pavel Odintsov
# pavel.odintsov@gmail.com
use strict;
use warnings;
opendir my $dir, '/proc' or die "Can't open procfs";
diff -Nraup ixgbe-linux-netmap/ixgbe-3.23.2.1/src/ixgbe_main.c ixgbe-linux-netmap-single-queue/ixgbe-3.23.2.1/src/ixgbe_main.c
--- ixgbe-linux-netmap/ixgbe-3.23.2.1/src/ixgbe_main.c 2015-06-20 14:23:38.457783634 +0100
+++ ixgbe-linux-netmap-single-queue/ixgbe-3.23.2.1/src/ixgbe_main.c 2015-06-20 14:23:31.330496612 +0100
@@ -686,6 +686,7 @@ static bool ixgbe_clean_tx_irq(struct ix
if (test_bit(__IXGBE_DOWN, &adapter->state))
return true;
+ if (tx_ring->queue_index == 0) {
#ifdef DEV_NETMAP
/*
#!/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
@pavel-odintsov
pavel-odintsov / irq_balance_manually.sh
Created June 1, 2015 11:47
irq_balance_manually.sh
#!/bin/bash
# from http://habrahabr.ru/post/108240/
ncpus=`grep -ciw ^processor /proc/cpuinfo`
test "$ncpus" -gt 1 || exit 1
n=0
for irq in `cat /proc/interrupts | grep eth | awk '{print $1}' | sed s/\://g`
do
f="/proc/irq/$irq/smp_affinity"