Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
A='192.168.10.184'
B='192.168.10.158'
C='192.168.10.142'
R='192.168.20.2'
S='192.168.20.1'
echo "usage on machine A: sh pingall.sh 'A'"
me=$1
@shahifaqeer
shahifaqeer / FlowQoS
Last active January 4, 2016 03:59
evaluation of flowqos delay
{
"metadata": {
"name": "FlowQoS_evaluation"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
#opkg install ip tc kmod-sched
INTERFACE=$1
RATELIMIT=$2
RATECEIL=$3
#insmod sch_netem
#insmod sch_tbf
#insmod sch_htb
#insmod sch_prio
@shahifaqeer
shahifaqeer / epsilon_fig
Created February 28, 2014 19:04
abhinav's box plot
from __future__ import division
import pandas as pd
import decimal
data = {'x': [27, 32, 32, 42, 42, 42, 47, 47,47,47,47, 51, 57,57,57,57,57, 62,62,62,62,62,62,62,62],
'y': [48, 62, 36.7, 60, 38.4, 67, 62.4, 12.5, 54, 62, 105.9, NaN, 63.8, 66, 66.2, 58.6, 112.3, 50, 91, 49.9, 62.3, 71.6, 104.6, 122.6, 110.1]}
df = pd.DataFrame(data)
tick = ['26-30', '31-35', '40-45', '46-50', '51-55', '56-60', '61-65']
def process_wtf(scene, datapath, outputpath):
link = scene[-6:-4]
if link != 'no':
srcip = ip[link[0]]
if scene[-1] != '/':
scene = scene + '/'
if not os.path.exists(outputpath + scene + "processed"):
os.makedirs(outputpath + scene + "processed")
def process_wtf(scene, datapath, outputpath):
link = scene[-6:-4]
if link != 'no':
srcip = ip[link[0]]
if scene[-1] != '/':
scene = scene + '/'
if not os.path.exists(outputpath + scene + "processed"):
os.makedirs(outputpath + scene + "processed")
@shahifaqeer
shahifaqeer / uci-ssh-open
Created May 12, 2014 07:27
Openwrt: ssh through wan port
uci add firewall rule
uci set firewall.@rule[-1].src=wan
uci set firewall.@rule[-1].target=ACCEPT
uci set firewall.@rule[-1].proto=tcp
uci set firewall.@rule[-1].dest_port=22
uci commit firewall
/etc/init.d/firewall restart
@shahifaqeer
shahifaqeer / ratelimit3.sh
Last active August 29, 2015 14:02
testbed ratelimitor - added delay (latency ms)
interface=$1
down_rate=$2 # "mbps", Megabytes per second
#HZ=$(grep 'CONFIG_HZ=' /boot/config-$(uname -r) | sed 's/CONFIG_HZ=//')
HZ=100 #not sure
down_burst=$(((($down_rate * 1000000) / $HZ)/1000)) # "kb", Kilobytes ; a minimum value should be _at least_ one packet, ~2kb, though it is safer with 10kb
down_limit=$(((($down_rate * 1000000) / $HZ)/1000)) # "kb", Kilobytes ; a minimum value should be _at least_ one packet, ~2kb, though it issafer with 10kb
# first
tc qdisc del dev $interface root
# add as queueing discipline on eth0 at root
# the qdisc is prio (man tc-prio) with two different priority (bands) labeled from 0 to 1 (from 0 to ["bands #" - 1])
sudo -i
groupadd pcap
usermod -a -G pcap gtnoise
chgrp pcap /usr/sbin/tcpdump
chmod 750 /usr/sbin/tcpdump
setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump
ln -s /usr/sbin/tcpdump /usr/local/bin/tcpdump
echo "file_caps=1" >> /boot/grub/menu.lst
clients [192.168.10.*] -- [192.168.10.1] gateway [10.0.2.2] -- [10.0.2.1] magellan [10.0.1.2] -- [10.0.1.1] router [10.0.0.2] -- [10.0.0.1] server [130.207.97.74] -- [*] Internet
magellan:/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback