Skip to content

Instantly share code, notes, and snippets.


Sander sanderfoobar

View GitHub Profile
# Authors: Ingmar Steen / Sander Ferdinand
from twisted.internet import defer, task
from twisted.web.http_headers import Headers
from treq import text_content, request
class HttpPool(object):
def __init__(self):
self._sem = defer.DeferredSemaphore(20) # no more than 20 at once
sanderfoobar /
Last active Apr 20, 2018
Convert ASN to IPv4 list
# one-liner to convert ASN to ip addresses. Results will be appended to `ips.out`. | 1-7-2017
# requires: apt-get install prips
for asn in AS51468 AS37061 AS198810 AS39513;
do $(for range in $(echo $(whois -h -- "-i origin $asn" | grep -Eo "([0-9.]+){4}/[0-9]+") | sed ':a;N;$!ba;s/\n/ /g');
do prips $range >> ips.out;
sanderfoobar /
Created Jan 7, 2017
Paste screenshot from terminal with scrot, python-requests, libnotify, xclip
# Paste a screenshot taken with `scrot` to Resulting link will be copied to clipboard.
# requires: python-requests, scrot, xclip, libnotify-bin, libnotify-dev
echo $(scrot -s -e 'printf $f |
python -c "\$\(echo aW1wb3J0IHN5cztpbXBvcnQgcmVxdWVzdHM7YmFzZV91cmkgPSAiaHR0cHM6Ly9wYXN0ZS5jZWRzeXMubmwiO2ZpbGVzID0geyJmaWxlc1tdIjogb3BlbihzeXMuc3RkaW4ucmVhZCgpKX07ciA9IHJlcXVlc3RzLnBvc3QoIiVzL3Bhc3RlIiAlIGJhc2VfdXJpLCBmaWxlcz1maWxlcyk7c3lzLnN0ZG91dC53cml0ZSgiJXMlcy9yYXciICUgKGJhc2VfdXJpLCByLmpzb24oKVsidXJpIl0pKQ==
| base64 -d\)" && mv $f ~/screenshots') |
xclip -selection clipboard &&
notify-send -t 1000 $(echo "Pasted (clipboard)")
sanderfoobar /
Last active Feb 25, 2017
the type hints police is out to get you
import inspect
from functools import wraps
__author__ = "Sander Ferdinand"
__credits__ = "Joe Jevnik"
__date__ = 2017
def type_police(f):
import json
from sqlalchemy import inspect as sqla_inspect
from sqlalchemy.orm.dependency import OneToManyDP, ManyToOneDP
from sqlalchemy.exc import NoInspectionAvailable
from sqlalchemy.orm.mapper import Mapper
from sqlalchemy import Column, String, Integer, create_engine, ForeignKey, inspect
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
ngrep -i '[&\s?](?:login|cookie|user(?:name|)|p(ass(?:word|wd|)|w|wd))[\s:=]\s?([^&\s]*)' -deth0 -qt -W byline port 80
import sys
import os
from random import shuffle
from collections import OrderedDict
if not sys.version_info >= (3, 0):
print("python3 only")
ssh -p 22 sudo tcpdump -i xxxx -U -w - not port 5900 | wireshark -i - -k
sanderfoobar /
Last active Jun 30, 2019
Monero RPC node bandwidth monitoring

In this document, $YOUR_IP refers to your public ip address.

Keeping track of bandwidth for Monero RPC nodes

First, we must make a clear distinction between RPC traffic and P2P traffic. As a node operator you might think "wow my node is doing so much traffic WTF where are all these bytes coming from and going to". Well, this is actually due to your P2P port being exposed, which is port 18080. This document does not cover the monitoring of P2P traffic. This document is specifically for the RPC port which runs on 18081 (or 18089).

As Monero RPC traffic is HTTP, we can use nginx to reverse proxy and record bandwidth passing through. This implies that monerod's RPC port stays on localhost

Where normally we would use:


Keybase proof

I hereby claim:

  • I am xmrdsc on github.
  • I am xmrdsc ( on keybase.
  • I have a public key whose fingerprint is 2862 2D20 C1CA 773F EED0 C8EC E29D FFCD D83E 51A6

To claim this, I am signing this object: