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 / pickle_ctypes.error
Created April 10, 2014 18:16
Pickled error with ctypes
Traceback (most recent call last):
File "teste.py", line 9, in <module>
ecf=base.Base()
File "/u1/caixa.manaus/pyECF/base.py", line 86, in __init__
self._lib()
File "/u1/caixa.manaus/pyECF/base.py", line 100, in _lib
pickle.dump(self.iDrv, f)
File "/usr/lib/python2.6/pickle.py", line 1362, in dump
Pickler(file, protocol).dump(obj)
File "/usr/lib/python2.6/pickle.py", line 224, in dump
@ivanelson
ivanelson / ssh_paramiko.py
Created June 17, 2014 02:58
Python SSH via Paramiko
#-*- encoding: utf-8 -*-
""" test_paramiko.py - tests paramiko library on
localhost connection"""
import paramiko
paramiko.util.log_to_file('paramiko.log')
s = paramiko.SSHClient()
@ivanelson
ivanelson / postgresql.conf
Created August 29, 2014 17:53
postgresql.conf
# Version 9.1
log_destination = 'stderr' # Valid values are combinations of
logging_collector = all # Enable capturing of stderr and csvlog
log_directory = 'pg_log' # directory where log files are written,
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
log_file_mode = 0600 # creation mode for log files,
@ivanelson
ivanelson / gist:46c259d5586913a28f51
Created October 9, 2014 20:52
Apache settings of the Django App / Slackware 14
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mfd.claudinosa.com.br
DocumentRoot /var/www/django/portal_mfd/
WSGIScriptAlias / /var/www/django/portal_mfd/portal_mfd/mfd.wsgi
Alias /static/admin/ /var/www/django/portal_mfd/portal_mfd/static/admin/
Alias /static/ /var/www/django/portal_mfd/portal_mfd/static/
<Directory /var/www/django/portal_mfd/portal_mfd>
@ivanelson
ivanelson / tochar
Created December 10, 2014 19:30
toalpha
DocSpool[15] SQL Syntax: SELECT Nr_Estabelecimento, Cd_Chave FROM Resumo WHERE N
r_Estabelecimento={fn LEFT(?,11)} LIMIT 1
*** Error *** Error from : ERROR: function pg_catalog.substring(double precisio
n, integer, integer) does not exist Hint: No function matches the given name a
nd argument types. You might need to add explicit type casts. Position: 74
*** Executing "DocSpool": line #, file "/u1/nccredito/dev/pts/8/docspool.doc
".
@ivanelson
ivanelson / between.sql
Created May 18, 2015 13:41
Between - Diferença entre Postgres e Oracle
ORACLE:
- cd_chave_la varchar2(6)
SELECT cd_chave_la from tab_inaugura where cd_chave_la between 'TEZ 1 ' and 'TEZ 1Z';
// OUTPUT:
"TEZ 1S"
POSTGRESQL
- cd_chave_la varchar(6)
git log --pretty="%H %ci" --after=2015-06-03 --before=2015-06-05
ivan:~/src/vagrant/precise32$ vagrant up
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /home/ivan/zim712pg in PATH, mode 040777
/opt/vagrant/embedded/gems/gems/bundler-1.7.11/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /home/ivan/zim712pg in PATH, mode 040777
Bringing machine 'pdv' up with 'virtualbox' provider...
Bringing machine 'base' up with 'virtualbox' provider...
==> pdv: Box 'pdv' could not be found. Attempting to find and install...
pdv: Box Provider: virtualbox
pdv: Box Version: >= 0
==> pdv: Adding box 'pdv' (v0) for provider: virtualbox
pdv: Downloading: pdv
@ivanelson
ivanelson / pdf.py
Created August 2, 2016 13:37
pdf via reportlab
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
from reportlab.pdfgen import canvas
c = canvas.Canvas("ola.pdf")
c.drawString(100,750,"Bem-vindo ao Reportlab!")
c.save()