Skip to content

Instantly share code, notes, and snippets.

View rgaudin's full-sized avatar

rgaudin rgaudin

  • yɛlɛman
  • Bamako, Mali
View GitHub Profile
@rgaudin
rgaudin / kiwix-serve-helper.sh
Last active August 29, 2015 14:02
kiwix-serve helper for cybook
#!/bin/sh
###
# kiwix-serve helper for Cybook Odyssey
#
# launch upon mount/unmount event of the SD card and at boot time.
# - tries to kill a runnning kiwix-serve
# - tries to launch kiwix-serve if a library file is present
#
###
@rgaudin
rgaudin / 0001-minor-patch-to-allow-autogen-to-work-on-OSX-requires.patch
Last active December 20, 2015 20:38
minor patch to allow autogen to work on OSX (requires glibtoolize instead of libtoolize)
From 768f7cfd8af94dfdad250ef1ecbd0f57b389c360 Mon Sep 17 00:00:00 2001
From: renaud gaudin <rgaudin@gmail.com>
Date: Fri, 9 Aug 2013 13:02:21 +0800
Subject: [PATCH] minor patch to allow autogen to work on OSX (requires
glibtoolize instead of libtoolize)
---
zimlib/autogen.sh | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
@rgaudin
rgaudin / kannel_formhub_gateway.py
Created May 1, 2013 14:02
Kannel Formhub Gateway
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
''' Example Kannel Service Gateway for use with Formhub
This gateway will receive a message from Kannel and forward it to
the Formhub SMS API.
The Formhub SMS API will reply with a status for the submission and
a text message for the end user.
@rgaudin
rgaudin / rapidsms_formhub_app.py
Last active December 16, 2015 20:49
Example RapidSMS handler for Formhub.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
''' Example RapidSMS Handler for use with Formhub
This handler will receive a message from RapidSMS and forward it to
the Formhub SMS API.
The Formhub SMS API will reply with a status for the submission and
a text message for the end user.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import uuid
import csv
import codecs
import cStringIO
@rgaudin
rgaudin / formhub_submission.py
Last active December 12, 2015 03:29
Example scripted submission to formhub
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from microsite.formhub import (submit_xml_forms_formhub_raw,
ErrorUploadingDataToFormhub,
ErrorMultipleUploadingDataToFormhub)
submission_target_user = 'reg'
submission_url = 'http://formhub.org/%s/submission' % submission_target_user
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import uuid
import copy
from collections import OrderedDict
import pandas as pd
#!/usr/bin/env python
import os
import sys
import tempfile
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = os.environ.get('DJANGO_SETTINGS_MODULE',
'settings')
@rgaudin
rgaudin / ssid_generator.py
Created September 15, 2012 13:22
Soil Sample ID
#!/usr/bin/env python
import random
CHARS = "abcdefghijklmnopqrstuvwxyz12345679ABCDEFGHIJKLMNOPQRSTUVWXYZ"
SPID_LEN = 6
def generate_spid(country_code='US'):
''' Generate a SPID_LEN random string prefix with XX- with XX as country '''
@rgaudin
rgaudin / formhub_data_importer.py
Created August 30, 2012 16:47
Script to import data from CSV into a formhub Form
#!/usr/bin/env python
# encoding=utf-8
'''
formhub data importer
Automates the submission of formhub XForms from a CSV file,
possibly an export from another formhub form.
Launch with `bulk` argument to trigger bulk submission behavior (only