Skip to content

Instantly share code, notes, and snippets.

View raphaelmerx's full-sized avatar

Raphaël Merx raphaelmerx

View GitHub Profile

Extracting data from OpenStreetMap into a Postgres db

1. Download PNG data

wget https://download.geofabrik.de/australia-oceania/papua-new-guinea-latest.osm.pbf

2. Clone the openstreetmap-carto dir

git clone git://github.com/gravitystorm/openstreetmap-carto.git --depth 1

Chuave District
Gumine District
Karimui-Nomane District
Kerowagi District
Kundiawa-Gembogl District
Sina Sina-Yonggomugl District
Daulo District
Goroka District
Henganofi District
Kainantu District
@raphaelmerx
raphaelmerx / convert zawgyi to unicode.py
Created October 17, 2019 01:29
Convert zawgyi in django.po to unicode
#!/usr/bin/env python
# coding: utf-8
import re
import json
with open('projectbank/locale/my/LC_MESSAGES/django.po') as f:
original_lines = f.readlines()
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>test</h:title>
<model>
<instance>
<animal-test id="animal-test">
<animal_more_or_less_1/>
<meta>
<instanceID/>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>event-report-xlsform</h:title>
<model>
<itext>
<translation default="true()" lang="English">
<text id="static_instance-category-0">
<value>Logging</value>
</text>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>paper survey</h:title>
<model>
<itext>
<translation default="true()" lang="English">
<text id="/xlsform-paper-survey/section_2/households_in_village:label">
<value>Approximately how many households are in the village?</value>
<value form="image">/static/img/households.png</value>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>test</h:title>
<model>
<instance>
<test id="test" version="vmexRbhSYZzmxbEKqDC2oy">
<start/>
<end/>
<Incident_title/>
<GPS_coordinates/>

Deal

Three players each receive 12 cards from a 36-pack ranking A K Q J T 9 8 7 6 in each suit. The turn to deal and play passes always to the left.

Objective

The players each lay aside three bid-cards and play the remaining nine cards to tricks. Each player aims to win exactly as many tricks as indicated secretly and in code by their bid-cards. For this purpose, the suits of the bid-cards represent numbers of tricks bid as follows:

[club] = 3 tricks [heart] = 2 tricks [spade] = 1 trick [diamond] = 0 tricks

@raphaelmerx
raphaelmerx / get_vocab.py
Created January 31, 2019 01:42
Extract vocabulary from lines
#! /usr/bin/env python
""" Example usage: python get_vocab.py --input lines_tet.txt --output vocab.tet. """
from __future__ import print_function
import os
import sys
import inspect
import warnings
import argparse
import codecs
@raphaelmerx
raphaelmerx / android-sdk.rb
Created November 28, 2017 04:34
Brew formula for android-sdk 24.4.1
require "base64"
class AndroidSdk < Formula
desc "Android API libraries and developer tools"
homepage "https://developer.android.com/index.html"
url "https://dl.google.com/android/android-sdk_r24.4.1-macosx.zip"
version "24.4.1"
sha256 "ce1638cb48526a0e55857fc46b57eda4349e6512006244ad13dd6c1361c74104"
revision 1