Skip to content

Instantly share code, notes, and snippets.

View juba's full-sized avatar

Julien Barnier juba

View GitHub Profile
@juba
juba / seeks-local.xml
Created November 9, 2011 09:14
Firefox opensearch plugin for a local Seeks proxy
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Seeks Local</os:ShortName>
<os:Description>Real-time p2p pattern matching network for social websearch.</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAwwAAAMMBnc7+MwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBl\
Lm9yZ5vuPBoAAAJCSURBVDiNpZJLSFRxGMV/f2fGGWcc8zI6U5qSmmVPyIW0kURo
@juba
juba / pwsafe2keepassx.py
Created October 9, 2012 12:11
Python script to convert pwsafe exportdb output to a KeePassX Xml file
#!/usr/bin/python
import csv
import datetime
import sys
import StringIO
from genshi.template import MarkupTemplate
class Bunch(object):
@juba
juba / table.multi.R
Last active December 11, 2015 05:49
Fonction R pour le tri à plat "combiné" d'une série de variables binaires
## Fonction pour le tri à plat "combiné" d'une série de variables binaires
## Arguments :
## - df : data frame
## - varnames : vecteur contenant le nom des variables binaires
## - true.codes : liste contenant des valeurs supplémentaires considérées comme "vraies"
## (par défaut TRUE et 1 sont considérées comme vraies)
## - weights: nom de la variable de pondération des lignes (facultatif)
table.multi <- function(df, varnames, true.codes=NULL, weights=NULL) {
true.codes <- c(as.list(true.codes), TRUE, 1)
@juba
juba / gist:5299095
Created April 3, 2013 07:22
Function to get a code block from a StackOverflow question.
##' Get code block from a SO question
##'
##' @param id question id
##' @param index index of the code block to return (one number only)
##' @param cat.output cat the content of the code blocks
##' @import XML
##' @export
get.so <- function (id, index=NULL, cat.output=FALSE) {
doc <- htmlParse(paste("http://stackoverflow.com/questions/",id,sep=""))
pre.index <- ifelse(is.null(index), "", paste("[",as.character(index),"]",sep=""))
$( document ).ready(function() {
$.ajaxSetup({
async: false
});
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/578c9ac0054b437cb5a9e36f5aed5bea/{styleId}/256/{z}/{x}/{y}.png',
cloudmadeAttribution = 'Map data &copy; 2012 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade';
var minimal = L.tileLayer(cloudmadeUrl, {styleId: 22677, attribution: cloudmadeAttribution}),
<BOUCLE_liste_halspub_typdoc(HALS_PUBLICATIONS){id_hal IN #GET{the_hals}}{!par date_production,titre}{doublons recents}{0,#NBPUB}>
<BOUCLE_liste_halspub_affichage(HALS_PUBLICATIONS){!doublons recents}{!par typdoc}>
[<h3>(#TYPDOC|unique)</h3>]
<ul>
[<li>(#HAL_COMPLET|traite_hal_complet)</li>]
</ul>
</BOUCLE_liste_halspub_affichage>
</BOUCLE_liste_halspub_typdoc>
@juba
juba / gist:029aef50bd143a44bb6e
Created June 18, 2015 14:00
Récupérer les points les plus extrêmes des groupes issus d'une classification
library(questionr)
library(FactoMineR)
library(dplyr)
library(imva)
library(ggplot2)
## Jeu de données d'exemple
data(hdv2003)
d <- hdv2003 %>% select(sexe, qualif, cuisine, sport, bricol, freres.soeurs, relig)
library(dplyr)
d <- data.frame(x=rnorm(10), y=runif(10))
tab <- t(sapply(d, function(v) return(list(min=min(v),
"1st q"=quantile(v, 0.25),
median=median(v),
max=max(v)))))
tab <- data.frame(tab)
tab$name <- rownames(tab)
library(questionr)
library(ggplot2)
data(hdv2003)
ggplot(data=hdv2003, aes(y=age, x=sexe, fill=hard.rock)) +
geom_boxplot(position=position_dodge(width=2/3)) +
geom_point(stat="summary", fun.y=mean, shape=21, position=position_dodge(width=2/3))
@juba
juba / .block
Last active October 8, 2016 21:45 — forked from mbostock/.block
Pan & Zoom Axes
license: gpl-3.0