Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| @ in soa localhost. root 1 3H 15M 1W 1D | |
| ns localhost. | |
| {% set nets=salt['publish.publish']('*','network.interfaces') %}{% for n in nets %}{% set pdata=salt['publish.publish'](n,'pillar.data') %}{% if pdata.has_key(n) %}{% if pdata[n].has_key('zone') %}{% if pdata[n]['zone']=='linuxservers' %} | |
| {{ n }} IN A {{ nets[n]['eth0']['inet'][0]['address'] }} | |
| {% endif %}{% endif %}{% endif %}{% endfor %} |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
This gist assumes:
| #!/usr/bin/python | |
| # rtorrent_xmlrpc | |
| # (c) 2011 Roger Que <alerante@bellsouth.net> | |
| # | |
| # Python module for interacting with rtorrent's XML-RPC interface | |
| # directly over SCGI, instead of through an HTTP server intermediary. | |
| # Inspired by Glenn Washburn's xmlrpc2scgi.py [1], but subclasses the | |
| # built-in xmlrpclib classes so that it is compatible with features | |
| # such as MultiCall objects. |
| This gist contains two files for simple indexing of PDF files. | |
| == requirements == | |
| First you need to install Solr (which requires a Java JDK): Download a tar or zipfile at http://www.apache.org/dyn/closer.cgi/lucene/solr/ and unpack it to a directory of your choice. Go into this directory and start solr running in jetty by: | |
| $ cd example | |
| $ java -jar start.jar | |
| Then locate your browser to http://localhost:8983/solr/ |