Skip to content

Instantly share code, notes, and snippets.

View murilobsd's full-sized avatar
🍀
cvs -q up -Pd -A

msi murilobsd

🍀
cvs -q up -Pd -A
View GitHub Profile
@murilobsd
murilobsd / consulta
Last active August 29, 2015 14:17
consulta juristec
<?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>
@murilobsd
murilobsd / compartilhamento.models.py
Created October 4, 2013 22:23
Models do Compartilhamento
from south.modelsinspector import add_introspection_rules
from django.db import models
from django.db.models import permalink
from django.contrib.auth.models import User
from core.models import Cliente
from biblioteca.models import Imagem
from base64 import b32encode
from hashlib import sha1
from random import random
@murilobsd
murilobsd / urlhash.py
Created October 4, 2013 22:29
Simples função para gerar as hashs do url. >>> import urlhash >>> print pkgen() ljq4vvlxhotnoydkqziwycslvbiwxlxz
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
{% 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 %}
# 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
@murilobsd
murilobsd / teste_form_cycle.py
Created December 6, 2013 10:37
error in post data
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/.'
#!/usr/bin/env python
# coding=utf-8
import urllib2
import argparse
import facebook
import time
import random
import re
from lxml import html
"""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.
@murilobsd
murilobsd / tg_bot.py
Created July 3, 2018 19:28
Telegram Bot example
#!/usr/bin/env python
from __future__ import print_function
import datetime
import os
import random
import re
import time
import telepot
@murilobsd
murilobsd / dht-walkthrough.md
Created February 12, 2019 16:47 — forked from gubatron/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