Skip to content

Instantly share code, notes, and snippets.

View marcelcaraciolo's full-sized avatar
💭
Coding !

Marcel Caraciolo marcelcaraciolo

💭
Coding !
View GitHub Profile
# -*- coding: utf-8 -*-
from xml.dom import minidom
from core.utils import asciize
from signin import sign_file
import urllib2
import os, decimal
import settings
from nfe.exceptions import NoContratorOrIncompleteInformation
from nfe.utils import dict2XML
@marcelcaraciolo
marcelcaraciolo / excel_read.py
Created January 31, 2014 01:00
Read excel file and return all the rows as dict fields. ;)
import xlrd
def getDataFromFile(fileName):
with xlrd.open_workbook(fileName) as wb:
# we are using the first sheet here
worksheet = wb.sheet_by_index(0)
# getting number or rows and setting current row as 0 -e.g first
num_rows, curr_row = worksheet.nrows - 1, 0
# retrieving keys values(first row values)
def _executar(self):
#Atualizando as infos de cada clan intra.
for i in range(0, TSPClanConstants.NUMBER_OF_CLANS):
bando = self.clans[i]
for i in range(0, len(bando)):
self.atualizaInformacao(bando, i);
bando[i].fitness = TSP.evaluate(bando[i].posicao)
bando[i].atualizarP()
#Atualizando as infos dos clans
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Nova senha" %} | {{ block.super }}{% endblock %}
{% block header_title %}{% trans "Nova senha" %}{% endblock %}
{% block main %}
<div class="message info">
@marcelcaraciolo
marcelcaraciolo / urls.py
Created January 21, 2014 19:06
urls.py da minha app account
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns('account.views',
url(r'^$', 'index', name='account_index'),
url(r'^login/$', 'login', name='account_login'),
url(r'^alterar-senha/$', 'password_change', name='account_password_change'),
)
#print command
print('hello world')
print('maça')
x = 'hello world'
print(x)
import urllib
import json
from pytagcloud import create_tag_image, make_tags
from pytagcloud.lang.counter import get_tag_counts
def search():
url = 'https://api.foursquare.com/v2/venues/search?ll=-8.064329,-34.87315&oauth_token=<SEU_ACCESS_TOKEN>&v=20131130'
resp = urllib.urlopen(url).read()
data = json.loads(resp.decode('utf-8'))
import tweepy
import urllib
from xml.dom.minidom import parse, parseString
situacao_transito = {}
def leitura_xml():
url = 'http://www.recife.pe.gov.br/transito/recuperarPontos.aspx'
url_camera ='http://cttupe.gtrans.com.br/portaltransito/files/imgs_cam/%s.jpg'
import json
import urllib
import pymongo
connection = pymongo.Connection('mongodb://localhost', safe = True)
db = connection.reddit
stories = db.stories
reddit_page = urllib.urlopen('http://www.reddit.com/r/Python/.json')
import urllib.request
import json
url = 'http://www.reddit.com/r/Python/.json'
resp = urllib.request.urlopen(url).read()
parsed = json.loads(resp.decode('utf-8'))
for item in parsed['data']['children']:
doc = item['data']