Skip to content

Instantly share code, notes, and snippets.

@maphew
maphew / Marsh_Lake_set_points.gpx
Created July 13, 2015 17:23
Output from GPX_to_Features.py (https://github.com/maphew/arcgiscom_tools). Garmin BaseCamp fails to read it.
<?xml version='1.0' encoding='UTF-8'?>
<gpx creator="Esri" version="1.0" xalan="http://xml.apache.org/xalan" xmlns="http://www.topografix.com/GPX/1/1" xsi="http://www.w3.org/2001/XMLSchema-instance"><wpt lat="60.3275172608" lon="-134.272101215"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.5452343323" lon="-134.416443469"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.5059909227" lon="-134.380400689"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.5351046022" lon="-134.492167512"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.4470025183" lon="-134.278019165"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.4715259816" lon="-134.328562126"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.4380733513" lon="-134.309640075"><ele>0</ele><time> </time><name> </name><desc> </desc></wpt><wpt lat="60.5258212849" lon="-134.428693475"><ele>0</ele><time> </time><name> </na
' VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
'
' Save the VBScript as "getWin7Key.vbs" somewhere on your Windows7 PC.
' Now, when you double-click the local script file an alertbox pops up
' displaying the product key stored in the machine's Windows registry.
Set WshShell = WScript.CreateObject("WScript.Shell")
KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
MsgBox ExtractKey(WshShell.RegRead(KeyPath))
@maphew
maphew / nts_map_as_html_table.py
Last active August 29, 2015 14:27
Print Yukon NTS tile names as html table with links, arranged in same order as they appear in a map index. See rendered result: https://cdn.rawgit.com/maphew/8f2f0ccb721cacea1b33/raw/868744229e6c2234d94cbc369ab18d486de61474/nts_html_table.html
''' Print Yukon NTS tile names as html table with links, arranged in same order as they appear in a map index.
2015-Aug-19, [email protected]
License: X/MIT
'''
nts_txt_ordered = '''117C 117D
117B 117A
116NO 116P
116JK 116I 106L 106K
@maphew
maphew / flash-autoupdate.bat
Last active August 29, 2015 14:27 — forked from karlhorky/flash-autoupdate.bat
Trigger Adobe Flash Player Auto-Update mechanism on Windows
:: On-Demand Flash Autoupdate
:: Author: Karl Horky
:: Date: 22 June 2012
:: Version: 0.2
:: Homepage: http://www.karlhorky.com/2012/06/manually-run-autoupdate-for-adobe-flash.html
@echo off
pushd C:\Windows\System32\Macromed\Flash\
if exist *ActiveX.exe (
echo Updating Flash Player Plugin for Internet Explorer
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2015-10-27T04:32:20.2209506</Date>
<Author>localhost\Matt</Author>
<Description>Workaround for the capture service halting on suspend/hibernate and resume (https://github.com/codebox/bitmeteros/issues/30). Fires on Startup (30s delay), Logon and Workstation Unlock.</Description>
</RegistrationInfo>
<Triggers>
<SessionStateChangeTrigger>
<Enabled>true</Enabled>
@maphew
maphew / dnld-yt-nhn.cmd
Created December 3, 2015 19:37
Download National Hydrographic Network for Yukon Territory and surround
@echo off
:: rev 0.1 2008.Mar.10, [email protected]
:: rev 0.2 2008.Sept.18 - updated to account for change in ftp source folders
:: rev 0.3 2014.Feb.06 - enable timestamp (only download if source newer)
echo.
echo. -----------------------------------------------------------------------
echo. Going to download National Hydrographic Network Yukon, which could take
echo. awhile. This script can be aborted and rerun, it will resume
echo. where it left off.
echo. -----------------------------------------------------------------------
@maphew
maphew / 2015-Dec-11 - result.txt
Last active June 13, 2019 19:12
From http://stackoverflow.com/a/34116472/14420 in answer to " Extract images from PDF without resampling, in python?"
> pip install --upgrade https://github.com/sylvainpelissier/PyPDF2/archive/master.zip
Collecting https://github.com/sylvainpelissier/PyPDF2/archive/master.zip
C:\Python27\ArcGIS10.3\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
C:\Python27\ArcGIS10.3\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading https://github.com/sylvainpelissier/PyPDF2/archiv
@maphew
maphew / Remove-Win10-nag.bat
Last active December 23, 2015 20:47
Implementation of "I Cancelled Microsoft 10 Reservation and uninstalled KB3035583 but Window 10 is still trying to install", http://superuser.com/questions/955444/i-cancelled-microsoft-10-reservation-and-uninstalled-kb3035583-but-window-10-is/
:: --{ Remove-Win10-nag.bat }--
:: http://superuser.com/questions/955444/i-cancelled-microsoft-10-reservation-and-uninstalled-kb3035583-but-window-10-is
:: must be run from elevated command prompt (Run As Administrator)
for %%a in (3035583 3022345 3068708 3075249 3080149 2990214 3012973 2952664 2976978) do (
wusa /uninstall /kb:%%a /norestart /quiet
)
echo Windows Registry Editor Version 5.00 >> "%temp%\disable-win10-upgrade.txt"
echo. >> "%temp%\disable-win10-upgrade.txt"
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade] >> "%temp%\disable-win10-upgrade.txt"
# In ArcGIS Field Calculator, pre-logic script code box:
import numpy
def getMedian(shp):
aList=[]
part=shp.getPart(0)
n=len(part)
for i in xrange(n):
p=part.getObject(i)
z=p.Z
aList.append(z)