Skip to content

Instantly share code, notes, and snippets.

Working from home

Juan Julián Merelo Guervós JJ

Working from home
Block or report user

Report or block JJ

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
JJ / equipo.xml
Created Jul 13, 2011
Pretty-print XML files with user-specified colors and indents
View equipo.xml
?xml version="1.0"?>
<?xml-stylesheet href="tienda0.xsl" type="text/xsl"?>
<jugador posicion='portero'>Araña</jugador>
<jugador posicion='delantero'>Cazagoles</jugador>
JJ /
Created Oct 24, 2011
Convert CSV files to Pajek .net format. Takes file with two columns as argument; every row indicates a connection from agent in column A to agent in Column B. Outputs a file with the same root and .net extension in .net format, which can be used in Pajek
use strict;
use warnings;
use File::Slurp qw(read_file);
my $csv = shift || die "No defaults; $0 <csvfile>\n";
my $content = read_file($csv) || die "Can't read file $csv: $!\n";
JJ / jquery-test.js
Created Jan 25, 2012
Prueba con JQuery para el taller de Ajax de la OSLUGR. Un ejemplo mínimo de uso de Ajax con JQuery
View jquery-test.js
$.get($(this).attr('href'), function(data){
alert( 'Lo hise' )})
alert( 'Pos no' )})
JJ / compare_strings_mastermind.c
Last active Dec 10, 2015
Compare two strings returning the number of symbols in the correct position ("blacks") and the number of symbols in the wrong position ("whites"), MasterMind style
View compare_strings_mastermind.c
#include <stdio.h>
#include <string.h>
// with help from
int main( int argc, char *argv[] )
char *hidden = argv[1];
char *target = argv[2];
char colors = atoi( argv[3] );
printf( "Hidden %s target %s colors %d\n", hidden, target, colors);
JJ / citations.user.js
Created Apr 20, 2013
GreaseMonkey script that puts on top of the citation graph the actual number of citations per year; works on the Google Citations page. In old versions of Chrome and Chromium this should work without a problem. In new versions you'll have to get out of your way to install it, so don't bother and just switch to Firefox and install the GreaseMonke…
View citations.user.js
// ==UserScript==
// @name gcitations
// @namespace
// @description Compute number of citations per year in Google Citations
// @include*
// ==/UserScript==
var imgs = document.getElementsByTagName('img');
var my_url;
JJ /
Created Aug 26, 2013
Git post-commit hook for modifying .md files to work with gh-pages and just copy other files, like .png, .css and so on.
#!/usr/bin/env perl
use strict;
use warnings;
use v5.14;
use Git::Hooks;
use File::Slurp qw(read_file write_file);
my $layout_preffix=<<EOT;
JJ /
Last active Jan 3, 2016 — forked from isaacs/
Installing node in a very raw box (like the one provided by docker). It will take a bit more than 30 seconds, somehow
#Problem with this is that it needs lots of installed stuff, so I'll put it here
# sudo or admin shell is presupposed
apt-get install make curl python-setuptools gcc g++
#Maybe you can safely supress make and gcc from here, since they are dependencies of g++
#Then you can proceed to the original set
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir /usr/local
mkdir ~/node-latest-install
JJ /
Created Jan 24, 2014
Provisioning chef-solo for ArchLinux 2013
pacman -S ruby make gcc
gem install chef ohai --no-user-install
JJ /
Last active Aug 29, 2015
Applying Wilcoxon-comparison based partial order to an evolutionary algorithm
for my $p ( @pop ) {
push(@{$p->{'_fitness_memory'}}, $noisy->apply( $p ));
for my $i (1..$comparisons) {
my @copy_of_population = @pop;
while( @copy_of_population ) {
my $first = splice( @copy_of_population, rand( @copy_of_population ), 1 );
my $second = splice( @copy_of_population, rand( @copy_of_population ), 1 );
my $aov = Statistics::ANOVA->new();
JJ /
Last active Jan 6, 2017
Install in a perlbrew installation
View is a module that comes with git and can't be installed with the usual cpan magic. If you switch to perlbrew you'll get a Can't locate error when you try to run it, so you need to install it explicitly if you want to use it in your own installation, mainly if you use perlbrew I use it in my novels for post-commit hooks, so here's what you have to do to have it available in your programs

bash$ cp /usr/share/perl5/ ~/perl5/perlbrew/perls/perl-5.x.y/lib/site_perl/5.x.y

you'll have to change x.y by the perl version you're actually using. You'll also need, so do

bash$ cp /usr/share/perl5/ ~/perl5/perlbrew/perls/perl-5.x.y/lib/site_perl/5.x.y

And that's it!

You can’t perform that action at this time.