This file contains hidden or 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
| (defn make-postgis | |
| ;; hack to make setting up a postgis database easier | |
| ;; should clean up with regex | |
| [params] | |
| (let [conn (.split params "@") | |
| host (first (.split (second conn) ":")) | |
| port-table (second (.split (second conn) ":")) | |
| port (first (.split port-table "/")) | |
| database (second (.split port-table "/")) | |
| user (first (.split (first conn) ":")) |
This file contains hidden or 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
| def download_file(request): | |
| response = HttpResponse(mimetype="text/csv") | |
| response['Content-Disposition'] = 'attachment; filename=blah.csv' | |
| response.write("blah") | |
| return response |
This file contains hidden or 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
| # simple script to convert csv to shapefile. | |
| from osgeo import ogr | |
| import csv | |
| driver = ogr.GetDriverByName('ESRI Shapefile') | |
| def loadCSV(path=None): | |
| global driver | |
| print("loading csv file %s" % path) | |
| fileReader = csv.reader(open(path), delimiter=',',) |
This file contains hidden or 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 re | |
| from collections import namedtuple | |
| from dispatch import consumer | |
| class Message(object): | |
| """ | |
| """ | |
| def __init__(self,text ): | |
| """ |
This file contains hidden or 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 re | |
| from collections import namedtuple | |
| from dispatch import consumer | |
| class Message(object): | |
| """ | |
| """ | |
| def __init__(self,text ): | |
| """ |
This file contains hidden or 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
| from dispatch import Dispatcher, Message | |
| def print_message(message): | |
| print(message) | |
| print(message.langauge) | |
| print(message.reqex.groups()) | |
| dispatcher = Dispatcher() |
This file contains hidden or 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 | |
| # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 | |
| import re | |
| import urllib | |
| from datetime import datetime | |
| from select import select | |
| from SocketServer import ThreadingMixIn | |
| from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer |
This file contains hidden or 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
| function loadMap() { | |
| var bbox = new OpenLayers.Bounds(156543.03389988, | |
| 703424.66634662, | |
| 1484712.8371452, | |
| 1347941.6887318); | |
| map = new OpenLayers.Map({ | |
| div: "map", |
This file contains hidden or 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
| """ | |
| """ | |
| from collections import defaultdict | |
| from datetime import datetime | |
| from gateway.models import PrimaryLog | |
| from gateway.models import Meter | |
| from gateway.models import Circuit | |
| from gateway.models import initialize_sql | |
| from gateway.models import DBSession | |
| from urlparse import parse_qs |
This file contains hidden or 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
| from collections import defaultdict | |
| from datetime import datetime | |
| from gateway.models import PrimaryLog | |
| from gateway.models import Meter | |
| from gateway.models import Circuit | |
| from gateway.models import initialize_sql | |
| from gateway.models import DBSession | |
| from urlparse import parse_qs | |
| import compactsms |