Skip to content

Instantly share code, notes, and snippets.

View songritk's full-sized avatar

Songrit Kitisriworapan songritk

View GitHub Profile
@songritk
songritk / vht.cc
Created July 7, 2016 05:54
NS3 IEEE802.11AC simulator
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2015 SEBASTIEN DERONNE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@songritk
songritk / stat.R
Created July 8, 2016 02:40
คำนวนสถิติจากไฟล์ที่ได้หลังคำสั่ง stat-linux.sh
library(pastecs)
args <- commandArgs(TRUE)
h <- read.table(args[1], header=F,fill=T)
if (args[1] == 'ap-udp.txt'||args[1] == 'r0-udp.txt'||args[1] == 'r0-udp.txt'||args[1] == 'r1-udp.txt'||args[1] == 's-udp.txt') {
nUDP<-nrow(h)
sumDuration<-sum(h[1:nrow(h),4])
udpDurationStat<-stat.desc(h[1:nrow(h),4])
@songritk
songritk / stat-linux.sh
Created July 8, 2016 02:42
แปลง ข้อมูลจาก tshark
#!/bin/bash
FILENAME=$1
DIR=./utils
if [ $# -eq 0 ]
then
echo "./stat-linux.sh <pcap>"
exit
fi
tshark -Tfields -e wlan_radio.data_rate -e frame.len -Y'wlan.fc.type ==0' -r $FILENAME |awk '{print ($1*10**6),($2*8)}' > mgmt.txt
tshark -Tfields -e wlan_radio.data_rate -e frame.len -Y'wlan.fc.type==1' -r $FILENAME |awk '{print ($1*10**6),($2*8)}' > ctl.txt
@songritk
songritk / scbc_org.cc
Last active August 2, 2016 09:13
scbc
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 The Boeing Company
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@songritk
songritk / v4ping.cc
Last active November 16, 2016 05:25
v4ping.cc
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
#!/bin/bash
sha1=$1
if ! [ $# -eq 1 ]
then
echo "./revert-git.sh <commit HASH number>"
exit
fi
@songritk
songritk / third.cc
Created December 6, 2016 04:42
third.cc NS3 trace source example
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
#!/bin/bash
if ! [ $# -eq 1 ];
then
echo "./log-normalize.sh <file>"
exit
fi
file=$1
NAME=`echo "$file" | cut -d'.' -f1`
docker run -i -t thehajime/ns-3-dce
cd source/ns-3-dce
./waf --run dce-ping
@songritk
songritk / dce-ping.cc
Created March 30, 2017 09:53
DCE ping NS3
/*
* dce-ping.cc
*
* Created on: Mar 28, 2560 BE
* Author: songrit
*/
#include "ns3/network-module.h"
#include "ns3/core-module.h"
#include "ns3/internet-module.h"