Skip to content

Instantly share code, notes, and snippets.

View jtroe's full-sized avatar

Jay Roebuck jtroe

View GitHub Profile
portal = arcgis.GIS(profile='my_portal')
server = portal.admin.servers.list()[0]
svc = server.services.list(folder='Hosted')[0]
datastore_name = svc.properties.jsonProperties.adminServiceInfo.database.datasource.name
datastore = server.datastores.list()[0] # instead search by datastore_name
# if it's a database
jdbc_server = datastore.properties.info.JDBCConnection.url
jdbc_username = datastore.properties.info.JDBCConnection.username
@jtroe
jtroe / Mediakeys.ahk
Created July 29, 2019 21:43 — forked from mistic100/Mediakeys.ahk
Media keys shortcuts for AutoHotkey
; AutoHotkey Media Keys
^!Space::Send {Media_Play_Pause}
^!Left::Send {Media_Prev}
^!Right::Send {Media_Next}
^!NumpadMult::Send {Volume_Mute}
^!NumpadAdd::Send {Volume_Up}
^!NumpadSub::Send {Volume_Down}
@jtroe
jtroe / install_vpn.sh
Created July 21, 2017 21:34 — forked from lorepozo/install_vpn.sh
automatically install and configure a VPN server — IKEv2 over IPsec
#!/bin/bash
# install_vpn.sh
# automatically install and configure a VPN -- IKEv2 over IPsec
# using strongswan and iptables
#
# tested on Ubuntu 16.04, probably works on arch (implemented without trying it).
# note: this script is full of &>/dev/null to help make the output pretty.
#
# huge thanks to Namo's tutorial:
# https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ikev2-vpn-server-with-strongswan-on-ubuntu-16-04
@jtroe
jtroe / linestring.geojson
Last active August 31, 2016 15:10
geobuf examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jtroe
jtroe / Thing.cs
Created August 31, 2016 00:57
Is my thing too abstract?
public abstract class Thing
{
public string Name { get; set; }
}
@jtroe
jtroe / list_new_dbs.sql
Created August 30, 2016 16:44
Select New Databases
DECLARE @maxId INT
SELECT @maxId = MAX(database_id) FROM master.sys.databases WHERE create_date <= DATEADD(d, -1, GETDATE())
SELECT name, SUSER_SNAME(owner_sid) db_owner_name
FROM [master].[sys].[databases]
WHERE create_date >= DATEADD(d, -1, GETDATE()) AND database_id > @maxId
@jtroe
jtroe / bad_horse.md
Last active March 10, 2016 00:49
Bad Horse Letter
me@my_pc ~ $ traceroute -p 64 bad.horse
traceroute to bad.horse (162.252.205.157), 64 hops max, 52 byte packets
 1  10.0.1.1 (10.0.1.1)  1.579 ms  1.415 ms  2.039 ms
 2  boid-dsl-gw15.boid.qwest.net (184.99.64.15)  21.759 ms  21.682 ms  22.349 ms
 3  184-99-65-113.boid.qwest.net (184.99.65.113)  22.201 ms  22.759 ms  22.324 ms
 4  sea-brdr-02.inet.qwest.net (67.14.41.194)  41.952 ms  36.689 ms  38.043 ms
 5  * * *
 6  ae-5-5.car2.minneapolis1.level3.net (4.69.136.109)  72.448 ms  71.442 ms  72.072 ms
 7  iphouse.car2.minneapolis1.level3.net (4.59.66.14)  70.756 ms  71.437 ms  70.796 ms
@jtroe
jtroe / FIPS.sql
Created October 14, 2015 20:40 — forked from maplion/FIPS.sql
Get FIPS code for County by Lat/Long by @maplion for @simplot
/*
Returns County Data for given LATITUDE and LONGITUDE
Example usage:
select a.Latitude, a.Longitude, a.Area, f.NAME, f.FIPS from World.dbo.Locations a --any table with Latitude and Longitude
cross apply dbo.Get_County_From_Lat_Long(a.Latitude, a.Longitude) f
*/
CREATE FUNCTION [dbo].[Get_County_From_Lat_Long] (
@LATITUDE NUMERIC(10,6),
@LONGITUDE NUMERIC(10,6)
@jtroe
jtroe / FIPS.sql
Last active October 14, 2015 20:47
Get FIPS code for County by Lat/Long by @maplion for @simplot
/*
Returns County Data for given LATITUDE and LONGITUDE
Example usage:
select a.Latitude, a.Longitude, a.Area, f.NAME, f.FIPS from World.dbo.Locations a --any table with Latitude and Longitude
cross apply dbo.Get_County_From_Lat_Long(a.Latitude, a.Longitude) f
*/
CREATE FUNCTION [dbo].[Get_County_From_Lat_Long] (
@LATITUDE NUMERIC(10,6),
@LONGITUDE NUMERIC(10,6)
@jtroe
jtroe / stream_command.py
Last active February 7, 2018 03:07
Gracefully stream commands to the console with Python
def stream_command(command):
executable_command = str(command)
print '=>$ %s' % executable_command
import subprocess
import sys
try:
process = subprocess.Popen(executable_command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
comms = process.communicate()
stdout = comms[0]