Skip to content

Instantly share code, notes, and snippets.

View ppKrauss's full-sized avatar
🌴
On vacation

Peter ppKrauss

🌴
On vacation
View GitHub Profile
@ppKrauss
ppKrauss / pgis_shape_descriptor.sql
Created October 1, 2012 10:01
PostGIS shape descriptor, "as rectangle" metrics vector
CREATE FUNCTION shapedescr_sizes(
-- Shape-descriptor "as rectangle" for geometry description by sizes.
gbase geometry, -- input
-- p_seqs integer DEFAULT 8, -- deprecated? for st_buffer(g,w,p_seqs) or point-buffer inference
-- p_shape varchar DEFAULT '', -- will be endcap indicator
p_decplacesof_zero integer DEFAULT 6, -- precision of zero when rounding delta
p_dwmin float DEFAULT 99999999.0, -- change to ex. 0.0001, if to use.
p_deltaimpact float DEFAULT 9999.0 -- internal (maximized by probability of negative delta)
) RETURNS float[] AS $f$
DECLARE
@ppKrauss
ppKrauss / benchmark_base.php
Last active August 29, 2015 14:04
Simple benchmark-base for use in any simple benchmarking task
<?php
/**
* Simple benchmark-base for use in any simple benchmarking task.
* Use at terminal as $php benchmark_base.php
* For more complex or memory usage, see
* http://php.net/manual/en/ref.xhprof.php
* http://php.net/manual/en/function.set-time-limit.php
* http://php.net/manual/en/features.gc.performance-considerations.php
* From https://gist.github.com/ppKrauss/4cd3c9a5f7cec89be68e
*/
@ppKrauss
ppKrauss / detect.php
Last active August 29, 2015 14:00
Javascript of http://www.corpuswiki.org translated to PHP and adapted for "restrict universe" option and object orientation.
<?php
/**
* Detect language by trigram sample analysis.
* Adapted by ppkrauss from http://www.corpuswiki.org/langdetect.html
*/
class LangDetect {
private $models;
private $universeConfig;
private $universeOnDetection;
private $isoTr3to2;