Skip to content

Instantly share code, notes, and snippets.

View ivanelson's full-sized avatar

Ivanelson Nunes ivanelson

  • Teresina, PI - BR
View GitHub Profile
@ivanelson
ivanelson / csv_columnames.py
Created April 23, 2013 19:45
Read files CSV with column named.
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
# By Ivan
import sys, csv
from decimal import Decimal
from datetime import datetime
def csv_columnames():
data = csv.reader(open('entgara.csv'), delimiter=';')
@ivanelson
ivanelson / zim.dot
Created April 24, 2013 13:02
Gera gráfico tree usando o GraphViz.
digraph zim {
size="300,200";
node [color=lightblue2, style=filled];
"mconta" -> "ghist";
"ghist" -> "iHist";
"ghist" -> "gsencc";
"mconta" -> "iconta";
"iconta" -> "ghist";
@ivanelson
ivanelson / zomlist_gcliente.txt
Created April 24, 2013 17:03
ZOMlist GCLIENTE
Object List
ObjectName ObjectType DirName OwnerName
ZIM Directory ZIM
PageDown Constant ZIM
Home Constant ZIM
F12 Constant ZIM
TabBairro EntitySet ZIM
F7 Constant ZIM
@ivanelson
ivanelson / Install_TracAdvParseArgsPlugin
Created May 13, 2013 16:48
Errors in installation of plugin AdvParseArgs
sudo easy_install TracAdvParseArgsPlugin
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2807, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 594, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.24dev-r0
@ivanelson
ivanelson / regex_reply_mail
Created July 17, 2013 21:09
Regex for mail reply
found_id = None
if self.parameters.ticket_update and self.parameters.ticket_update_by_subject:
SUBJECT_RE = re.compile(r'^(?:(?:RE|AW|VS|SV|FW|FWD):\s*)+(.*)', re.IGNORECASE)
result = SUBJECT_RE.search(subject)
LOG = open("/tmp/regex.log", "a")
LOG.write("<<INICIO>>\n")
LOG.write("INICIO UPDATE_BY_SUBJECT: %s -> %s\n" % (subject.encode('utf8'), result))
LOG.close()
@ivanelson
ivanelson / ticket_update_by_subject
Created July 17, 2013 23:50
Integration Email2Trac + Trac + GLPI
#-*- encoding: utf-8 -*-
def ticket_update_by_subject(self, subject):
"""
This list of Re: prefixes is probably incomplete. Taken from
wikipedia. Here is how the subject is matched
- Re: <subject>
- Re: (<Mail list label>:)+ <subject>
So we must have the last column
@ivanelson
ivanelson / ticket_update_by_subject_new
Created August 14, 2013 22:38
email2trac - Integration Trac and GLPI
def ticket_update_by_subject(self, subject):
"""
This list of Re: prefixes is probably incomplete. Taken from
wikipedia. Here is how the subject is matched
- Re: <subject>
- Re: (<Mail list label>:)+ <subject>
So we must have the last column
"""
self.logger.debug('function ticket_update_by_subject')
@ivanelson
ivanelson / cons.py
Created November 21, 2013 23:06
Connect Oracle with Python + Apache CGI + cx_Oracle
#-*- encoding: utf-8 -*-
import os
os.putenv('ORACLE_HOME', '/usr/lib/oracle/11.2/client64')
os.putenv('LD_LIBRARY_PATH', '/usr/lib/oracle/11.2/client64/lib')
os.environ['ORACLE_HOME'] = "/usr/lib/oracle/11.2/client64"
os.environ['LD_LIBRARY_PATH'] = "/usr/lib/oracle/11.2/client64/lib"
import cx_Oracle
con = cx_Oracle.connect('user/pass@IPADDRESS/orcl')
@ivanelson
ivanelson / ValidComment.py
Last active January 1, 2016 01:39
Just close the ticket(Trac), if you insert a comment. http://trac.edgewall.org/
#-*- encoding: utf-8 -*-
from trac.core import Component, implements
from trac.ticket.api import ITicketManipulator, ITicketChangeListener
from trac.ticket.model import Ticket
class ValidComment(Component):
implements(ITicketManipulator, ITicketChangeListener)
def prepare_ticket(self, req, ticket, fields, actions):
@ivanelson
ivanelson / check_hlink.sh
Created January 20, 2014 19:41
I will check the integrity of hardlink's