Skip to content

Instantly share code, notes, and snippets.

View dandye's full-sized avatar

DanDye dandye

View GitHub Profile
@dandye
dandye / max_date_from_storet_file
Last active August 29, 2015 14:06
Get Max Date from a big STORET textf file.
{
"metadata": {
"name": "Get Max Date from a big STORET textf file."
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@dandye
dandye / learning_pulp
Last active August 29, 2015 14:06
learning PuLP
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@dandye
dandye / sp_who2_w_db_select
Created September 30, 2014 17:27
sp_who2 with DB SELECT
CREATE TABLE #sp_who2 (SPID INT,Status VARCHAR(255),
Login VARCHAR(255),HostName VARCHAR(255),
BlkBy VARCHAR(255),DBName VARCHAR(255),
Command VARCHAR(255),CPUTime INT,
DiskIO INT,LastBatch VARCHAR(255),
ProgramName VARCHAR(255),SPID2 INT,
REQUESTID INT)
INSERT INTO #sp_who2 EXEC sp_who2
SELECT *
FROM #sp_who2
@dandye
dandye / hailataxii_disovery_with_libtaxii
Created November 20, 2014 22:52
Hailataxii discovery example using litaxii
{
"metadata": {
"name": "hailataxii_disovery_with_libtaxii"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
.. image:: picture.jpeg
:height: 100px
:width: 200 px
:scale: 50 %
:alt: alternate text
:align: right
{
"metadata": {
"name": "",
"signature": "sha256:3d39a8b952a425df0decd18096ff73a97e5e89d0ee6dda1072913087ddd431ba"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@dandye
dandye / fiona_bare_bones.py
Created March 27, 2012 00:13
Bare Bones Fiona Polygon
SCHEMA = {'geometry': 'Polygon', 'properties': {'name': 'str','token': 'str'}}
FEATURE = {'id': '1',
'geometry':
{'type': 'Polygon',
'coordinates': [[(-1.0, -1.0),
(-1.0, 1.0),
(1.0, 1.0),
(1.0, -1.0),
(-1.0, -1.0)]]
},
import gdal2tiles
for zoom in range(3):
west = -179.99
north = 89.99
print "---\nzoom %s" % zoom
gg = gdal2tiles.GlobalGeodetic()
sm = gdal2tiles.GlobalMercator()
tx,ty = gg.LatLonToTile(north, west, zoom)
print 'TMS tx,ty = %s, %s' % (str(tx),str(ty))
@dandye
dandye / multi_render_states.py
Created June 8, 2012 19:17
multi-process shell scripts
import os,sys
import glob
from multiprocessing import Pool
def f(sh):
print sh
os.system(sh)
shs = glob.glob("/mnt/tiger/TIGER2011/wg_fips/tl_2011_*/state_render.sh")
cmds = [open(x).read() for x in shs]
@dandye
dandye / SHP2GeoJSON
Created June 11, 2012 21:07
SHP2GeoJSON
import os,sys
import glob
import json
#
import fiona
shps = glob.glob("./*/*.shp")
for shp in shps:
#head,tail = os.path.split(shp)