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
# OVERVIEW | |
# | |
# AWS Lambda Function To Trigger A Notification Into Slack Channel. | |
# | |
from __future__ import print_function | |
import boto3 | |
import json | |
import logging |
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
#!/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 |
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 requests | |
import json | |
agol_url = r'http://services1.arcgis.com/uRIm5IkWjDXybgFb/arcgis/rest/services/LA_Nhood_Change/FeatureServer/0/query' | |
server_url = r'http://sampleserver6.arcgisonline.com/arcgis/rest/services/EmergencyFacilities/FeatureServer/0/query' | |
# i tried several different headers, to no avail | |
# headers={"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} | |
# headers = {"Content-Type": "application/x-www-form-urlencoded", "Accept":"/*/", "Accept-Encoding":"gzip, deflate", "Accept-Language":"en-US,en;q=0.8,ar;q=0.6"} | |
headers={"content-type":"application/json","Accept":"application/json"} |
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
class Token { | |
[string] $token | |
[System.DateTimeOffset] $expires | |
Token($response) { | |
$this.token = $response.token; | |
$this.expires = [System.DateTimeOffset]::FromUnixTimeMilliseconds($response.expires) | |
} | |
} | |
$rootUri = "https://www.arcgis.com/sharing/rest" |
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 os | |
import yaml | |
import logging.config | |
import logging | |
import coloredlogs | |
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'): | |
""" | |
| **@author:** Prathyush SP | |
| Logging Setup |
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 pandas as pd | |
from geopandas import GeoDataFrame | |
from shapely.geometry import Point | |
import fiona | |
df = pd.read_csv('data.csv') | |
geometry = [Point(xy) for xy in zip(df.x, df.y)] | |
crs = {'init': 'epsg:2263'} #http://www.spatialreference.org/ref/epsg/2263/ | |
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry) |
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
# Script to export html and csv reports of file and directory content on the system drive | |
# Use to identify large files/directories for disk space cleanup | |
# Uses WizTree portable to quickly retrieve file and directory sizes from the Master File Table on disk | |
# Download and extract the WizTree64.exe and place in the same directory as this script | |
# Set the running location | |
$RunLocation = $PSScriptRoot | |
#$RunLocation = "C:\temp" | |
$TempLocation = "C:\temp" |
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
'''Measure and report the time it takes to simply `import arcpy` | |
Part of https://community.esri.com/message/914048-re-what-is-your-import-arcpy-overhead? | |
''' | |
from timeit import default_timer as timer | |
start = timer() | |
from datetime import datetime, timedelta | |
from uuid import uuid4 | |
eventid = datetime.now().strftime('%Y%m-%d%H-%M%S-') + str(uuid4()) |