Skip to content

Instantly share code, notes, and snippets.

View maesoser's full-sized avatar
:shipit:

Sergio maesoser

:shipit:
View GitHub Profile
@maesoser
maesoser / iperf-client.sh
Created April 5, 2019 14:15
Iperf scripts designed to perform throughput tests on ovs.
#!/bin/bash
# Run multiple parallel instances of iperf client
# Assumes iperf servers have been started, e.g.
# iperf -s -p PORT
# Examples:
# Run 5 clients for 60 seconds to server 1.1.1.1
# iperf-multiple-clients 1.1.1.1 5 60 report
# 5 files will be created, report-1.1.1.1-5001-60.txt, ...
#
# Run 7 clients for 20 seconds with UDP
@maesoser
maesoser / config
Created April 9, 2019 21:17
I3 config files
set $mod Mod4
font pango:monospace 9
#font pango:DejaVu Sans Mono 8
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
@maesoser
maesoser / tmux.conf
Created April 17, 2019 21:38
Tmux configuration
set -g history-limit 4096
setw -g monitor-activity on
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# THEME
set -g status-bg black
package main
import (
"crypto/ecdsa"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/crypto"
"io/ioutil"
"math/big"
"net/http"
@maesoser
maesoser / ntop.sh
Last active August 12, 2019 09:13
Net interfaces throughput top written in bash
#!/usr/bin/env bash
INTERVAL=5
NETPATH="/sys/class/net"
RX1_ARR=()
TX1_ARR=()
RX2_ARR=()
TX2_ARR=()
while true; do
@maesoser
maesoser / pihole_exporter
Created May 18, 2019 09:00
Simple pihole exporter which makes use of prometheus node_exporter textfile collector
#!/usr/bin/env bash
EXPORT_FILE="/tmp/pihole.prom"
OUT=$(curl -s http://127.0.0.1/admin/api.php?summaryRaw | sed -e 's/\"//g')
DNS_DOMAINS_BEING_BLOCKED=$(echo "$OUT" | cut -d, -f1 | cut -d: -f2)
DNS_TOTAL=$(echo "$OUT" | cut -d, -f2 | cut -d: -f2)
DNS_BLOCKED=$(echo "$OUT" | cut -d, -f3 | cut -d: -f2)
DNS_ADS_PCNT=$(echo "$OUT" | cut -d, -f4 | cut -d: -f2)
@maesoser
maesoser / ping_exporter
Created May 18, 2019 09:12
Simple ping exporter that makes uses of prometheus node_exporter textfile collector
#!/usr/bin/env bash
do_ping () {
local EXPORT_FILE="/tmp/ping_$1.prom"
local OUT=$(ping -nq -c $2 $1)
local ICMP_SENT=$(echo "$OUT" | grep "packets" | awk '{print $1}')
local ICMP_RECV=$(echo "$OUT" | grep "packets" | awk '{print $4}')
local ICMP_MIN=$(echo "$OUT" | grep "avg" | awk '{print $4}' | cut -d/ -f1)
#!/usr/bin/env bash
function myecho() {
mytime=$( date -u +"%y-%m-%dT%H:%M:%SZ" )
echo "$mytime $1" |tee -a $logpath
}
target="8.8.8.8"
size="1"
interval="1"
@maesoser
maesoser / snmp.py
Last active October 14, 2019 10:31
Wrapper to pysnmp library to easily perform SNMP GET requests.
from pysnmp import hlapi
import argparse
def construct_object_types(list_of_oids):
object_types = []
for oid in list_of_oids:
object_types.append(hlapi.ObjectType(hlapi.ObjectIdentity(oid)))
return object_types
def construct_value_pairs(list_of_pairs):
@maesoser
maesoser / pasarela.go
Created December 13, 2019 08:29
HTTP Proxy client written in go
package main
import (
"bufio"
"fmt"
"io"
"net"
"os"
"strings"
)