Skip to content

Instantly share code, notes, and snippets.

@richardhsu
richardhsu / iperf.sh
Last active September 24, 2023 05:25
IPerf to send specific number of packets per second.
#!/bin/bash
PORT=50000
TIME=60
print_usage () {
echo "Usage: ./iperf.sh [-s|-c destination] [-h] [-p port] [-t time] -k total_packets_per_sec"
echo " -h|--help : Print usage."
echo " -s : Server mode which receives the data."
echo " -c : Client mode which sends the data. Requires destination."
@racerxdl
racerxdl / measure.py
Created September 18, 2014 06:07
Linux Network Traffic Measure/Calculator Python Script
#!/usr/bin/env python
'''
_______ ______
|_ _\ \ / / ___|
| | \ \ / /\___ \
| | \ V / ___) |
|_| \_/ |____/
Teske Virtual System
@cnelson
cnelson / procnetdev.py
Last active February 27, 2024 14:45
Parses /proc/net/dev into a usable python datastructure
from datetime import datetime
class ProcNetDev(object):
"""Parses /proc/net/dev into a usable python datastructure.
By default each time you access the structure, /proc/net/dev is re-read
and parsed so data is always current.
If you want to disable this feature, pass auto_update=False to the constructor.
@justintv
justintv / .bashrc
Created August 17, 2009 00:53
Display git branch in bash prompt
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"