This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# [SNIPPET_NAME: Create an Application Indicator] | |
# [SNIPPET_CATEGORIES: Application Indicator] | |
# [SNIPPET_DESCRIPTION: How to create an application indicator and add items to it] | |
# [SNIPPET_AUTHOR: Jono Bacon <[email protected]>] | |
# [SNIPPET_DOCS: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators] | |
# [SNIPPET_LICENSE: GPL] | |
import gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Standalone script to upload a project docs on PyPI | |
Hacked together from the following distutils extension, avaliable from | |
https://bitbucket.org/jezdez/sphinx-pypi-upload/overview (ver. 0.2.1) | |
sphinx_pypi_upload | |
~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Ansible Plugin implementing the include_defaults action. | |
Like include_vars, but the included defaults can be overridden by the | |
inventory or by group vars. Can be used to read the defaults from another role. | |
Usage: drop it into a directory called ``action_plugins`` in your playbook | |
directory. Then you can use it with:: | |
- name: get the defaults from the web server role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Crea una tabella di importazione dati | |
create table codice_catastale_import ( | |
codice text not null, | |
codice_belfiore text, | |
provincia text, | |
comune text not null, | |
annotazione text, | |
codice_var text, | |
codice_belfiore_var text, | |
provincia_var text, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Standalone script to upload a project docs on PyPI | |
Hacked together from the following distutils extension, avaliable from | |
https://bitbucket.org/jezdez/sphinx-pypi-upload/overview (ver. 0.2.1) | |
sphinx_pypi_upload | |
~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2.extensions as ext | |
class Values(object): | |
"""Wrapper to pass a sequence of objects as VALUES argument""" | |
def __init__(self, seq): | |
self.seq = map(ext.adapt, seq) | |
def __conform__(self, proto): | |
if proto is ext.ISQLQuote: | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''reren -- rinomina usando espressioni regolari. | |
Utilizzo: | |
reren "from" "to" [dir] [-y] [-s] [-f] | |
from: Pattern a cui devono corrispondere i file. I file vengono letti | |
in ordine alfabetico. | |
to: Stringa in cui vanno trasformati i file; | |
se viene specificata l'opzione -f, deve essere una funzione |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python -u | |
""" | |
Apply database patches. | |
Database patches are found in the 'db' directory relative to this script. They | |
are recorded in the schema_patch table of the database. | |
The dsn to connect to defaults to a local one (empty connection string). It | |
can be chosen using the command line or an environment variable (so that the | |
Makefile doesn't need to be tweaked per developer). Patches application is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Custom reST_ directive for ditaa_ integration. | |
.. _reST: http://docutils.sourceforge.net/rst.html | |
.. _ditaa: http://ditaa.sourceforge.net/ | |
""" | |
import os | |
import tempfile | |
from zlib import adler32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""An example of cursor dealing with prepared statements. | |
A cursor can be used as a regular one, but has also a prepare() statement. If | |
prepare() is called, execute() and executemany() can be used without query: in | |
this case the parameters are passed to the prepared statement. The functions | |
also execute the prepared statement if the query is the same prepared before. | |
Prepared statements aren't automatically deallocated when the cursor is | |
deleted, but are when the cursor is closed. For long-running sessions creating |