Skip to content

Instantly share code, notes, and snippets.

View ardhipoetra's full-sized avatar

Ardhi Putra Pratama ardhipoetra

  • TU Dresden
  • Germany
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ardhipoetra on github.
  • I am ardhipoetra (https://keybase.io/ardhipoetra) on keybase.
  • I have a public key whose fingerprint is 7EB6 7879 CB8E 3488 D1EA 070D 4A7A C448 C4F0 FF97

To claim this, I am signing this object:

def test_save_resume(self):
def do_test():
tdef = TorrentDef()
sourcefn = os.path.join(TESTS_DATA_DIR, 'video.avi')
tdef.add_content(sourcefn)
tdef.set_tracker("http://localhost/announce")
tdef.finalize()
torrentfn = os.path.join(self.session.get_state_dir(), "gen.torrent")
tdef.save(torrentfn)
@ardhipoetra
ardhipoetra / pdht_run_dht.py
Created April 11, 2016 09:55
Test get_peers on pymdht
import sys
import logging
import time
sys.path.append('/home/ardhipoetra/git/thesis/tribler/Tribler/Core/DecentralizedTracking')
from pymdht.core.pymdht import Pymdht as DHT
from pymdht.core.node import Node
from pymdht.plugins import lookup_a4
from pymdht.plugins import routing_nice_rtt
from pymdht.core import exp_plugin_template
@ardhipoetra
ardhipoetra / lt_dht_110.py
Last active April 18, 2016 09:50
DHT test on libtorrent-python binding
import libtorrent as lt
import time
infohash_str = "5aec5ee9f2d044316fe1de29d221452103ceb958"
print "version : %s" %lt.version
print "start session"
ses = lt.session()
ses.listen_on(6881, 6891)
@ardhipoetra
ardhipoetra / dht-walkthrough.md
Created March 29, 2016 13:48 — forked from thomas-yuan/dht-walkthrough.md
DHT walkthrough notes

DHT Walkthrough Notes

I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.

What problem does this solve?

400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros. The number of atoms in the universe is estimated to be around 10^82. A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48

@ardhipoetra
ardhipoetra / lt_test.py
Last active March 29, 2016 10:03
Libtorrent python binding - get peer demo
import libtorrent as lt
import time
import pprint
import sys
def create_peerlist_data(peer_info):
peer_dict = {}
peer_dict['id'] = peer_info.pid
peer_dict['extended_version'] = peer_info.client