Skip to content

Instantly share code, notes, and snippets.

Avatar
💡
Working on new things to improve The Internet!

Pavel Odintsov pavel-odintsov

💡
Working on new things to improve The Internet!
View GitHub Profile
@pavel-odintsov
pavel-odintsov / vimrc
Last active Apr 22, 2019
vimrc_odintsov
View vimrc
"
" First of all, pleae install Neobundle: mkdir -p ~/.vim/bundle
" git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
"
" Fix arrow keys that display A B C D on remote shell:
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
@pavel-odintsov
pavel-odintsov / pps.sh
Created Nov 3, 2015 — forked from evgenypim/pps.sh
pps.sh for habrahabr
View pps.sh
#!/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
View qxp.pm
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{@_}
View irq_balance_habrahabr.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"
@pavel-odintsov
pavel-odintsov / pps.sh
Last active Feb 21, 2021
pps.sh for habrahabr
View pps.sh
#!/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 / af_packet_rx_ring.c
Last active May 25, 2021
af_packet_rx_ring_habrahabr.c
View af_packet_rx_ring.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <sys/mman.h>
#include <poll.h>
#include <arpa/inet.h>
@pavel-odintsov
pavel-odintsov / af_packet_classic.c
Last active Feb 24, 2021
af_packet_classic_habrahabr
View af_packet_classic.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <arpa/inet.h>
#include <sys/socket.h>
View ixgbe-single-queue.diff
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
/*
View 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"
@pavel-odintsov
pavel-odintsov / get_abuse_email.py
Last active Aug 29, 2015
Get abuse email for subnet
View get_abuse_email.py
#!/usr/bin/python
import json
import urllib2
import sys
import pprint
if len(sys.argv) != 2:
sys.exit("Please provide params");