Skip to content

Instantly share code, notes, and snippets.

View nilsnolde's full-sized avatar

Nils nilsnolde

View GitHub Profile
@nilsnolde
nilsnolde / map.html
Created October 11, 2017 09:13 — forked from ataffanel/map.html
Simple OSM map view in pyqt using QtWebkit
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
body { padding: 0; margin: 0; }
html, body, #map { height: 100%; }
</style>
</head>
@nilsnolde
nilsnolde / Checklist.md
Last active May 20, 2019 14:41
Publish PyPI
  1. Change version numbers in __init__.py and setup.py
  2. Run tests: nosetests --with-coverage --cover-erase --cover-package=openrouteservice --cover-html -v
  3. Amend *.rst files if new modules were created
  4. Check if installation works for current Python version via python -m venv .venv' and pip install -e ../openrouteservice-py`
  5. Check if conda installs in new environment Python v.x env: conda install --yes -f openrouteservice-py/requirements.py
  6. Add tag after commit: git tag vX.Y.Z
  7. Build dist and wheel: python setup.py sdist bdist_wheel --universal or python3 setup.py sdist bdist_wheel
  8. Check if PyPI can parse all: python -m twine check dist/*
  9. Upload: twine upload dist/*
@nilsnolde
nilsnolde / app.config
Last active January 17, 2019 15:05
ors testing
{
ors {
info: {
base_url: "https://openrouteservice.org/",
support_mail: "[email protected]",
author_tag: "openrouteservice",
content_licence: "LGPL 3.0"
},
services: {
matrix: {
@nilsnolde
nilsnolde / dualpythonnotebook.md
Created May 26, 2019 12:53 — forked from evanwill/dualpythonnotebook.md
add more kernels to python 3 jupyter notebooks with anaconda

this assumes you have installed Python 3 via Anaconda distribution.

Make Python 2 kernel available to Jupyter Notebook

  1. open a terminal and create a new python 2 environment: conda create -n py27 python=2.7
  2. activate the environment: linux source activate py27 or windows activate py27
  3. install the kernel in the env: conda install notebook ipykernel
  4. install the kernel for outside the env: ipython kernel install --user
  5. close the env: source deactivate
DELETE relations.*, taxes.*, terms.*
FROM wp_term_relationships AS relations
INNER JOIN wp_term_taxonomy AS taxes
ON relations.term_taxonomy_id=taxes.term_taxonomy_id
INNER JOIN wp_terms AS terms
ON taxes.term_id=terms.term_id
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product');
DELETE FROM wp_posts WHERE post_type = 'product';
@nilsnolde
nilsnolde / api_woocommerce.js
Created December 24, 2019 21:28
WooCommerce OAuth v1.0 JavaScript client
/* eslint-disable camelcase */
import axios from 'axios'
import OAuth from 'oauth-1.0a'
import crypto from 'crypto-browserify'
import * as R from 'ramda'
import queryString from 'query-string'
/**
* WooCommerce REST API wrappercat
*
/* eslint-disable camelcase */
import axios from 'axios'
import OAuth from 'oauth-1.0a'
import crypto from 'crypto-browserify'
import * as R from 'ramda'
import queryString from 'query-string'
/**
* WooCommerce REST API wrappercat
*
@nilsnolde
nilsnolde / mngw-w64_boost.MD
Created September 20, 2020 16:17 — forked from zrsmithson/mngw-w64_boost.MD
Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Introduction

Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.

Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow

Get files needed for install

Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the boost_1_68_0.zip source from Sourceforge
__Note: This should work perfectly w

FROM fedora:rawhide
LABEL [email protected]
RUN echo all > /etc/rpm/macros.image-language-conf && \
dnf install -y \
mingw64-protobuf \
protobuf-compiler
@nilsnolde
nilsnolde / update_osm_files.sh
Last active June 29, 2021 12:32
Update regional OSM files (i.e. extracts) in batch with this script. Can be put in a cron job. Requires osmupdate & osmium.
#!/usr/bin/env bash
# Author: Nils Nolde <[email protected]>
# Updated: 15-12-2020
# License: MIT
#
# Update OSM PBF files in batch by specifying a folder and a fixed update interval. For planet updates rather check https://docs.osmcode.org/pyosmium/latest/tools_uptodate.html.
#
# Requires:
# - jq