Skip to content

Instantly share code, notes, and snippets.

#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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,
@csmoore
csmoore / ConvertTree-SVGtoPNG.bat
Created April 9, 2014 16:10
Recursively Converts a Directory of SVGs to PNGs, maintaining the original folder structure, requires a 3rd party converter (see TODOs for how to set)
@ECHO OFF
:: (Heavily) Adapted from Craig Williams script:
:: Apache V2: https://github.com/williamscraigm/csv2ArcGISStyle/blob/master/SVGtoEMF.bat
:: Adaptations were to create the same folder structure in the destination folder
:: This was needed to handle a set of source svgs with a complex folder structure that
:: needed to be maintained
:: This script converts SVG files to EMF/PNG. Run as admin
:: For Inkscape help, see http://inkscape.org/doc/inkscape-man.html
@csmoore
csmoore / csv2markdownTable.py
Last active July 14, 2022 08:28
Simple script to convert a Comma-separated file (.csv) file to Markdown (.md) Table
#-------------------------------------------------------------------------------
# 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 / CsvSetComparer.py
Created May 5, 2014 14:16
Brute force set comparison of 2 .csv's
#-------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# See the license for details but you know the general guidance: this is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#-------------------------------------------------------------------------------
# Name: CsvSetComparer.py
# Usage: python.exe CsvSetComparer.py [Input File:"Truth"(.csv)] [Input File:"Test"(.csv)]
# {Output Diff File (.csv)="diffs.csv"} {ColumnsToCompare=cols}
# Description: *Brute force* set comparison of 2 .csv's for entries in a "Test" csv's columns that
# do not exist in a "Truth" csv's column. Outputs the diffs from "Test" into
@csmoore
csmoore / QueryPerformanceCounterExample.cpp
Created May 29, 2014 20:07
Simple example of QueryPerformanceCounter Usage
// If needed #include Winbase.h - link: Kernel32.lib
double PCFreq = 0.0;
LONGLONG CounterStart = 0;
void StartCounter()
{
LARGE_INTEGER li;
if (!QueryPerformanceFrequency(&li))
cout << "QueryPerformanceFrequency failed!\n";
@csmoore
csmoore / CsvSymbolLookupSample.java
Created June 10, 2014 14:37
Sample SymbolLookup & Loader Class
/*
| 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.
import csv
# Python Simple csv writer/reader snippets
# NOTE: "rb" "wb" is important csv needs these to be opened in "binary" format
###################################################
# csv writer snippet
@csmoore
csmoore / ArrowAxisTestMessages
Created September 25, 2014 13:54
ArcGIS Runtime Sample 2525C Messages with Arrows and Control Points
<messages>
<message>
<_type>position_report</_type>
<_action>update</_action>
<_id>005337d7-981d-4137-b03e-6663a8f325ef</_id>
<_wkid>3857</_wkid>
<sic>GFGPOLAV-------</sic>
<_control_points>-227673.83247,6409548.39442;-230125.30147,6578445.28904;-237000,6420000</_control_points>
<uniquedesignation>AXIS 1</uniquedesignation>
</message>
@csmoore
csmoore / MilitaryFeatureCsvToRuntimeMessage.py
Last active August 29, 2015 14:07
MilitaryFeatureCsvToRuntimeMessage.py
# MilitaryFeatureCsvToRuntimeMessage.py
import csv
import os
import sys
import uuid
### Params:
### 1 - CSV File (.csv)
### 2 - Message File (.xml)
@csmoore
csmoore / urlChecker.py
Created January 29, 2015 16:12
Simple, focused link checker that outputs to csv
#-------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# See the license for details but you know the general guidance: this is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#-------------------------------------------------------------------------------
# Name: urlChecker.py
# Usage: python.exe urlChecker.py [Output File:(.csv)] [Directory To Check] [File Filters(default:".html,.erb")]
# Requirements/Constraints: Must run with Python 2.X (because of use of urllib2)
#-------------------------------------------------------------------------------
# Description: a URL Checking script