Skip to content

Instantly share code, notes, and snippets.

View kbaesler's full-sized avatar

Kyle Baesler kbaesler

View GitHub Profile
@kbaesler
kbaesler / gdb_to_sqlite.py
Created January 3, 2022 16:17 — forked from AlexArcPy/gdb_to_sqlite.py
Load Esri file geodatabase feature classes into SQLite spatial table
from __future__ import print_function
import sys
print(sys.version)
print(sys.executable)
import os
import sqlite3
import arcpy
from time import strftime
@kbaesler
kbaesler / Powershell-Template.ps1
Created March 25, 2019 17:44
The template below can be used as a starting point for new PowerShell scripts. The template starts with some standard comment-based Help tags that allow the Script to interact with Get-Help and then has sections for Declarations, Functions and the main body of the script.
<#
.SYNOPSIS
Name: script.ps1
The purpose of this script is to blah blah... What?
.DESCRIPTION
A slightly longer description of example.ps1 Why and How?
.PARAMETER InitialDirectory
The initial directory which this example script will use.
@kbaesler
kbaesler / LevenshteinDistance.cs
Created February 5, 2019 01:16
Levenshtein Distance
/// <summary>
/// The "Edit Distance" also known as "Levenshtein Distance" (named after the Russian scientist
/// Vladimir Levenshtein, who devised the algorithm in 1965),
/// is a measure of Similarity between two strings, s1 and s2.
/// The distance is the number of insertions, deletions or substitutions required to transform s1 to s2.
/// </summary>
public static class LevenshteinDistance
{
#region Public Methods
@kbaesler
kbaesler / kill-service.md
Created January 17, 2019 17:23
If you have a service that is not responding or showing pending in Windows services that you are unable to stop, use the following directions to force the service to stop.

If you have a service that is not responding or showing pending in Windows services that you are unable to stop, use the following directions to force the service to stop.

  1. Click the Start menu
  2. Click Run or in the search bar type services.msc
  3. Press Enter
  4. Look for the service and check the Properties and identify its service name
  5. Once found, open a command prompt. Type sc queryex [servicename].
  6. Press Enter
  7. Identify the PID
  8. In the same command prompt type taskkill /pid [pid number] /f
@kbaesler
kbaesler / view_stale_sessions.sql
Last active January 7, 2019 22:44
HOW TO FIND STALE SESSIONS IN ORACLE 12C
--
-- To get a list of logged-in users and the last time they issued a command, connect to the database as a DBA user
--
select S.USERNAME,
S.MACHINE,
S.OSUSER,
S.PROGRAM,
S.SID,
S.SERIAL#,
@kbaesler
kbaesler / GridSplitter.md
Created September 25, 2018 14:17
Properties to Set When Using a Horizontal or Vertical GridSplitter

To get the desired behavior when using a GridSplitter element, you need to set HorizontalAlignment and VerticalAlignment properties as shown below.

For a vertical splitter:

  • Put GridSplitter in its own column, setting column’s width to Auto
  • Set Grid.RowSpan to span all rows of the Grid
  • No need to set Grid.Row property (defaults to 0)
  • Set Width of GridSplitter to be desired thickness
  • Set HorizontalAlignment to Center
  • Set VerticalAlignment to Stretch
@kbaesler
kbaesler / send-request.py
Created June 1, 2017 01:03
A python script that will send a REST request to the URL provided at the command line.
import sys
import requests
def main(url, **kwargs):
try:
print ('GET: {0}'.format(url))
print ('PARAMS:')
for k,v in kwargs.items():
@kbaesler
kbaesler / create-multiversioned-view.sql
Created November 19, 2015 18:21
An ArcGIS SDE script for deleting, creating and granting permissions to a multiversion view.
sdetable -o delete_mv_view -t CustomerInformation -i sde:oracle11g:/;LOCAL=[DATABASE] -u [USERNAME] -p [PASSWORD] -N
sdetable -o create_mv_view -T CUSTOMERINFORMATION_MV -t CUSTOMERINFORMATION -i sde:oracle11g:/;LOCAL=[DATABASE] -u [USERNAME] -p [PASSWORD]
sdetable -o grant -t CUSTOMERINFORMATION_MV -U [ROLE] -A SELECT,INSERT,UPDATE,DELETE -i sde:oracle11g:\;LOCAL=[DATABASE] -u [USERNAME] -p [PASSWORD]
set timing on
set serverouput on
set pagesize 50
set linesize 400
@kbaesler
kbaesler / NonLockingReconcile.vb
Last active August 29, 2015 14:27
A VBA script that will reconcile the version without locking the parent.
' Reference Miner & Miner 9.x Geodatabase Library
Sub NonLockingReconcile()
On Error GoTo ErrorHandler
Dim conflictWindow As IConflictsWindow3
Dim editor As IEditor
Dim editorID As New UID
Dim conflictID As New UID