Skip to content

Instantly share code, notes, and snippets.

@csmoore
csmoore / FindAndReplaceString
Created April 3, 2015 16:06
Simple find and replace string in files (recursive) python script
#------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@csmoore
csmoore / Excel formulae samples
Last active August 29, 2015 14:22
Obscure Excel formulas I can never remember
Cell contains substring?
=ISNUMBER(SEARCH("NEW_AT_2525D",E2))
Compare if the same string:
=IF(VLOOKUP(B1,B:B,1)=B2,"True","False")
Count occurences:
=SUMPRODUCT(--(ISNUMBER(SEARCH("String",A:A))))
@csmoore
csmoore / GitCheatSheet.md
Last active July 23, 2020 23:39
Git Cheat Sheet - list of git commands & examples

Just a list of git commands & examples

CLONE A REPO

git clone

CHECK REPO STATUS

git status

Remotes / Remote Merges

View Remotes

@csmoore
csmoore / XsdValidateTest
Created June 12, 2015 14:43
Simplest C# XSD Validator - console app to test validation
using System;
using System.Xml;
using System.Xml.Schema;
namespace ValidationTests
{
class Program
{
static void Main(string[] args)
{
@csmoore
csmoore / AddFeatureClassFieldsFromCsv.py
Created August 24, 2015 16:17
Reads a csv with the ArcGIS Feature Class field specifications and adds those fields to the selected Feature Class (with "AddField" GP Tool)
#-------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@csmoore
csmoore / ExportGDBFieldsToFolder.py
Created August 24, 2015 21:30
Exports all fields and field properties from an ArcGIS GDB as a set of csvs
# ----------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@csmoore
csmoore / ExportGDBSubTypesToFolder.py
Last active July 11, 2020 05:35
Exports all GDB SubTypes from a Military Features GDB to a set of csvs using ArcGIS Desktop/arcpy
# ----------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# Basic PyGithub Example - Example/test of using PyGithub (Python Github API)
# Repo(s) Open Issues List to CSV
# requires PyGithub (and python-jose) :
# pip install PyGithub
# -or- conda install -c conda-forge --name yourenvname pygithub
import os
import csv
@csmoore
csmoore / AddHeaderToFiles.py
Last active September 8, 2017 15:51
Recurse a supplied folder and add a file header to all files matching a pattern
#------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@csmoore
csmoore / ArcGISRestSamples.py
Created October 24, 2017 17:57
Python sample GET/POST calls to ArcGIS REST Service
#------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.