Skip to content

Instantly share code, notes, and snippets.

View gaubert's full-sized avatar

Guillaume Aubert gaubert

View GitHub Profile
@gaubert
gaubert / timsort.py
Created October 9, 2019 08:41 — forked from bee-san/timsort.py
An Python implementation of Timsort
# based off of this code https://gist.github.com/nandajavarma/a3a6b62f34e74ec4c31674934327bbd3
# Brandon Skerritt
# https://skerritt.tech
def binary_search(the_array, item, start, end):
if start == end:
if the_array[start] > item:
return start
else:
return start + 1
from random import choice
import string
import subprocess
def generate_passwd(length=8, chars=string.letters+string.digits+'{}"&$@#%*.;'):
return ''.join([choice(chars) for i in range(length)])
def generate_username(prefix="jason", index=1):
""" """
return "{}{:05d}".format(prefix, index+1)
LoadModule mapcache_module /usr/lib/apache2/modules/mod_mapcache.so
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@gaubert
gaubert / README.md
Created February 9, 2016 09:36 — forked from serdaradali/README.md
Interactive world globe

Zoomable/rotatable world globe that uses orthographic projection. Drag behavior is enhanced as described here: https://www.jasondavies.com/maps/rotate/

Performance is not good due to redrawing whole world upon zoom/drag.

@gaubert
gaubert / index.html
Created February 8, 2016 09:55 — forked from marcneuwirth/index.html
D3 Globe
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<svg id="defs">
<defs>
<linearGradient id="gradBlue" x1="0%" y1="0%" x2="100%" y2="0%">
@gaubert
gaubert / SingleTile.js
Created November 20, 2015 15:47 — forked from Zverik/SingleTile.js
A layer for single-tile WMS layers. Displays a layer as a big picture, updates it on pan and zoom. This is a hack, made for an internal project; still waiting for https://github.com/Leaflet/Leaflet/issues/558 to be solved nicely. Example: L.singleTile('http://irs.gis-lab.info/').setParams({layers: 'landsat'}).addTo(map); (won't work, because tha…
/*
* L.SingleTile uses L.ImageOverlay to display a single-tile WMS layer.
* url parameter must accept WMS-style width, height and bbox.
*/
L.SingleTile = L.ImageOverlay.extend({
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
version: '1.1.1',
@gaubert
gaubert / gist:7f4f3e05845eface3861
Last active November 26, 2022 17:41
WMO_CategoryCodeList
<!- WMO_CategoryCode :: New CodeList for WMO Core Metadata Profile
-->
<gmx:codelistItem>
<gmx:CodeListDictionary gml:id="WMO_CategoryCode">
<gml:description>additional topic categories for WMO community</gml:description>
<gml:identifier codeSpace="WMO Core Metadata Profile">WMO_CategoryCode</gml:identifier>
<gmx:codeEntry>
<gmx:CodeDefinition gml:id="WMO_CategoryCode_weatherObservations">
<gml:description>weather observations</gml:description>
<gml:identifier codeSpace="WMO Core Metadata Profile">weatherObservations</gml:identifier>
@gaubert
gaubert / gist:e26eb189f7e42317fbb1
Created October 30, 2014 16:26
typical Json document created from the ISO19115 XML Metadata record
{
"identificationInfo":
{
"abstract": "A DevCoCast product, GOES\/MSG Composite is a product created by composing the GOES-12 IR images with MSG IR images, every 15 minutes. Every 3 hours, the composite will be derived from the full disk of GOES and full disk of MSG, in the 13-North to 50-South Latitude; 85-West to 55-East Longitude region, encompassing South America and Africa.",
"title": "Composites - GOES-MSG - Africa, South America",
"thumbnail": "http:\/\/navigator.eumetsat.int:80\/smartEditor\/preview\/GMC.jpg",
"keywords":
[
"Atmospheric conditions",
"Agriculture",
import re
class CardOutParser(object):
LINEEXPR = "##T-step: old_ts#(?P<tstep_old>.*), new_ts#(?P<tstep_new>.*), gyro_Dt#(?P<dt>.*)"
lre_timing = re.compile(LINEEXPR)
LINEEXPR = "#T-acc#(?P<timestamp_tacc>.*)#Am-Raw#(?P<r_ax>.*),(?P<r_ay>.*),(?P<r_az>.*)#T-gyr#(?P<timestamp_tgyr>.*)#Gm-Raw#(?P<g_ax>.*),(?P<g_ay>.*),(?P<g_az>.*)#T-mag#(?P<timestamp_tmag>.*)#Mm-Raw#(?P<m_ax>.*),(?P<m_ay>.*),(?P<m_az>.*)"
lre_data = re.compile(LINEEXPR)
@gaubert
gaubert / gist:0bf785679a89a419fa30
Last active August 29, 2015 14:05
working elastic search query with highlight and facets
# working query with highlight and facets first
curl -XGET 'http://localhost:9200/_search?pretty=true' -d '
{ "from" : 0, "size" : 1,
"highlight" : {
"fields" :
{ "identificationInfo.title": {"fragment_size":150,"number_of_fragments":3}, "identificationInfo.abstract": {} }
} ,
"facets" :
{