This gist contains lists of modules available in
in AWS Lambda.
| #!/bin/bash | |
| # Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447 | |
| proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')" | |
| # remove the protocol | |
| url="$(echo ${1/$proto/})" | |
| # extract the user (if any) | |
| userpass="$(echo $url | grep @ | cut -d@ -f1)" | |
| pass="$(echo $userpass | grep : | cut -d: -f2)" | |
| if [ -n "$pass" ]; then |
| # OVERVIEW | |
| # | |
| # AWS Lambda Function To Trigger A Notification Into Slack Channel. | |
| # | |
| from __future__ import print_function | |
| import boto3 | |
| import json | |
| import logging |
This gist contains lists of modules available in
in AWS Lambda.
This is a collection of information on PostgreSQL and PostGIS for what I tend to use most often.
| import pymssql | |
| import pandas as pd | |
| ## instance a python db connection object- same form as psycopg2/python-mysql drivers also | |
| conn = pymssql.connect(server="172.0.0.1", user="howens",password="some_fake_password", port=63642) # You can lookup the port number inside SQL server. | |
| ## Hey Look, college data | |
| stmt = "SELECT * FROM AlumniMirror..someTable" | |
| # Excute Query here | |
| df = pd.read_sql(stmt,conn) |
| from celery import Celery | |
| from celery.signals import after_task_publish,task_success,task_prerun,task_postrun | |
| # first argument, current module | |
| app = Celery('tasks') | |
| app.config_from_object('celeryconfig') | |
| # To instantiate celery and import this module | |
| # do: celery -A task worker --loglevel=info | |
| # after, once celery is running, instantiate a python console: |
| @echo off & python -x "%~f0" %* & goto :eof | |
| # ========================================================== | |
| # one way to place python script in a batch file | |
| # place python code below (no need for .py file) | |
| # ========================================================== | |
| import sys | |
| print "Hello World!" | |
| for i,a in enumerate(sys.argv): |
| import os, urllib, urllib2, datetime, arcpy, json | |
| ## ============================================================================== ## | |
| ## function to update a field - basically converts longs to dates for date fields ## | |
| ## since json has dates as a long (milliseconds since unix epoch) and geodb wants ## | |
| ## a proper date, not a long. | |
| ## ============================================================================== ## | |
| def updateValue(row,field_to_update,value): | |
| outputfield=next((f for f in fields if f.name ==field_to_update),None) #find the output field |
| /* | |
| * I add this to html files generated with pandoc. | |
| */ | |
| html { | |
| font-size: 100%; | |
| overflow-y: scroll; | |
| -webkit-text-size-adjust: 100%; | |
| -ms-text-size-adjust: 100%; | |
| } |