Skip to content

Instantly share code, notes, and snippets.

Murilo Ijanc murilobsd

Block or report user

Report or block murilobsd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dht-walkthrough.md

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

@murilobsd
murilobsd / tg_bot.py
Created Jul 3, 2018
Telegram Bot example
View tg_bot.py
#!/usr/bin/env python
from __future__ import print_function
import datetime
import os
import random
import re
import time
import telepot
View tjsp.py
"""Simples script para baixar imagens do captcha do portal TJSP.
Copyright (c) 2016, Murilo Ijanc
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
View mongoauthplugin.py
import asyncio
from bson import ObjectId
class MongoAuthPlugin(BaseAuthPlugin):
def __init__(self, context):
super().__init__(context)
self._db = db
@asyncio.coroutine
View botpolitico.py
#!/usr/bin/env python
# coding=utf-8
import urllib2
import argparse
import facebook
import time
import random
import re
from lxml import html
@murilobsd
murilobsd / consulta
Last active Aug 29, 2015
consulta juristec
View consulta
<?xml version="1.0" encoding="utf-8"?>
<!-- ***************************************************-->
<!-- *** Schema juristec XML ***-->
<!-- *** Lab804 http://www.lab804.com.br ***-->
<!-- ***************************************************-->
<IRQL>
<script/>
<header>
<statistics>
<irqlDuration>00:00:00</irqlDuration>
View teste_form_cycle.py
class CyclePostTest(TestCase):
def setUp(self):
user = User.objects.create_user('murilo', 'murilo@murilo.com', 'murilo')
farm = Farm.objects.create(user=user, name='teste', full_area='123.45', uncultivated_area='0.00')
self.client.login(username='murilo', password='murilo')
data = dict(farm=farm, user=user, name='2014')
self.resp = self.client.post('/ciclo/cadastrar/', data)
def test_post(self):
'Valid Post should redirect to /ciclo/1/.'
View fazenda_teste.py
# encoding: utf-8
from django.test import TestCase
from django.contrib.auth.models import User
from django.test.client import Client
from django.template.defaultfilters import slugify
from django.test.client import RequestFactory
from fazenda.core.models import Fazenda
from fazenda.core.views import FazendaDetail
View upload.html
{% extends 'base.html' %}
{% load breadcrumbs %}
{% block breadcrumbs %}
{% breadcrumb 'Upload' %}
{% endblock %}
{% block css_especifico %}
<link rel="stylesheet" href="{{ STATIC_URL }}assets/css/dropzone.css">
{% endblock %}
{% block title %}Upload{% endblock %}
@murilobsd
murilobsd / urlhash.py
Created Oct 4, 2013
Simples função para gerar as hashs do url. >>> import urlhash >>> print pkgen() ljq4vvlxhotnoydkqziwycslvbiwxlxz
View urlhash.py
from base64 import b32encode
from hashlib import sha1
from random import random
def pkgen():
rude = ('lol',)
bad_pk = True
while bad_pk:
pk = b32encode(sha1(str(random())).digest()).lower()[:32]
bad_pk = False
You can’t perform that action at this time.