2014年2月10日 星期一

EnvironmentError: mysql_config not found

# apt-get install libmysqlclient-dev

Install a package and write to requirements.txt with pip

$ pip freeze > requirements.txt
$ pip install -r requirements.txt
 
 
 
 
References :
Cookbook — pip 1.5.2 documentation 

Upload your package PyPI

PyPI — the Python Package Index


Create your accounts

PyPI Live 

PyPI Test


Create a .pypirc configuration file

[distutils] # this tells distutils what package indexes you can push to
    index-servers =
        PyPI # the live PyPI
        PyPI-test # test PyPI
 
    [PyPI] # authentication details for live PyPI
    repository: https://PyPI.python.org/PyPI
    username: {{your_username}}
    password: {{your_password}}
 
    [PyPI-test] # authentication details for test PyPI
    repository: https://testPyPI.python.org/PyPI
    username: {{your_username}}

Prepare your package

root-dir/   # arbitrary working directory name
        setup.py
        setup.cfg
        LICENSE.txt
        README.md
        mypackage/
            __init__.py
            foo.py
            bar.py
            baz.py

setup.py
from distutils.core import setup
    setup(
        name = 'mypackage',
        packages = ['mypackage'], # this must be the same as the name above
        version = '0.1',
        description = 'A random test lib',
        author = 'Ajay',
        author_email = 'aj@gmail.com',
        url = 'https://github.com/ajkumar25/mypackage',   # use the URL to the github repo
        download_url = 'https://github.com/ajkumar25/mypackage/tarball/0.1', # I'll explain this in a second
        keywords = ['testing', 'logging', 'example'], # arbitrary keywords
        classifiers = [],
    )

setup.cfg
[metadata]
description-file = README.md

Register your package

$ python setup.py register -r PyPI-test

 

Upload your package

Upload to PyPI Test

$ python setup.py sdist upload -r PyPI-test

Upload to PyPI Live

$ python setup.py register -r PyPI

$ python setup.py sdist upload -r PyPI




References :
How to Create a Python Library | Pypix

 

2014年2月8日 星期六

Dump database to csv format

SELECT *FROM the_tableINTO OUTFILE '/tmp/the_table.csv'FIELDS TERMINATED BY ','ENCLOSED BY '"'LINES TERMINATED BY '\n';




References:
Save MySQL query results into a text or CSV file | a Tech-Recipes Tutorial

2014年2月3日 星期一

bitbucket text strike through

this is strike through text




References :
(moved to bitbucket) / Wiki / Markdown Syntax 

Linux Markdown Editor

1. ReText
最簡易,可同步預覽,編輯視窗字體不能放大

# apt-get install python3-docutils python3-markdown retext

2. MdCharm
功能齊全,有快速鍵修改 Markdown 語法,可自定樣式 (Windows, Linux, C++, QT)


3. Remarkable
功能齊,界面直觀,有快速鍵修改 Markdown 語法,可自定  CSS,GitHub 呈現樣式不錯 (Write in Python,支援 Linux,非完全 Open Source)



References :
Linux下Markdown的安装及常用语法 - WeberXie - 博客频道 - CSDN.NET

Could not parse file contents, check if you have the necessary module installed!

# apt-get install python3-docutils python3-markdown



References :
ReText / Tickets / #104 Preview error, missing module