Skip to content

Instantly share code, notes, and snippets.

View JJ's full-sized avatar
🏠
Working from home

Juan Julián Merelo Guervós JJ

🏠
Working from home
View GitHub Profile
@JJ
JJ / wilcoxon-ga.chunk.pl
Last active August 29, 2015 13:57
Applying Wilcoxon-comparison based partial order to an evolutionary algorithm
for my $p ( @pop ) {
push(@{$p->{'_fitness_memory'}}, $noisy->apply( $p ));
$p->Fitness($comparisons);
}
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
JJ / .bashrc
Last active August 29, 2015 13:59 — forked from justintv/.bashrc
# If you work with git, you've probably had that nagging sensation
# of not knowing what branch you are on, or worse, you pull the wrong branch.
# Worry no longer!
export PS1="\\w<\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)>$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one.
#~/txt/ocio/HashSlash<master>$ git checkout writer
#Switched to branch 'writer'
#~/txt/ocio/HashSlash<writer>$ git checkout master
@JJ
JJ / pre-commit
Last active August 29, 2015 14:00 — forked from ilyakatz/pre-commit
#!/bin/bash -l
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
.git/hooks/pre-commit-master-no-no
if [[ $? == 1 ]]
then
@JJ
JJ / top-github-users-granada.md
Created December 4, 2014 06:21
Top GitHub users, Dec 2014, Granada

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 04 Dec 2013 06:20:22 GMT till Thu, 04 Dec 2014 06:20:22 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 1)
@JJ
JJ / paras.pl
Created December 15, 2014 12:52
Write standard input or files as paragraphs in an HTML correct page
#!/usr/bin/env perl
use CGI qw(:standard);
use strict;
use warnings;
use v5.14; # Para say
my @parrafos = <>;
say start_html("Salida de párrafos");
for my $p (@parrafos) {
@JJ
JJ / equipo.xml
Created July 13, 2011 07:48
Pretty-print XML files with user-specified colors and indents
?xml version="1.0"?>
<?xml-stylesheet href="tienda0.xsl" type="text/xsl"?>
<equipo>
<jugador posicion='portero'>Araña</jugador>
<jugador posicion='delantero'>Cazagoles</jugador>
</equipo>
@JJ
JJ / jquery-test.js
Created January 25, 2012 11:15
Prueba con JQuery para el taller de Ajax de la OSLUGR. Un ejemplo mínimo de uso de Ajax con JQuery
$(function(){
$("a.ajax").click((function(){
$.get($(this).attr('href'), function(data){
alert("Ya");
})
.success(function(data){
alert( 'Lo hise' )})
.error(function(data){
alert( 'Pos no' )})
.complete(function(data){
@size = (1920, 1080);
@center = (-.743653135, .131826563);
$zoom = .000014628;
$max_it = 700;
$oversample = 2;
$_ *= $oversample for (@size);
open $fh, "|-", "convert -size ".join("x",@size)." -depth 8 gray:- ".
"-resize ".(100/$oversample)."% mandel.png";
for $py (1 .. $size[1]) {
@JJ
JJ / compare_strings_mastermind.c
Last active December 10, 2015 17:18
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
#include <stdio.h>
#include <string.h>
// with help from http://www.eskimo.com/~scs/cclass/notes/sx13.html
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
JJ / citations.user.js
Created April 20, 2013 09:43
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…
// ==UserScript==
// @name gcitations
// @namespace http://merelo.net/gmscripts
// @description Compute number of citations per year in Google Citations
// @include http://scholar.google.com/citations*
// ==/UserScript==
var imgs = document.getElementsByTagName('img');
var my_url;