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
# Task Scheduler run as powershell -f "<path to script>" | |
# General Script Variables | |
$serverName = "<server name>" | |
$date = Get-Date -UFormat "%m/%d/%Y" | |
$imageName = "$serverName $date" | |
# Retrieve instance ID from EC2 Instance Metadata | |
$instanceID = (New-Object System.Net.WebClient).DownloadString("http://169.254.169.254/latest/meta-data/instance-id") |
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 arcpy | |
import os | |
workspace = r"<Path to workspace>" | |
outFile = r"C:\TEMP\dataPaths.txt" | |
dataPaths = open(outFile, "a") | |
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace, | |
datatype="Any", |
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 arcpy | |
arcpy.env.workspace = r"C:\TEMP\LocalGovernment.gdb" | |
outFile = open(r"C:\TEMP\dbinventory.txt", "a") | |
dsList = arcpy.ListDatasets(feature_type="feature") | |
for ds in dsList: | |
outFile.write("Dataset: {0}{1}".format(ds, "\n")) | |
for fc in arcpy.ListFeatureClasses(feature_dataset=ds): |
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
# Retrieve instance ID from EC2 Instance Metadata | |
$instanceID = (New-Object System.Net.WebClient).DownloadString("http://169.254.169.254/latest/meta-data/instance-id") | |
# Retrieve volumes that are attached to this instance | |
$volumes = Get-EC2Volume -Filter @{Name = "attachment.instance-id"; Value = $instanceID} | |
# Create a snapshot for each volume in the collection | |
foreach ($volume in $volumes){ | |
$volID = $volume.VolumeId | |
$diskSnapshot = New-EC2Snapshot -VolumeId $volume.VolumeId -Description "Snapshot of $volID from $instanceID" |
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 arcpy | |
fc = '<path to fc or table>' | |
field_CommonName = 'Field_CommonName' | |
field_BotanicalName = 'Field_BotanicalName' | |
# Takeaway - enclose the entire expression in quotes, don't do this: | |
# commonNameExpression = !Field_Name! + ' - ' + !Current_Crop_2013! | |
commonNameExpression = "!Field_Name! + ' - ' + !Current_Crop_2013!" |
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 arcpy | |
gridID_dict = {1:'A1', 2:'A2', 3:'A3', 4:'A4', | |
5:'B1', 6:'B2', 7:'B3', 8:'B4', | |
9:'C1', 10:'C2', 11:'C3', 12:'C4', | |
13:'D1', 14:'D2', 15:'D3', 16:'D4'} | |
fc = r'<path to file>' | |
# Fields will need to be updated with fields from source | |
fields = ['OID@', 'br2PolyID', 'ID'] |
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
<# | |
### Resources: ### | |
# How-To Delete Unutilized EBS-Based AMIs And Corresponding Snapshots | |
# http://www.n2ws.com/how-to-guides/how-to-delete-unutilized-ebs-based-amis-and-corresponding-snapshots.html | |
# Deleting Snapshots by Using the AWS Tools for Windows PowerShell | |
# http://docs.aws.amazon.com/storagegateway/latest/userguide/DeletingSnapshotsUsingPowerShell.html | |
# Adding and Removing Items from a PowerShell Array |
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
<style> | |
/** | |
Move the position of the Featured Maps container. With a banner image that is 472px high, a 25px margin will move the container toward the bottom of the image. | |
A 100px margin will add additional area below the banner image. | |
**/ | |
#featuredMaps { | |
margin-top: 25px; | |
} | |
/** |
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
#------------------------------------------------------------- | |
# Boilerplate connection / authentication | |
#------------------------------------------------------------- | |
import arcgis | |
from arcgis.gis import GIS | |
# Login credentials | |
url = "<url to agol or portal>" | |
username = "<user name>" | |
password = "<password>" |
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
/** Get date and time stamp for today/now: **/ | |
SELECT GETDATE() | |
/** Get today's date: **/ | |
SELECT CONVERT(date, GETDATE()) | |
/** Select records with today's date **/ | |
/** Example below using an Esri versioned view **/ | |
SELECT [OBJECTID] | |
,[DYETESTNUMBER] |