Skip to content

Instantly share code, notes, and snippets.

View jacquarg's full-sized avatar

Guillaume Jacquart jacquarg

View GitHub Profile
@jacquarg
jacquarg / Add-manage_konnectors.patch
Created January 18, 2018 10:23
Add manage konnector page to cozy-collect (git patch)
From 30cfa75c352d74c56ebe4f56c3109d73ae0a04bc Mon Sep 17 00:00:00 2001
From: jacquarg <[email protected]>
Date: Mon, 4 Dec 2017 14:53:23 +0100
Subject: [PATCH] Add managekonnectors page.
---
managekonnectors/app.js | 36 ++++++++++++++++++++++++++++++++++++
managekonnectors/index.html | 33 +++++++++++++++++++++++++++++++++
manifest.webapp | 5 +++++
package.json | 1 +
@jacquarg
jacquarg / gist:e3353679a954ccec7c24
Created December 10, 2014 11:33
ReadLineStream.eachSeries(stream, iterator, callback)
# Read stream line by line tool.
class ReadLineStream
# Applies the function iterator to each line in characters stream, in
# series. The next iterator is only called once the current one has
# completed. This means the iterator functions will complete in the order
# of the lines.
# API mimics async.eachSeries.
# There isn't error handling yet.
eachSeries: (stream, iterator, callback) ->
@jacquarg
jacquarg / receiptdetail_enrich.js
Last active January 4, 2016 17:28
Modèle pour le doctype ReceiptDetail, avec routine pour ajouter le code barre et exhiber des informations du label.
americano = require('americano');
module.exports = ReceiptDetail = americano.getModel('receiptdetail', {
'origin': String,
'order': Number,
'barcode': String,
'label': String,
'family': String,
'familyLabel': String,
'section': String,
@jacquarg
jacquarg / addkey
Created December 26, 2013 21:28
Append a new public key to authorized_key. Useable with git-shell, (putted in git-shell-commands). Forked from http://planzero.org/blog/2012/10/24/hosting_an_admin-friendly_git_server_with_git-shell .
#!/bin/sh
# Read in the SSH key
echo "Input the key to be added:"
read key
# Place the key in a temporary file (it's hard to get ssh-keygen
# to read from stdin; <<< works for bash, but is non-posix)
keyfile=$(tempfile) &&\
@jacquarg
jacquarg / create
Created December 26, 2013 21:26
Create a new git repository. To put in git-shell-commands, to be used with git-shell. Forked from http://planzero.org/blog/2012/10/24/hosting_an_admin-friendly_git_server_with_git-shell
#!/bin/sh
# If no project name is given
if [ $# -eq 0 ]
then
# Display usage and stop
echo "Usage: create <project.git>"
exit 1
@jacquarg
jacquarg / gist:6760429
Last active December 24, 2015 06:59
csv with unicode support for python 2.7 Reader from http://stackoverflow.com/a/6187936/1414450 Writer http://stackoverflow.com/a/5838817/1414450 with a small add-on.
import csv
import cStringIO
import codecs
class UnicodeCsvReader(object):
"From http://stackoverflow.com/a/6187936/1414450."
def __init__(self, f, encoding="utf-8", **kwargs):
self.csv_reader = csv.reader(f, **kwargs)
self.encoding = encoding
@jacquarg
jacquarg / tether_nat.sl4a.sh
Created July 30, 2013 20:41
sl4a sh script, to fix tether bug on xperia neo with ICS. Need root. Idea from http://forum.xda-developers.com/showthread.php?t=1544063 .
su -c "iptables -P FORWARD ACCEPT"
su -c "iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE"
<SCRIPT language=javascript>
function redirectOnUserAgent() {
var mapping = {
// default :
"_default" : "http://www.appsfit.com",
// scheme : market://details?id=<package_name>
"android": "market://details?id=com.appsfit.android",