Skip to content

Instantly share code, notes, and snippets.

View songritk's full-sized avatar

Songrit Kitisriworapan songritk

View GitHub Profile
@songritk
songritk / 3-split-time.sh
Created August 1, 2017 11:19
print uniq data in time range
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage : $0 <time window> filename"
exit 1
fi
#file="40490f0d10a3-normalize-2.csv"
window=$1
file=$2
@songritk
songritk / 2-log-normalize.sh
Created August 1, 2017 11:21
convert Log time to unixtime
#!/bin/bash
if ! [ $# -eq 1 ];
then
echo "./log-normalize.sh <file>"
exit
fi
file=$1
NAME=`echo "$file" | cut -d'.' -f1`
#!/bin/bash
file=$1
if [ $# -ne 1 ]; then
echo "$0 "
exit 1
fi
grep "cli " $file|cut -d: -f6|sed 's/[//g;s/]//g'|cut -d/ -f1 |sed 's/ //g'> user.txt
#!/bin/bash
file=`cat user-2.txt`
for l in $file; do
grep $l radius.log-20161209 > data2/$l.txt
done
@songritk
songritk / math.sh
Created September 12, 2017 08:52
bash shell : trignometry
#!/bin/bash
#trignometry
sin ()
{
echo "scale=5;s($1*0.017453293)" | bc -l
}
cos ()
{
@songritk
songritk / mcs2xy.sh
Created September 12, 2017 08:54
Convert MCS to random approximate (X,Y) coordination
#!/bin/bash
. math.sh
if ! [ $# -eq 1 ]; then
echo "./mcs2xy.sh <mcs index>"
exit
fi
platform='unknown'
@songritk
songritk / a-dist.sh
Last active November 29, 2017 16:43
ทดสอบ rtt, mcs เมื่อเปิด AMC
#!/bin/bash
# Default Parameter
#Program Arguments:
# --staManager: PRC Manager of the STA [ns3::MinstrelHtWifiManager]
# --apManager: PRC Manager of the AP [ns3::MinstrelHtWifiManager]
# --shortGuardInterval: Enable Short Guard Interval in all stations [false]
# --channelWidth: Channel width of all the stations [20]
# --STmcs: STmcs index [0]
# --Rmcs: STmcs index [0]
@songritk
songritk / run11ac-rx.sh
Created January 8, 2018 07:55
ที่มาไฟล์ data-5-10-250.csv
#!/bin/bash
RNG="11"
RTx="5 10 15 20"
#RTx="16 17 18 19 20"
## Box1
sX=`seq 0 10 600`
sY=`seq 0 10 600`
rX="150 180 190 200 210 220 230 240 250 260 270"
rY="300"
@songritk
songritk / install-soapysdr.sh
Last active June 27, 2023 07:12
SoapySDR install script for raspberry PI
# Building CubicSDR for Linux
# This script will successfully build CubicSDR under Debian Jessie on the Raspberry Pi3.
# Adapted from https://github.com/cjcliffe/CubicSDR/wiki/Build-Linux
# Larry Dighera June 7, 2016
# [email protected]
# songritk Mar 24,2018
sudo apt-get install -y git build-essential automake cmake
sudo apt-get install -y libpulse-dev libgtk-3-dev
@songritk
songritk / server.py
Last active February 7, 2019 12:01
ตัวอย่าง server เปลี่ยนข้อความตัวอักษรเป็นตัวพิมพ์ใหญ่ สำหรับการเรียนวิชา Computer Networks, NPU Computer Engineer
#!/usr/bin/env python3
from socket import *
serverPort = 12002
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind(('', serverPort))
print ("The server is ready to receive")
while True:
message, clientAddress = serverSocket.recvfrom(2048)
modifiedMessage = message.decode().upper()
serverSocket.sendto(modifiedMessage.encode(), clientAddress)