Skip to content

Instantly share code, notes, and snippets.

View paour's full-sized avatar

Pierre-Luc Paour paour

View GitHub Profile
@paour
paour / iap_google_vat.py
Last active November 5, 2023 22:09
Update a pre-Euro VAT Play Store IAP export to add VAT
# coding=utf-8
import csv
import re
import json
import urllib2
def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):
# csv.py doesn't do Unicode; encode temporarily as UTF-8:
csv_reader = csv.reader(utf_8_encoder(unicode_csv_data),
#! /usr/bin/python
import argparse
import os.path
import glob
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description='''\
Replacing values in arrays.xml with @string/ links. Generates three new files for each locale:
@paour
paour / ReverseProxyDispatcher.java
Created October 14, 2016 07:40
An OkHttp MockWebServer dispatcher that makes it possible to proxy requests to an upstream server while checking the request and response in tests.
interface ReverseProxyValidator {
void validate(RecordedRequest request, Response response);
}
class ReverseProxyDispatcher extends Dispatcher {
private final OkHttpClient client;
private final HttpUrl serverUrl;
private final ReverseProxyValidator validator;
public ReverseProxyDispatcher(HttpUrl url, ReverseProxyValidator validator) {
class ReverseProxyDispatcher extends Dispatcher {
private final OkHttpClient client;
private final HttpUrl serverUrl;
public ReverseProxyDispatcher(HttpUrl url) {
serverUrl = url;
client = new OkHttpClient.Builder().build();
}
@Override
#!/bin/bash
set -ex
source /etc/os-release
declare -A packages
declare -i installed=0
packages[htop]=https://github.com/mback2k/torcx-htop/releases/download/3.0.3-1/torcx.tgz
packages[qemu-ga]=https://github.com/mback2k/torcx-qemu-ga/releases/download/5.0.2-2/torcx.tgz
#!/bin/bash -x
# How to install:
# exo-open "http://developer.android.com/sdk/index.html#Other"
# brew install libav-tools imagemagick ffmpeg
# wget https://gist.githubusercontent.com/paour/0e0454ea63cbe19e91ac/raw/android-screen-to-gif.sh
# chmod a+x android-screen-to-gif.sh
# Help message
function usage() {
@paour
paour / react-native-carousel-view+0.5.1.patch
Created September 26, 2019 12:19
A patch to switch to RNCViewPager.
@paour
paour / ColorPreferenceCompat.java
Created September 23, 2017 11:03
A slight modification of the `ColorPreference` class from https://github.com/jaredrummler/ColorPicker, which can be used with the Preference compat library. https://github.com/jaredrummler/ColorPicker/issues/26
/*
* Copyright (C) 2017 Jared Rummler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package com.frogsparks.mytrails.util;
import android.os.Environment;
import com.frogsparks.mytrails.MyTrails;
import java.io.File;
import java.util.*;
// http://stackoverflow.com/a/15612964/304876
@paour
paour / build_extras.gradle
Last active October 5, 2016 12:04
A simpler and more fool-proof way to handle search providers in Android Gradle builds
def overrideProviderAuthority(packageName, inFile, outFile) {
def xml = new XmlParser().parse(inFile)
xml.findAll{it.name() == 'string'}.each{item ->
if (!item.value().isEmpty() && item.value()[0] instanceof String && item.value()[0].startsWith(".res-auto")) {
item.value()[0] = item.value()[0].replace(".res-auto", packageName)
}
}
saveXML(outFile, xml)