Skip to content

Instantly share code, notes, and snippets.

View elbosso's full-sized avatar

Jürgen Key elbosso

View GitHub Profile
//https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu/
CONTAINERNAME=osm
PROCESSORCOUNT=$(cat /proc/cpuinfo | grep processor | wc -l) # used to speed up make
lxc-create -n $CONTAINERNAME -t download -- --arch amd64 --dist ubuntu --release xenial
lxc-start -n $CONTAINERNAME
lxc-attach -n $CONTAINERNAME -- apt-get update
lxc-attach -n $CONTAINERNAME -- apt-get -y upgrade
lxc-attach -n $CONTAINERNAME -- apt-get -y install joe screen conky-cli openssh-server curl unzip gdal-bin tar wget bzip2 build-essential clang git autoconf libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal-dev g++ libmapnik-dev mapnik-utils python-mapnik libxml2-dev libfreetype6-dev libjpeg-dev libpng-dev libproj-dev libtiff-dev libcairo2 libcairo2-dev python-cairo python-cairo-dev libgdal-dev build-essential python-dev libbz2-dev libicu-dev libboost-all-dev apache2 apache2-dev python-yaml python-pip mapnik-utils fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted fonts-hanazono ttf-unifont font
CONTAINERNAME=hillshading
PROCESSORCOUNT=$(cat /proc/cpuinfo | grep processor | wc -l) # used to speed up make
lxc-create -n $CONTAINERNAME -t download -- --arch amd64 --dist ubuntu --release xenial
lxc-start -n $CONTAINERNAME
lxc-attach -n $CONTAINERNAME -- apt-get update
lxc-attach -n $CONTAINERNAME -- apt-get -y upgrade
lxc-attach -n $CONTAINERNAME -- apt-get -y install joe screen conky-cli openssh-server curl unzip gdal-bin tar wget bzip2 build-essential clang git autoconf libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal-dev g++ libmapnik-dev mapnik-utils python-mapnik libxml2-dev libfreetype6-dev libjpeg-dev libpng-dev libproj-dev libtiff-dev libcairo2 libcairo2-dev python-cairo python-cairo-dev libgdal-dev build-essential python-dev libbz2-dev libicu-dev libboost-all-dev apache2 apache2-dev python-yaml python-pip mapnik-utils fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted fonts-hanazono ttf-unifont fontconfig fonts-dejavu-core nodejs-legacy npm
lxc-attach -n $C
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://openlayers.org/en/v4.1.1/css/ol.css" type="text/css">
<style>
.map {
height: 100%;
width: 100%;
}
</style>
@elbosso
elbosso / stats.py
Created October 28, 2018 13:16
A small python script for updating a small oled display with some stats (heavily influenced from Adafruits samples)
#!/usr/bin/python
# Copyright (c) 2017 Adafruit Industries
# Author: Tony DiCola & James DeVito
#
# 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
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
/*
Juergen Key. Alle Rechte vorbehalten.
Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form,
mit oder ohne Veraenderung, sind unter den folgenden Bedingungen zulaessig:
1. Weiterverbreitete nichtkompilierte Exemplare muessen das obige Copyright,
die Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext
enthalten.
2. Weiterverbreitete kompilierte Exemplare muessen das obige Copyright,
/*
Copyright (c) 2012-2018.
Juergen Key. Alle Rechte vorbehalten.
Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form,
mit oder ohne Veraenderung, sind unter den folgenden Bedingungen zulaessig:
1. Weiterverbreitete nichtkompilierte Exemplare muessen das obige Copyright,
die Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext
@elbosso
elbosso / gitlab_issues.py
Created January 5, 2019 13:32
This is an inspiration concerning truly dynamic gitlab badges - install it onto an apache2 webserver with mod python and enjoy badges telling how many issues are open/closed right now - accurate with every reload of the page!
from anybadge import Badge
import gitlab
from urlparse import parse_qs
def index(req):
#change the next two lines to accomodate your installation
url='http://myhost'
token='xxxx-xxxx-xxxxxxxxxx'
args=req.args
lbl='n/a'
@elbosso
elbosso / gitlab_issues_curl.py
Created January 6, 2019 07:27
This is a followup to the Gist https://gist.github.com/elbosso/4f3bb0fb95dd1dc499cd46db422900bf - gitlab-python does not expose the header X:Total when listing items - so the response of this is noticeably slow from about 100 items upward. The shell approach demonstrated here works in constant time - regardless of the number of items queried
from anybadge import Badge
from urlparse import parse_qs
from subprocess import Popen,PIPE,STDOUT,call
def index(req):
args=req.args
lbl='n/a'
action='closedissues'
projid=None
if args != None:
@elbosso
elbosso / gitlab_issues_request.py
Created January 6, 2019 07:54
This is another followup to the Gist https://gist.github.com/elbosso/4f3bb0fb95dd1dc499cd46db422900bf (the other one can be found here https://gist.github.com/elbosso/e160341d5e00e0a726ff8725af560373): We do want the operation count(items in gitlab) to execute in constant time independently from the actual number of items - we do not want to spa…
from anybadge import Badge
from urlparse import parse_qs
import requests
def index(req):
args=req.args
lbl='n/a'
action='closedissues'
projid=None
if args != None:
@elbosso
elbosso / badges_flask.py
Created January 6, 2019 16:38
This is yet another followup re: dynamic badges in gitlab - its predecessor is here: https://gist.github.com/elbosso/cbce113805735478e926c28a9079cede This time we use flask to be more flexible with more deployment options - also it's fun!
from flask import Flask
from flask import make_response
import requests
from anybadge import Badge
from flask import request
app = Flask(__name__)
@app.route("/open/<int:projid>")
def openIssues(projid):