This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set filepath="C:\some path\having spaces.txt" | |
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi" | |
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi" | |
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni" | |
echo %dirname% | |
echo %filename% | |
echo %basename% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get Max ID from table | |
SELECT MAX(id) FROM table; | |
-- Get Next ID from table | |
SELECT nextval('table_id_seq'); | |
-- Set Next ID Value to MAX ID | |
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
class GeoWebCacheService(object): | |
"""Class to communicate with the geowebcache api. | |
Api doco here: http://geowebcache.org/docs/current/rest/seed.html | |
""" | |
_url = None | |
_username = None | |
_password = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from owslib.fes import * | |
from owslib.etree import etree | |
from owslib.wfs import WebFeatureService | |
wfs11 = WebFeatureService(url='http://example.com:8080/geoserver/wfs/', version='1.1.0') | |
f = open('download.sh', 'wb') | |
f.write('#!/bin/bash'+'\n') | |
f.write(''+'\n') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modified from http://codepen.io/gisminister/pen/Hdorv | |
// Create a marker | |
var myMarker = L.divIcon({ | |
className: 'map-marker marker-color-gray a-class', | |
iconSize: [28,28], | |
html:'<i class="fa fa-fw fa-2x fa-question"></i>' // FontAwesome.io | |
}); | |
// Style with css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Notice: if unable to connect to [ip]:5555, | |
#try adb kill-server then try again. | |
adb shell ip route > addrs.txt | |
#Case 1:Nexus 7 | |
#192.168.88.0/23 dev wlan0 proto kernel scope link src 192.168.89.48 | |
#Case 2: Smartsian T1,Huawei C8813 | |
#default via 192.168.88.1 dev eth0 metric 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Delete a remote branch | |
$ git push origin --delete <branch> # Git version 1.7.0 or newer | |
$ git push origin :<branch> # Git versions older than 1.7.0 | |
## Delete a local branch | |
$ git branch --delete <branch> | |
$ git branch -d <branch> # Shorter version | |
$ git branch -D <branch> # Force delete un-merged branches | |
## Delete a local remote-tracking branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib2 | |
import base64 | |
baseURL = "https://domain.example:8080/geoserver/gwc/rest/seed/" | |
descURL = "https://domain.example:8080/geoserver/gwc/rest/layers/" | |
un = 'username' | |
pw = 'biglongtrickypassword' | |
def truncateLayer(layer): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request: | |
1. You have to rely on an AJAX request, this example uses jQuery | |
2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that. | |
3. Output formats. The `info_format` parameter in the request. We don't know *a priori* which will be supported by a WMS that we might make a request to. See [Geoserver's docs](http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getfeatureinfo) for what formats are available from Geoserver. That won't be the same from WMS to WMS, however. | |
4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error. | |
5. added a php proxy and 2 new options (CORS workaround) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
var spData = null; | |
function doData(json) { | |
spData = json.feed.entry; | |
} | |