Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/usr/local/sublime-text-2/sublime_text
Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
import logging
import math
import mimetypes
from multiprocessing import Pool
import os
from boto.s3.connection import S3Connection
from filechunkio import FileChunkIO
@brendancol
brendancol / intro_to_python_dbb.py
Last active December 17, 2015 14:29
Developer Brown Bag: Python is the shiz -- An introduction to the Python 2.7 includes: data types, conditional statements, flow control, functions, classes, arcpy basics, and scipy spatial examples
import this
# comments are made by using the pound character
# =============================================================================
# basic data types / variable assignment in Python 2.x
# =============================================================================
this_is_a_string = 'Hello and welcome to developer brown bag'
this_is_a_string = "Hello and welcome to developer brown bag..Let's cheer"
this_is_a_string = '''Hello and welcome to developer brown bag...Let's cheer "Horray"'''

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@brendancol
brendancol / cross-platform-interface-for-virtualenv
Created June 3, 2013 04:22
migrate python project from Windows virtualenv to Linux virtualenv
from: http://stackoverflow.com/questions/12033861/cross-platform-interface-for-virtualenv
On Windows:
using virtualenv as source:
pip freeze > requirements.txt
Linux:
virtualenv --no-site-packages prod_env
source prod_env/bin/activate
pip install -r requirements.txt
"""
"""
import multiprocessing
import boto
import os
import sys
import datetime
import logging
import Queue
@brendancol
brendancol / concurrent_service_test.py
Last active December 19, 2015 22:49
Simple Geoprocessing Service Concurrent User Test
import multiprocessing
import os
import urllib2
import time
import json
import random
def concurrent_request_worker(url):
countries = ['AL', 'AO', 'AM', 'AZ', 'BD', 'BJ', 'BO', 'BT', 'BR', 'BF', 'BU', 'KH', 'CM', 'CV', 'CF', 'TD', 'CO', 'KM', 'CG', 'CD', 'CI', 'DR', 'EC', 'EG', 'ES', 'ER', 'ET', 'GA', 'GE', 'GH', 'GU', 'GN', 'GY', 'HT', 'HN', 'IA', 'ID', 'JM', 'JO', 'KK', 'KE', 'KY', 'LS', 'LB', 'MD', 'MW', 'MV', 'ML', 'MR', 'MX', 'MB', 'MA', 'MZ', 'NM', 'NP', 'NC', 'NI', 'NG', 'PK', 'PY', 'PE', 'PH', 'RO', 'RW', 'ST', 'SN', 'SL', 'ZA', 'LK', 'SD', 'SZ', 'TZ', 'TH', 'TL', 'TG', 'TT', 'TN', 'TR', 'TM', 'UG', 'UA', 'UZ', 'VN', 'YE', 'ZM', 'ZW']
rand_countries = ','.join(random.sample(countries, 20))
"""
Zonal Statistics
Vector-Raster Analysis
Copyright 2013 Matthew Perry
Usage:
zonal_stats.py VECTOR RASTER
zonal_stats.py -h | --help
zonal_stats.py --version
@brendancol
brendancol / overlapping_polygon_example.cs
Created August 8, 2013 16:09
Example of handling overlapping polygons when using ArcObjects IZonalOps
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Server;
using System;
using System.Collections.Generic;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
internal enum CurveDirection { RIGHT, UP, LEFT, DOWN };
public sealed class BoundingCurve
{