Skip to content

Instantly share code, notes, and snippets.

Jesse Crocker JesseCrocker

View GitHub Profile
@JesseCrocker
JesseCrocker / NSArray+JCaddons.h
Created Jan 6, 2013
A couple of extensions to NSArray that I use on a regular basis.
View NSArray+JCaddons.h
//
// NSArray+JCaddons.h
//
// Created by Jesse Crocker on 7/26/12.
// Copyright (c) 2012 Thisside.net. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSArray (JCaddons)
@JesseCrocker
JesseCrocker / AFCSVRequestOperation.h
Created Mar 1, 2013
AFCSVRequestOperation, for requesting and parsing CSV with AFNetworking
View AFCSVRequestOperation.h
// AFCSVRequestOperation.h
//
// Created by Jesse Crocker <datamongers.net> on 12/30/2012
// Based on AFJSONRequestOperation.h
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@JesseCrocker
JesseCrocker / xcd_model_parser.pl
Last active Dec 15, 2015
A perl script to parse a core-data model file, and generate a django model. The django model will still need to be edited, but it's a start. The code's kind of weird, because it originally generated a sql schema. Hows that for cross platform.
View xcd_model_parser.pl
#!/usr/bin/env perl
use strict;
use warnings;
use XML::Simple;
use Data::Dumper;
use Scalar::Util 'reftype';
use JSON;
use Carp;
use DBI;
@JesseCrocker
JesseCrocker / DBController.h
Created Apr 1, 2013
Core data boiler plate
View DBController.h
//
// DBController.h
//
// Created by Jesse Crocker on 3/31/13.
// Copyright (c) 2013 Jesse Crocker. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DBController : NSObject
@JesseCrocker
JesseCrocker / convert-geopdf.py
Last active Sep 1, 2018
A quick script for converting US Topo geoPDF maps to tiff. Based on code from Even Rouault at http://lists.osgeo.org/pipermail/gdal-dev/2013-January/035269.html
View convert-geopdf.py
#!/usr/bin/env python
#based on http://lists.osgeo.org/pipermail/gdal-dev/2013-January/035269.html
from osgeo import gdal, osr
import os
import sys
from optparse import OptionParser
import tempfile
from shapely import wkt
from shapely.geometry import mapping
from fiona import collection, crs
@JesseCrocker
JesseCrocker / composite_landsat.py
Last active Dec 18, 2015
Create RGB images from landsat scenes. Defualts to band pattern for true color images from landsat8, Requires https://github.com/gina-alaska/dans-gdal-scripts
View composite_landsat.py
#!/usr/bin/env python
from osgeo import gdal
import os
import sys
import glob
from optparse import OptionParser
def convertTo8Bit(infile, outfile):
os.system('gdal_contrast_stretch -ndv 0 -percentile-range 0.02 0.98 %s %s' % (infile, outfile))
@JesseCrocker
JesseCrocker / quote.py
Last active Dec 20, 2015
split a comma separated string, print it as a quoted tuple. example: $ ./quote.py FRNG, MONU, TOWR, TREE ('FRNG', 'MONU', 'TOWR', 'TREE')
View quote.py
#!/usr/bin/env python
import sys
quoted_items = []
for string in sys.argv[1:]:
items = string.split(", ")
[quoted_items.append("'%s'" % i.replace(",","")) for i in items]
print "(" + ", ".join(quoted_items) + ")"
@JesseCrocker
JesseCrocker / style.mss
Created Aug 4, 2013
iBurn 2013 map style sheet, tile mill
View style.mss
Map {
background-color: white;
}
#boundries[Name="Fence"] {
line-width:.5;
line-color:#9C9C9C;
}
@JesseCrocker
JesseCrocker / transparent_tiles.py
Last active Dec 23, 2015
Analyze a directory of map tiles for opaque, transparent, and partial transparent tiles, with options to remove transparent tiles.
View transparent_tiles.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c) 2013, Trailbehind inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
@JesseCrocker
JesseCrocker / dump-pixels.py
Created Sep 26, 2013
Dump image pixel values for analysis, as text or json
View dump-pixels.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import optparse
from PIL import Image
import json
if __name__=='__main__':
You can’t perform that action at this time.