Skip to content

Instantly share code, notes, and snippets.

View kinnou02's full-sized avatar

Alexandre Jacquin kinnou02

View GitHub Profile
def lock_release(lock, logger):
token = None
if hasattr(lock, 'local') and hasattr(lock.local, 'token'):
# we store the token of the lock to be able to restore it later in case of error
token = lock.local.token
try:
lock.release()
except:
if token:
# release failed and token has been invalidated, any retry will fail, we restore the token
This file has been truncated, but you can view the full file.
01
01%20boulevard%20DE%20DOULON%20(Nantes)
01+rue+du+pet
01+rue+du+petit+mar
0%20Boulevard%20Gaston%20Doumergue,%2044200%20Nantes
0%20ru
0%20rue%20Baste
0%20ST-SEBASTIEN-SUR-LOIRE
022
02210
@task
def update_init_by_host(host):
with settings(host_string=host):
run('systemctl daemon-reload')
#
## File managed by fabric, don't edit directly
#
# this import might fix a strange thread problem: http://bugs.python.org/issue7980
import _strptime
import os
@kinnou02
kinnou02 / navitia docker deploy.txt
Last active May 2, 2019 05:32 — forked from shakedk/navitia docker deploy.txt
How to Deploy Navitia on a local PC using docker (and add GTFS/OSM data)
This guide explains how to deploy a Navitia server on a Windows machine.
Navitia is an open API to build great transit tools - read more about it here: https://www.navitia.io/
The awesome guys at CanalTP created docker containers that allow installing and using it loally very easily (https://github.com/CanalTP/navitia-docker-compose)
They also created a playground (http://canaltp.github.io/navitia-playground/play.html?) that allows experimenting with CanalTP data and servers
But with this guide you can get your own local copy really easily and feed it with any GTFS data you wish!
The guide details required software, different prerequisites, installation instrutions and how to feed the server with the required OSM & GTFS data.
RUNNING NAVITIA SERVER & PLAYGROUND POST INITIAL SET-UP
=======================================================
from __future__ import print_function
import gtfs_realtime_pb2, chaos_pb2
import uuid
import datetime, calendar
from kombu.connection import BrokerConnection
from kombu.entity import Exchange
import kombu
import time
import argparse
import sys
package bragi
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class Bragi extends Simulation {
val httpConf = http
.baseURL("http://localhost:4000") // Here is the root for all relative URLs
.acceptEncodingHeader("gzip, deflate")
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
[uwsgi]
processes = 40
http = 127.0.0.1:9090
uid = 33
log-encoder = format ${strftime:%%d/%%m/%%Y %%H:%%M:%%S} - ${msgnl}
buffer-size = 16384
reload-on-rss = 700
lazy-apps = True
enable-threads = True
logto = /var/log/uwsgi/%n.log
{
"name": "France - España",
"type": "country"
}
{
"name": "Guernsey",
"type": "country"
}
{
"name": "Jersey",