Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
@springmeyer
springmeyer / GetImageType.cpp
Last active December 16, 2015 01:39
detect png/jpeg/tiff from magic numbers (from libwebp/examples/cwebp.c)
static InputFileFormat GetImageType(FILE* in_file) {
InputFileFormat format = UNSUPPORTED;
unsigned int magic;
unsigned char buf[4];
if ((fread(&buf[0], 4, 1, in_file) != 1) ||
(fseek(in_file, 0, SEEK_SET) != 0)) {
return format;
}
@springmeyer
springmeyer / s3-index.html
Created April 8, 2013 22:42
modified version of https://github.com/rgrp/s3-bucket-listing supporting directories
<html>
<head>
</head>
<body bgcolor="white">
<h1 id="h1"></h1>
<hr>
<div id="listing">loading...</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
@springmeyer
springmeyer / gist:5327833
Created April 6, 2013 22:08
tilemill git repo error on windows
fatal: No such ref: HEAD
error: unable to unpack ab11933f2fcb1cf231fc32484af24a96a1820a63 header
error: inflateEnd: stream consistency error (no message)
fatal: loose object ab11933f2fcb1cf231fc32484af24a96a1820a63 (stored in .git/objects/ab/11933f2fcb1cf231fc32484af24a96a1820a63) is corrupt
fatal: The remote end hung up unexpectedly
diff -u -r sqlite-autoconf-3070900/.deps/sqlite3.Plo sqlite-autoconf-3071000/.deps/sqlite3.Plo
--- sqlite-autoconf-3070900/.deps/sqlite3.Plo 2013-03-29 16:53:58.000000000 -0700
+++ sqlite-autoconf-3071000/.deps/sqlite3.Plo 2013-03-29 18:34:25.000000000 -0700
@@ -21,27 +21,58 @@
/usr/include/secure/_string.h /usr/include/assert.h \
/opt/llvm2/bin/../lib/clang/3.3/include/stddef.h /usr/include/ctype.h \
/usr/include/runetype.h /usr/include/time.h /usr/include/_structs.h \
- /usr/include/pthread.h /usr/include/pthread_impl.h \
- /usr/include/sched.h /usr/include/sys/types.h /usr/include/sys/stat.h \
- /usr/include/fcntl.h /usr/include/sys/fcntl.h /usr/include/unistd.h \
@springmeyer
springmeyer / test-unicode-and-regex-64bit.xml
Last active December 15, 2015 12:19
rendering test of 64 bit integers and unicode regex in mapnik
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="ellipse">
<Rule>
<Filter>[id]=922337203685477580</Filter>
<TextSymbolizer
face-name="DejaVu Sans Book"
size="35"
allow-overlap="true"
>'Québec'.replace('(\B)|( )','$1 ')</TextSymbolizer>
@springmeyer
springmeyer / faster-placement.diff
Created March 13, 2013 22:18
remove inner loop in find_line_placements
diff --git a/src/placement_finder.cpp b/src/placement_finder.cpp
index 204297f..8e10b57 100644
--- a/src/placement_finder.cpp
+++ b/src/placement_finder.cpp
@@ -637,11 +637,11 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
{
for (double diff = 0; diff < tolerance; diff += tolerance_delta)
{
- for(int dir = -1; dir < 2; dir+=2) //-1, +1
- {
@springmeyer
springmeyer / disable-variable-gamma.diff
Created March 11, 2013 22:58
disable variable gamma in agg renderer
diff --git a/src/agg/agg_renderer.cpp b/src/agg/agg_renderer.cpp
index 32ea6d9..44bb3e7 100644
--- a/src/agg/agg_renderer.cpp
+++ b/src/agg/agg_renderer.cpp
@@ -297,7 +297,7 @@ void agg_renderer<T>::render_marker(pixel_position const& pos,
typedef agg::pod_bvector<mapnik::svg::path_attributes> svg_attribute_type;
ras_ptr->reset();
- ras_ptr->gamma(agg::gamma_power());
+ //ras_ptr->gamma(agg::gamma_power());
@springmeyer
springmeyer / mapnik.rb
Last active December 14, 2015 16:19
Mapnik homebrew formula with extra fixes
require 'formula'
class Mapnik < Formula
homepage 'http://www.mapnik.org/'
url 'https://github.com/downloads/mapnik/mapnik/mapnik-v2.1.0.tar.bz2'
sha1 'b1c6a138e65a5e20f0f312a559e2ae7185adf5b6'
# batch for building against boost >1.52
# can be removed at Mapnik >= 2.1.1
# https://github.com/mapnik/mapnik/issues/1716
Process: node [46523]
Path: /usr/local/Cellar/node/0.8.15/bin/node
Identifier: node
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: node [46522]
Date/Time: 2013-02-08 20:33:38.573 -0800
OS Version: Mac OS X 10.7.5 (11G63b)
Report Version: 9
<OGRVRTDataSource>
<OGRVRTLayer name="filename">
<SrcDataSource relativeToVRT="1">filename.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="long" y="lat"/>
</OGRVRTLayer>
</OGRVRTDataSource>