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 / 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/.'
@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>
#!/usr/bin/env python
# coding=utf-8
import urllib2
import argparse
import facebook
import time
import random
import re
from lxml import html
import asyncio
from bson import ObjectId
class MongoAuthPlugin(BaseAuthPlugin):
def __init__(self, context):
super().__init__(context)
self._db = db
@asyncio.coroutine
"""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